1
0
mirror of https://bitbucket.org/shim_/mumble.git synced 2019-09-08 21:58:51 +02:00

wait for mysql to come up

This commit is contained in:
shim_
2016-05-26 00:46:43 +02:00
committed by Crafter6432
parent b155571504
commit 8199f63921
2 changed files with 13 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
FROM alpine:latest FROM alpine:latest
RUN apk update && \ RUN apk update && \
apk add --no-cache murmur qt-mysql wget bash apk add --no-cache murmur qt-mysql netcat-openbsd wget bash
RUN wget --no-check-certificate -O /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.0.1/dumb-init_1.0.1_amd64 RUN wget --no-check-certificate -O /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.0.1/dumb-init_1.0.1_amd64
COPY murmur.conf /etc/murmur.conf COPY murmur.conf /etc/murmur.conf

14
init.sh
View File

@@ -13,6 +13,14 @@ function write_config_if_else {
fi fi
} }
function wait_for_mysql {
if [ ! -z "$DATABASE" ] && [ "$DATABASE" == "MYSQL" ]; then
PORT=3306
if [ ! -z "$DB_PORT" ] ; then PORT="$DB_PORT" ;fi
while ! nc -z $DB_HOST $PORT; do sleep 3; done
fi
}
if [ ! -e /data/murmur.conf ]; then if [ ! -e /data/murmur.conf ]; then
echo Starting Initialization echo Starting Initialization
cp /etc/murmur.conf /data/murmur.conf cp /etc/murmur.conf /data/murmur.conf
@@ -37,9 +45,11 @@ if [ ! -e /data/murmur.conf ]; then
else else
write_config 'database' '/data/db.sqlite' write_config 'database' '/data/db.sqlite'
fi fi
echo Initilization Completed
wait_for_mysql
if [ ! -z "$SUPW" ] ; then /usr/bin/murmurd -fg -ini /data/murmur.conf -supw $SUPW ;fi if [ ! -z "$SUPW" ] ; then /usr/bin/murmurd -fg -ini /data/murmur.conf -supw $SUPW ;fi
echo Initilization Completed
fi fi
wait_for_mysql
/usr/bin/murmurd -fg -ini /data/murmur.conf /usr/bin/murmurd -fg -ini /data/murmur.conf