Revert 762 log envvar (#845)

* Stop gunicorn from logging to `LOG_FOLDER` in docker without explicit opt-in
* Re-add the `LOG_FOLDER` envvar to docker-compose so we don't try to write to the read-only host
* Add `ACCESS_LOG` and `ERROR_LOG` envvars to docker to specify where gunicorn will log to
This commit is contained in:
Kevin Chung
2019-01-21 12:17:59 -05:00
committed by GitHub
parent 3af036b4b2
commit 92e7be224b
2 changed files with 5 additions and 9 deletions

View File

@@ -11,6 +11,9 @@ services:
- DATABASE_URL=mysql+pymysql://root:ctfd@db/ctfd
- REDIS_URL=redis://cache:6379
- WORKERS=4
- LOG_FOLDER=/var/log/CTFd
- ACCESS_LOG=-
- ERROR_LOG=-
volumes:
- .data/CTFd/logs:/var/log/CTFd
- .data/CTFd/uploads:/var/uploads

View File

@@ -2,6 +2,8 @@
set -eo pipefail
WORKERS=${WORKERS:-1}
ACCESS_LOG=${ACCESS_LOG:--}
ERROR_LOG=${ERROR_LOG:--}
# Check that a .ctfd_secret_key file or SECRET_KEY envvar is set
if [ ! -f .ctfd_secret_key ] && [ -z "$SECRET_KEY" ]; then
@@ -28,15 +30,6 @@ if [ -n "$DATABASE_URL" ]
sleep 1;
fi
# Log to stdout/stderr by default
if [ -n "$LOG_FOLDER" ]; then
ACCESS_LOG=${LOG_FOLDER}/access.log
ERROR_LOG=${LOG_FOLDER}/error.log
else
ACCESS_LOG=-
ERROR_LOG=-
fi
# Initialize database
python manage.py db upgrade