diff --git a/wrapper.sh b/wrapper.sh index ac5aebf..ee7d910 100755 --- a/wrapper.sh +++ b/wrapper.sh @@ -1,11 +1,15 @@ #!/bin/bash - if [ "$FLASK_ENV" == "production" ]; then - sudo -u pybook ENV=${ENV} gunicorn --bind=0.0.0.0:80 --timeout 300 --workers=2 --threads=2 main:app --env FLASK_ENV="production" --error-logfile /code/gunicorn.error.log --access-logfile /code/gunicorn.log --capture-output --enable-stdio-inheritance + export WORKERS=2 + export THREADS=2 else cd /pybook_mapped_volume - sudo -u pybook ENV=${ENV} gunicorn --bind=0.0.0.0:80 --timeout 300 --workers=1 --threads=1 main:app --env FLASK_ENV="$FLASK_ENV" --error-logfile ./gunicorn.error.log --access-logfile ./gunicorn.log --capture-output --enable-stdio-inheritance --reload + export WORKERS=1 + export THREADS=1 fi -# just in case it fails + +sudo -u pybook gunicorn --bind=0.0.0.0:80 --timeout 300 --workers=$WORKERS --threads=$THREADS main:app --env FLASK_ENV="$FLASK_ENV" --error-logfile gunicorn.error.log --access-logfile gunicorn.log --capture-output --enable-stdio-inheritance + +# just in case it fails this keeps the container up so you can check gunicorn logs sleep 99999