feat: allow asgi/wsgi to be configurable by env var (#21635)

allow asgi/wsgi to be configurable by env var

This will let us roll out asgi separate across services as we had
issues with our recordings capture pods on asgi
This commit is contained in:
Frank Hamand
2024-04-18 10:13:06 +01:00
committed by GitHub
parent 3083ed053f
commit 3f9fd8aec7
4 changed files with 9 additions and 5 deletions

View File

@@ -33,7 +33,7 @@
!plugin-server/.prettierrc
!share/GeoLite2-City.mmdb
!hogvm/python
!unit.json
!unit.json.tpl
!plugin-transpiler/src
!plugin-transpiler/*.*
!test-runner-jest.config.js

View File

@@ -11,6 +11,9 @@ 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}
envsubst < /docker-entrypoint.d/unit.json.tpl > /docker-entrypoint.d/unit.json
# We need to run as --user root so that nginx unit can proxy the control socket for stats
# However each application is run as "nobody"

View File

@@ -249,7 +249,8 @@ RUN apt-get update && \
"libpq-dev" \
"libxmlsec1" \
"libxmlsec1-dev" \
"libxml2"
"libxml2" \
"gettext-base"
# Install NodeJS 18.
RUN apt-get install -y --no-install-recommends \
@@ -311,6 +312,6 @@ EXPOSE 8000
# Expose the port from which we serve OpenMetrics data.
EXPOSE 8001
COPY unit.json /docker-entrypoint.d/unit.json
COPY unit.json.tpl /docker-entrypoint.d/unit.json.tpl
USER root
CMD ["./bin/docker"]

View File

@@ -43,8 +43,8 @@
"processes": 4,
"working_directory": "/code",
"path": ".",
"module": "posthog.wsgi",
"protocol": "wsgi",
"module": "posthog.$NGINX_UNIT_PYTHON_PROTOCOL",
"protocol": "$NGINX_UNIT_PYTHON_PROTOCOL",
"user": "nobody",
"limits": {
"requests": 50000