summaryrefslogtreecommitdiffstats
path: root/stacksmith/user-scripts/run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'stacksmith/user-scripts/run.sh')
-rwxr-xr-xstacksmith/user-scripts/run.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/stacksmith/user-scripts/run.sh b/stacksmith/user-scripts/run.sh
new file mode 100755
index 00000000..2aea7ea0
--- /dev/null
+++ b/stacksmith/user-scripts/run.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+set -euo pipefail
+
+readonly CONF=/build/env.config
+
+source ${CONF}
+
+# wait for DB
+check_db() {
+ mongo $MONGO_URL --eval "db.runCommand( { connectionStatus: 1} )" --quiet | python -c 'import json,sys;obj=json.load(sys.stdin);code = 0 if obj["ok"]==1 else 1; sys.exit(code);'
+}
+until check_db; do
+ period=5
+ echo "Cannot connect to db, waiting ${period} seconds before trying again..."
+ sleep ${period}
+done
+
+cd /build
+echo "starting the wekan service..."
+node main.js