Skip to content

Commit

Permalink
update web script
Browse files Browse the repository at this point in the history
  • Loading branch information
jefer94 committed Jan 25, 2024
1 parent c5a7916 commit b2acb02
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/infrastructure/journal.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ Side effects:
- `[prod]` preboot was enabled.
- `[prod]` switch `WEB_WORKER_CLASS` from `gevent` to `uvicorn.workers.UvicornWorker`.
- `[prod]` switch `LOG_LEVEL` from `DEBUG` to `WARNING`.
- `[dev]` set `WEB_MAX_REQUESTS` to `6000`
- `[dev]` set `WEB_MAX_REQUESTS_JITTER` to `3000`
12 changes: 11 additions & 1 deletion scripts/dyno/web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ WEB_WORKER_CONNECTION=${WEB_WORKER_CONNECTION:-200}
WEB_WORKER_CLASS=${WEB_WORKER_CLASS:-gevent}
WEB_WORKERS=${WEB_WORKERS:-2}
WEB_TIMEOUT=${WEB_TIMEOUT:-29}
WEB_MAX_REQUESTS=${WEB_MAX_REQUESTS:-6000}
WEB_MAX_REQUESTS_JITTER=${WEB_MAX_REQUESTS_JITTER:-3000}
WEB_PRELOAD=${WEB_PRELOAD:-0}

export NEW_RELIC_METADATA_COMMIT=$HEROKU_SLUG_COMMIT;
export CORALOGIX_SUBSYSTEM=web;

if [ "$WEB_PRELOAD" = "1" ]; then
EXTRA="--preload"
else
EXTRA=""
fi

if [ "$WEB_WORKER_CLASS" = "uvicorn.workers.UvicornWorker" ]; then
export SERVER_TYPE=asgi;
Expand All @@ -17,4 +25,6 @@ fi

newrelic-admin run-program bin/start-pgbouncer-stunnel \
gunicorn breathecode.$SERVER_TYPE --timeout $WEB_TIMEOUT --workers $WEB_WORKERS \
--worker-connections $WEB_WORKER_CONNECTION --worker-class $WEB_WORKER_CLASS
--worker-connections $WEB_WORKER_CONNECTION --worker-class $WEB_WORKER_CLASS \
--max-requests $WEB_MAX_REQUESTS --max-requests-jitter $WEB_MAX_REQUESTS_JITTER \
$EXTRA

0 comments on commit b2acb02

Please sign in to comment.