diff --git a/backend/config/__init__.py b/backend/config/__init__.py index fd747e4a0..4be88aacf 100644 --- a/backend/config/__init__.py +++ b/backend/config/__init__.py @@ -16,7 +16,6 @@ def str_to_bool(value: str) -> bool: DEV_MODE: Final = str_to_bool(os.environ.get("DEV_MODE", "false")) DEV_HOST: Final = os.environ.get("DEV_HOST", "127.0.0.1") DEV_PORT: Final = int(os.environ.get("DEV_PORT", "5000")) -GUNICORN_WORKERS: Final = int(os.environ.get("GUNICORN_WORKERS", 2)) # PATHS ROMM_BASE_PATH: Final = os.environ.get("ROMM_BASE_PATH", "/romm") diff --git a/docker/init_scripts/init b/docker/init_scripts/init index 62e137ffa..3d1836683 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -19,12 +19,14 @@ debug_log() { fi } -# print debug log output if enabled info_log() { echo "INFO: [init][$(date +"%Y-%m-%d %T")]" "${@}" || true } -# print error log output if enabled +warn_log() { + echo "WARNING: [init][$(date +"%Y-%m-%d %T")]" "${@}" || true +} + error_log() { echo "ERROR: [init][$(date +"%Y-%m-%d %T")]" "${@}" || true exit 1 @@ -45,6 +47,13 @@ start_bin_gunicorn() { # commands to start our main application and store its PID to check for crashes info_log "starting gunicorn" + + # TODO: Remove support for GUNICORN_WORKERS in future version. + if [[ -n ${GUNICORN_WORKERS-} ]]; then + warn_log "GUNICORN_WORKERS variable is deprecated, use WEB_CONCURRENCY instead" + : ${WEB_CONCURRENCY:=${GUNICORN_WORKERS}} + fi + gunicorn \ --access-logfile - \ --error-logfile - \ @@ -53,7 +62,7 @@ start_bin_gunicorn() { --bind=unix:/tmp/gunicorn.sock \ --pid=/tmp/gunicorn.pid \ --forwarded-allow-ips="*" \ - --workers "${GUNICORN_WORKERS:=2}" \ + --workers "${WEB_CONCURRENCY:-2}" \ main:app & } diff --git a/env.template b/env.template index 11ce80528..83a4baca6 100644 --- a/env.template +++ b/env.template @@ -4,7 +4,7 @@ KIOSK_MODE=false # Gunicorn (optional) # Workers -> (2 × CPU cores) + 1 -GUNICORN_WORKERS=4 +WEB_CONCURRENCY=4 # IGDB credentials IGDB_CLIENT_ID=