Allow custom MySQL ports in docker entrypoint (#848)

* Allow DATABASE_URL to contain custom MySQL ports for docker-entrypoint.sh
* Drop WORKERS count to 1 to avoid dealing with Flask-SocketIO sticky sessions
selenium-screenshot-testing
Kevin Chung 2019-01-21 22:40:23 -05:00 committed by GitHub
parent 92e7be224b
commit 06f0715369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@ services:
- UPLOAD_FOLDER=/var/uploads
- DATABASE_URL=mysql+pymysql://root:ctfd@db/ctfd
- REDIS_URL=redis://cache:6379
- WORKERS=4
- WORKERS=1
- LOG_FOLDER=/var/log/CTFd
- ACCESS_LOG=-
- ERROR_LOG=-

View File

@ -18,9 +18,11 @@ fi
# Check that the database is available
if [ -n "$DATABASE_URL" ]
then
database=`echo $DATABASE_URL | awk -F[@//] '{print $4}'`
echo "Waiting for $database to be ready"
while ! mysqladmin ping -h $database --silent; do
url=`echo $DATABASE_URL | awk -F[@//] '{print $4}'`
database=`echo $url | awk -F[:] '{print $1}'`
port=`echo $url | awk -F[:] '{print $2}'`
echo "Waiting for $database:$port to be ready"
while ! mysqladmin ping -h "$database" -P "$port" --silent; do
# Show some progress
echo -n '.';
sleep 1;