10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/kaiser/databases/postgres.rb', line 10
def options_hash
testpass = @options[:root_password] || 'testpassword'
parameters = @options[:parameters] || ''
port = @options[:port] || 3306
platform = @options[:platform] || 'linux/amd64'
{
port: port,
data_dir: '/var/lib/postgresql/data',
params: "-e POSTGRES_PASSWORD=#{testpass}",
commands: parameters,
platform: platform,
waitscript_params: "
-e PG_HOST=<%= db_container_name %>
-e PG_USER=postgres
-e PGPASSWORD=#{testpass}
-e PG_DATABASE=postgres",
waitscript: <<~SCRIPT
#!/bin/sh
RETRIES=5
until psql -h $PG_HOST -U $PG_USER -d $PG_DATABASE -c "select 1" > /dev/null 2>&1 || [ $RETRIES -eq 0 ]; do
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..."
sleep 1
done
SCRIPT
}
end
|