mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-21 21:49:51 +01:00
84ea166e9b
* chore: Allow instrumentation of gunicorn with statsd In order to ensure that gunicorn is performing optimally, it helps to monitor it with statsd. This change allows us to include the flags needed to send UDP packets to a statsd instance. Docs: https://docs.gunicorn.org/en/stable/instrumentation.html * Update bin/docker-server Co-authored-by: Harry Waye <harry@posthog.com> * Update bin/docker-server Co-authored-by: Harry Waye <harry@posthog.com> Co-authored-by: Harry Waye <harry@posthog.com>
27 lines
760 B
Bash
Executable File
27 lines
760 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
./bin/migrate-check
|
|
|
|
# To ensure we are able to expose metrics from multiple processes, we need to
|
|
# provide a directory for `prometheus_client` to store a shared registry.
|
|
export PROMETHEUS_MULTIPROC_DIR=$(mktemp -d)
|
|
trap 'rm -rf "$PROMETHEUS_MULTIPROC_DIR"' EXIT
|
|
|
|
export PROMETHEUS_METRICS_EXPORT_PORT=8001
|
|
export STATSD_PREFIX=${STATSD_PREFIX:-posthog}
|
|
|
|
gunicorn posthog.wsgi \
|
|
--config gunicorn.config.py \
|
|
--bind 0.0.0.0:8000 \
|
|
--log-file - \
|
|
--log-level info \
|
|
--access-logfile - \
|
|
--worker-tmp-dir /dev/shm \
|
|
--workers=2 \
|
|
--threads=4 \
|
|
--worker-class=gthread \
|
|
${STATSD_HOST:+--statsd-host $STATSD_HOST} \
|
|
${STATSD_HOST:+--statsd-prefix $STATSD_PREFIX} \
|
|
--limit-request-line=8190 $@
|