Use /dev/shm for worker-tmp-dir in gunicorn in Docker (#1003)

* Use `/dev/shm` for `--worker-tmp-dir` in gunicorn in Docker
selenium-screenshot-testing
Kevin Chung 2019-05-25 01:25:24 -04:00 committed by GitHub
parent e6b865b61d
commit 8a35557f08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@ WORKERS=${WORKERS:-1}
WORKER_CLASS=${WORKER_CLASS:-gevent} WORKER_CLASS=${WORKER_CLASS:-gevent}
ACCESS_LOG=${ACCESS_LOG:--} ACCESS_LOG=${ACCESS_LOG:--}
ERROR_LOG=${ERROR_LOG:--} ERROR_LOG=${ERROR_LOG:--}
WORKER_TEMP_DIR=${WORKER_TEMP_DIR:-/dev/shm}
# Check that a .ctfd_secret_key file or SECRET_KEY envvar is set # Check that a .ctfd_secret_key file or SECRET_KEY envvar is set
if [ ! -f .ctfd_secret_key ] && [ -z "$SECRET_KEY" ]; then if [ ! -f .ctfd_secret_key ] && [ -z "$SECRET_KEY" ]; then
@ -41,6 +42,7 @@ echo "Starting CTFd"
exec gunicorn 'CTFd:create_app()' \ exec gunicorn 'CTFd:create_app()' \
--bind '0.0.0.0:8000' \ --bind '0.0.0.0:8000' \
--workers $WORKERS \ --workers $WORKERS \
--worker-tmp-dir "$WORKER_TEMP_DIR" \
--worker-class "$WORKER_CLASS" \ --worker-class "$WORKER_CLASS" \
--access-logfile "$ACCESS_LOG" \ --access-logfile "$ACCESS_LOG" \
--error-logfile "$ERROR_LOG" --error-logfile "$ERROR_LOG"