summaryrefslogtreecommitdiffstats
path: root/stacksmith
diff options
context:
space:
mode:
authorJose Fuentes <jsfuentescastillo@gmail.com>2018-12-17 13:09:32 +0100
committerJose Fuentes <jsfuentescastillo@gmail.com>2018-12-17 13:09:32 +0100
commitcac74122f204bfb13e9e277901b9a385c75f4135 (patch)
treefb4b50610afa66325d77458365112e2ac84c4585 /stacksmith
parent7b3e2c58e29de6477dfcd2e2051d241c67266c85 (diff)
downloadwekan-cac74122f204bfb13e9e277901b9a385c75f4135.tar.gz
wekan-cac74122f204bfb13e9e277901b9a385c75f4135.tar.bz2
wekan-cac74122f204bfb13e9e277901b9a385c75f4135.zip
Wait for DB on boot
Diffstat (limited to 'stacksmith')
-rwxr-xr-xstacksmith/user-scripts/boot.sh4
-rwxr-xr-xstacksmith/user-scripts/build.sh2
-rwxr-xr-xstacksmith/user-scripts/run.sh12
3 files changed, 12 insertions, 6 deletions
diff --git a/stacksmith/user-scripts/boot.sh b/stacksmith/user-scripts/boot.sh
index 19ea8825..bd95102f 100755
--- a/stacksmith/user-scripts/boot.sh
+++ b/stacksmith/user-scripts/boot.sh
@@ -1,10 +1,6 @@
#!/bin/bash
set -euxo pipefail
-#!/bin/bash
-
-set -euo pipefail
-
# This file will store the config env variables needed by the app
readonly CONF=/build/env.config
diff --git a/stacksmith/user-scripts/build.sh b/stacksmith/user-scripts/build.sh
index 144ba468..a8f756e6 100755
--- a/stacksmith/user-scripts/build.sh
+++ b/stacksmith/user-scripts/build.sh
@@ -11,7 +11,7 @@ FIBERS_VERSION=2.0.0
ARCHITECTURE=linux-x64
NODE_VERSION=v10.14.1
-sudo yum groupinstall 'Development Tools'
+sudo yum groupinstall -y 'Development Tools'
sudo yum install -y http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
sudo yum install -y git
diff --git a/stacksmith/user-scripts/run.sh b/stacksmith/user-scripts/run.sh
index e7cc6df6..2aea7ea0 100755
--- a/stacksmith/user-scripts/run.sh
+++ b/stacksmith/user-scripts/run.sh
@@ -1,10 +1,20 @@
#!/bin/bash
-set -euxo pipefail
+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