update ci init script

pull/16028/head
alberhander 4 years ago
parent 5c13f36a8c
commit 5fdb73a17c

@ -1 +1 @@
Subproject commit 3571adfd3f2aa6a84ac9c6c2ca4a2fe4ec549a62
Subproject commit 1deed37471dd6246fdec023fb388b082d44a5648

@ -1,9 +1,26 @@
#!/bin/bash
set -e
DB_IP=${DB_IP:-localhost}
TIMEOUT_CONN=${TIMEOUT_CONN:-120}
MAX_RETRIES=${MAX_RETRIES:-10}
SLEEP_RETRY=$((TIMEOUT_CONN/MAX_RETRIES))
SLEEP_DEBUGING=${SLEEP_DEBUGING:-120}
cd /cartodb
mkdir -p log && chmod -R 777 log/
createdb -T template0 -O postgres -h localhost -U postgres -E UTF8 template_postgis || true
psql -h localhost -U postgres template_postgis -c 'CREATE EXTENSION IF NOT EXISTS postgis;CREATE EXTENSION IF NOT EXISTS postgis_topology;'
REDIS_PORT=6335 RAILS_ENV=test bundle exec rake cartodb:test:prepare
cd -
echo "Waiting for the database to be ready. Retrying every $SLEEP_RETRY seconds until it reaches a total of $MAX_RETRIES retries"
n=0
until [[ $n -eq $MAX_RETRIES ]]; do
echo "Try $((n+1))..."
pg_isready -U postgres -h "$DB_IP" && break
n=$((n+1))
sleep "$SLEEP_RETRY"
done
createdb -T template0 -O postgres -h "${DB_IP}" -U postgres -E UTF8 template_postgis || true
psql -h "${DB_IP}" -U postgres -d template_postgis -c 'CREATE EXTENSION IF NOT EXISTS postgis;CREATE EXTENSION IF NOT EXISTS postgis_topology;CREATE EXTENSION IF NOT EXISTS postgis_raster;'
RAILS_ENV=test bundle exec rake cartodb:test:prepare

Loading…
Cancel
Save