mirror of
https://github.com/wekan/wekan.git
synced 2026-02-27 10:24:07 +01:00
Wait for DB on boot
This commit is contained in:
parent
7b3e2c58e2
commit
cac74122f2
4 changed files with 13 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue