2020-04-02 00:49:40 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2022-02-17 17:56:24 +01:00
|
|
|
./bin/migrate-check
|
2022-01-06 14:30:47 +01:00
|
|
|
|
2022-07-27 21:37:44 +02:00
|
|
|
# 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
|
2022-08-19 12:03:57 +02:00
|
|
|
export STATSD_PORT=${STATSD_PORT:-8125}
|
2022-07-27 21:37:44 +02:00
|
|
|
|
2022-08-22 18:14:43 +02:00
|
|
|
exec gunicorn posthog.wsgi \
|
2020-11-05 11:07:39 +01:00
|
|
|
--config gunicorn.config.py \
|
|
|
|
--bind 0.0.0.0:8000 \
|
|
|
|
--log-file - \
|
|
|
|
--log-level info \
|
|
|
|
--access-logfile - \
|
|
|
|
--worker-tmp-dir /dev/shm \
|
|
|
|
--workers=2 \
|
2022-08-26 12:36:40 +02:00
|
|
|
--threads=8 \
|
2023-10-11 09:54:48 +02:00
|
|
|
--keep-alive=60 \
|
2023-09-20 23:14:16 +02:00
|
|
|
--backlog=${GUNICORN_BACKLOG:-1000} \
|
2022-01-31 11:14:04 +01:00
|
|
|
--worker-class=gthread \
|
2022-08-19 12:03:57 +02:00
|
|
|
${STATSD_HOST:+--statsd-host $STATSD_HOST:$STATSD_PORT} \
|
2022-10-21 14:27:10 +02:00
|
|
|
--limit-request-line=16384 $@
|