summaryrefslogtreecommitdiff
path: root/docker-run.sh
diff options
context:
space:
mode:
authorMarkus Witt <feuerrot@feuerrot.org>2019-04-21 23:13:03 +0200
committerMarkus Witt <feuerrot@feuerrot.org>2019-05-03 22:36:12 +0200
commit46e85324df762672718c0a6a5ca60fb247e89e5d (patch)
tree5c462e5b16ffc3ff9f8e2d52da6263a62351afcb /docker-run.sh
parent7df47bdc4e7d7a5f9a14a95069da454f6b890e77 (diff)
docker: add docker-compose configuration
🔥docker🔥compose🔥
Diffstat (limited to 'docker-run.sh')
-rwxr-xr-xdocker-run.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/docker-run.sh b/docker-run.sh
index f147b77..29ffa7b 100755
--- a/docker-run.sh
+++ b/docker-run.sh
@@ -1,6 +1,22 @@
-#!/bin/sh
+#!/bin/bash
set -eu
+WAIT_DB_HOST=${TRAVELYNX_DB_HOST}
+WAIT_DB_PORT=5432
+
+wait_for_db() {
+ set +e
+ for i in $(seq 1 ${WAIT_DB_TIMEOUT:-5})
+ do
+ (echo >/dev/tcp/${WAIT_DB_HOST}/${WAIT_DB_PORT}) &>/dev/null
+ if [ $? -eq 0 ]; then
+ break
+ fi
+ sleep 1
+ done
+ set -e
+}
+
if [ ! -f travelynx.conf ]
then
echo "The configuration file is missing"
@@ -17,6 +33,8 @@ then
export EMAIL_SENDER_TRANSPORT_PORT=${TRAVELYNX_MAIL_PORT:-25}
fi
+wait_for_db
+
perl index.pl database migrate
exec /usr/local/bin/hypnotoad -f index.pl