Skip to content

Commit 4587a23

Browse files
committed
Wait for postgres to fully start before continuing
1 parent 0098ad5 commit 4587a23

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

project/docker-entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ VENV_DIR_PATH=/opt/asylum-venv/
1313

1414
# make sure postgresql is running
1515
sudo -u postgres service postgresql start
16+
set +e
17+
export PGPASSWORD=asylum; while true; do psql -q asylum -c 'SELECT 1;' 1>/dev/null 2>&1 ; if [ "$?" -ne "0" ]; then echo "Waiting for psql"; sleep 1; else break; fi; done
18+
set -e
1619

1720
# Start forego or execute a command in the virtualenv
1821
if [ "$#" -eq 0 ]; then
22+
echo "Starting devel server"
1923
maildump --http-ip 0.0.0.0 -p ~/maildump.pid &
2024
npm run build
2125
npm run watch &
2226
NPM=$!
2327
./manage.py runserver 0.0.0.0:8000
2428
maildump -p ~/maildump.pid --stop
2529
else
30+
echo "Calling $@"
2631
"$@"
2732
fi

0 commit comments

Comments
 (0)