From 87cfc3fae414763d86d3d73129b35344eaffb450 Mon Sep 17 00:00:00 2001 From: Frank Hamand Date: Wed, 29 May 2024 12:01:09 +0100 Subject: [PATCH] feat: add env var for number of nginx unit worker processes (#22567) add env var for number of nginx unit worker processes i suspect that with asgi we'll be better off with 1 instead of 4 worker processes - i'd like us to be able to test this per deployment via an env var --- bin/docker-server-unit | 1 + unit.json.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/docker-server-unit b/bin/docker-server-unit index 52d8057271d..9d2a8592cd5 100755 --- a/bin/docker-server-unit +++ b/bin/docker-server-unit @@ -12,6 +12,7 @@ trap 'rm -rf "$PROMETHEUS_MULTIPROC_DIR"' EXIT export PROMETHEUS_METRICS_EXPORT_PORT=8001 export STATSD_PORT=${STATSD_PORT:-8125} export NGINX_UNIT_PYTHON_PROTOCOL=${NGINX_UNIT_PYTHON_PROTOCOL:-wsgi} +export NGINX_UNIT_APP_PROCESSES=${NGINX_UNIT_APP_PROCESSES:-4} envsubst < /docker-entrypoint.d/unit.json.tpl > /docker-entrypoint.d/unit.json diff --git a/unit.json.tpl b/unit.json.tpl index 656a0892a01..ef1ba4b3ffe 100644 --- a/unit.json.tpl +++ b/unit.json.tpl @@ -40,7 +40,7 @@ "applications": { "posthog": { "type": "python 3.10", - "processes": 4, + "processes": $NGINX_UNIT_APP_PROCESSES, "working_directory": "/code", "path": ".", "module": "posthog.$NGINX_UNIT_PYTHON_PROTOCOL",