Skip to content

Commit

Permalink
Update gunicorn setup for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchrisadams committed May 9, 2024
1 parent a888b9a commit 2a4734c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion ansible/templates/run_gunicorn.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
# allowing for a graceful shutdown or reboot
exec {{ project_root }}/current/.venv/bin/gunicorn greenweb.wsgi \
--bind {{ internal_ip }}:{{ gunicorn_port }} \
--timeout 300 \
--config gunicorn.conf.py \
--statsd-host=10.0.0.2:9125 --statsd-prefix=member.{{ app_name }}
13 changes: 13 additions & 0 deletions gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import os

# Refer to gunicorn settings below for more info on each one
# https://docs.gunicorn.org/en/stable/settings.html
timeout = 300
# increasing workers uses more RAM, but provides a simple model for scaling up resources
workers = os.getenv("GUNICORN_WORKERS", default=8)
# increasing threads saves RAM at the cost of using more CPU
threads = os.getenv("GUNICORN_THREADS", default=1)

# Log HTTP requests, so we can compare them with our reverse proxy
accesslog = "-"
# use the default log format, but add the time taken by each request in milliseconds as well %(M)s
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s %(M)s "%(f)s" "%(a)s"'

# set gunicorn log level to info, not warning.
loglevel = "info"
# capture the output from django, to pipe to the gunicorn errlog
capture_output = True
1 change: 0 additions & 1 deletion gunicorn_config.ini

This file was deleted.

0 comments on commit 2a4734c

Please sign in to comment.