Files
CTFd/docker-compose-run.sh
Thomas Chauchefoin 07bfe5eab7 Fix MySQL availability tries counter (#150)
The variable `i` was not declared and never incremented.
2016-09-13 19:34:06 -04:00

18 lines
448 B
Bash
Executable File

#!/bin/sh
sed "s;sqlite:///ctfd.db;mysql+pymysql://${MYSQL_USER}:${MYSQL_PASSWORD}@db/ctfd;g" CTFd/config.py -i
# wait for mysql to start
cnt=0
while ! nc db 3306 >/dev/null 2>&1 < /dev/null; do
if [ $cnt -ge 50 ]; then
echo "$(date) - db:3306 still not reachable, giving up"
exit 1
fi
echo "$(date) - waiting for db:3306..."
sleep 1
cnt=`expr $cnt + 1`
done
gunicorn --bind 0.0.0.0:8000 -w 4 "CTFd:create_app()"