Skip to content

Commit

Permalink
feat: enable GUNICORN configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kikkomep committed Feb 27, 2024
1 parent 3ef763a commit 9a715c7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
20 changes: 13 additions & 7 deletions docker/lm_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ else
export PROMETHEUS_MULTIPROC_DIR=$(mktemp -d ${metrics_base_path}/backend.XXXXXXXX)
fi
export GUNICORN_SERVER="true"
gunicorn --workers "${GUNICORN_WORKERS}" \
--threads "${GUNICORN_THREADS}" \
--config "${GUNICORN_CONF}" \
--certfile="${CERT}" --keyfile="${KEY}" \
--timeout 60 \
-b "0.0.0.0:8000" \
"app"
gunicorn --workers "${GUNICORN_WORKERS}" \
--threads "${GUNICORN_THREADS}" \
--max_requests "${GUNICORN_MAX_REQUESTS}"
--max_requests_jitter "${GUNICORN_MAX_REQUESTS_JITTER}" \
--worker_connections "${GUNICORN_WORKER_CONNECTIONS}" \
--worker_class "${GUNICORN_WORKER_CLASS}" \
--timeout "${GUNICORN_TIMEOUT}" \
--graceful_timeout "${GUNICORN_GRACEFUL_TIMEOUT}" \
--keepalive "${GUNICORN_KEEPALIVE}" \
--config "${GUNICORN_CONF}" \
--certfile="${CERT}" --keyfile="${KEY}" \
-b "0.0.0.0:8000" \
"app"
fi
10 changes: 8 additions & 2 deletions k8s/templates/settings.secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ stringData:
LIFEMONITOR_ADMIN_PASSWORD={{ .Values.lifemonitor.administrator.password }}
# Gunicorn settings
GUNICORN_WORKERS=1
GUNICORN_THREADS=2
GUNICORN_WORKERS={{ .Values.lifemonitor.gunicorn.workers | default 2 }}
GUNICORN_THREADS={{ .Values.lifemonitor.gunicorn.threads | default 4 }}
GUNICORN_WORKER_CONNECTIONS={{ .Values.lifemonitor.gunicorn.worker_connections | default 1000 }}
GUNICORN_MAX_REQUESTS={{ .Values.lifemonitor.gunicorn.max_requests | default 0 }}
GUNICORN_MAX_REQUESTS_JITTER={{ .Values.lifemonitor.gunicorn.max_requests_jitter | default 0 }}
GUNICORN_TIMEOUT={{ .Values.lifemonitor.gunicorn.timeout | default 30 }}
GUNICORN_GRACEFUL_TIMEOUT={{ .Values.lifemonitor.gunicorn.graceful_timeout | default 30 }}
GUNICORN_KEEP_ALIVE={{ .Values.lifemonitor.gunicorn.keep_alive | default 2 }}
# Set a warning message (displayed in the login screen and the user's profile page)
WARNING_MESSAGE={{- .Values.lifemonitor.warning_message | default "" }}
Expand Down
6 changes: 6 additions & 0 deletions settings.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ POSTGRESQL_PASSWORD=foobar
# Gunicorn settings
GUNICORN_WORKERS=1
GUNICORN_THREADS=2
GUNICORN_MAX_REQUESTS=0
GUNICORN_MAX_REQUESTS_JITTER=0
GUNICORN_WORKER_CONNECTIONS=1000
GUNICORN_TIMEOUT=30
GUNICORN_GRACEFUL_TIMEOUT=30
GUNICORN_KEEP_ALIVE=2

# Dramatiq worker settings
WORKER_PROCESSES=1
Expand Down

0 comments on commit 9a715c7

Please sign in to comment.