diff --git a/enterprise.sh b/enterprise.sh index d0a29bce42..c3e78fa813 100755 --- a/enterprise.sh +++ b/enterprise.sh @@ -31,7 +31,7 @@ then python manage.py migrate python manage.py migrate --database "timeseries" timeseries # Start api - ${SUB}$prefix gunicorn codecov.wsgi:application --workers=$GUNICORN_WORKERS --bind ${CODECOV_API_BIND:-0.0.0.0}:${CODECOV_API_PORT:-8000} --access-logfile '-' ${statsd}--timeout "${GUNICORN_TIMEOUT:-600}"${POST} + ${SUB}$prefix gunicorn codecov.wsgi:application --workers=$GUNICORN_WORKERS --threads=${GUNICORN_THREADS:-1} --worker-connections=${GUNICORN_WORKER_CONNECTIONS:-1000} --bind ${CODECOV_API_BIND:-0.0.0.0}:${CODECOV_API_PORT:-8000} --access-logfile '-' ${statsd}--timeout "${GUNICORN_TIMEOUT:-600}"${POST} elif [[ "$1" = "rti" ]]; then # Start api diff --git a/prod.sh b/prod.sh index 575b65f5ae..f87719d145 100755 --- a/prod.sh +++ b/prod.sh @@ -7,8 +7,12 @@ if [ -f "/usr/local/bin/berglas" ]; then prefix="berglas exec --" fi -export PROMETHEUS_MULTIPROC_DIR="${PROMETHEUS_MULTIPROC_DIR:-$HOME/.prometheus}" -rm -r ${PROMETHEUS_MULTIPROC_DIR?}/* 2> /dev/null -mkdir -p "$PROMETHEUS_MULTIPROC_DIR" +GUNICORN_WORKERS=${GUNICORN_WORKERS:-2} +if [ "$GUNICORN_WORKERS" -gt 1 ]; +then + export PROMETHEUS_MULTIPROC_DIR="${PROMETHEUS_MULTIPROC_DIR:-$HOME/.prometheus}" + rm -r ${PROMETHEUS_MULTIPROC_DIR?}/* 2> /dev/null + mkdir -p "$PROMETHEUS_MULTIPROC_DIR" +fi -$prefix gunicorn codecov.wsgi:application --workers=2 --bind 0.0.0.0:8000 --access-logfile '-' --statsd-host ${STATSD_HOST}:${STATSD_PORT} --timeout "${GUNICORN_TIMEOUT:-600}" +$prefix gunicorn codecov.wsgi:application --workers=${GUNICORN_WORKERS} --threads=${GUNICORN_THREADS:-1} --worker-connections=${GUNICORN_WORKER_CONNECTIONS:-1000} --bind 0.0.0.0:8000 --access-logfile '-' --statsd-host ${STATSD_HOST}:${STATSD_PORT} --timeout "${GUNICORN_TIMEOUT:-600}" --disable-redirect-access-to-syslog --max-requests=50000 --max-requests-jitter=300 diff --git a/staging.sh b/staging.sh index 1b68b944a0..cef17032e6 100644 --- a/staging.sh +++ b/staging.sh @@ -8,13 +8,12 @@ prefix="" if [ -f "/usr/local/bin/berglas" ]; then prefix="berglas exec --" fi -suffix="" -if [[ "$STATSD_HOST" ]]; then - suffix="--statsd-host ${STATSD_HOST}:${STATSD_PORT}" -fi -export PROMETHEUS_MULTIPROC_DIR="${PROMETHEUS_MULTIPROC_DIR:-$HOME/.prometheus}" -rm -r ${PROMETHEUS_MULTIPROC_DIR?}/* 2> /dev/null -mkdir -p "$PROMETHEUS_MULTIPROC_DIR" +if [ "$GUNICORN_WORKERS" -gt 1 ]; +then + export PROMETHEUS_MULTIPROC_DIR="${PROMETHEUS_MULTIPROC_DIR:-$HOME/.prometheus}" + rm -r ${PROMETHEUS_MULTIPROC_DIR?}/* 2> /dev/null + mkdir -p "$PROMETHEUS_MULTIPROC_DIR" +fi -$prefix gunicorn codecov.wsgi:application --reload --workers=2 --bind 0.0.0.0:8000 --access-logfile '-' --timeout "${GUNICORN_TIMEOUT:-600}" $suffix +$prefix gunicorn codecov.wsgi:application --reload --workers=${GUNICORN_WORKERS:-2} --threads=${GUNICORN_THREADS:-1} --worker-connections=${GUNICORN_WORKER_CONNECTIONS:-1000} --bind 0.0.0.0:8000 --access-logfile '-' --timeout "${GUNICORN_TIMEOUT:-600}" --disable-redirect-access-to-syslog --config=gunicorn.conf.py