Skip to content

Commit

Permalink
Put gunicorn config in a file
Browse files Browse the repository at this point in the history
  • Loading branch information
lampham789 committed Aug 22, 2024
1 parent 7c7d1f0 commit 60a1379
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ services:
build:
context: .
target: production
command: ["python", "-m", "gunicorn", "--log-level", "${LOG_LEVEL:-INFO}", "-b", "0.0.0.0:${APP_PORT:-8000}", "app:create_app()"]
command: ["python", "-m", "gunicorn", "-c", "gunicorn_config.py"]
ports:
- "${APP_PORT:-8000}:${APP_PORT:-8000}"
- "${APP_PORT}:${APP_PORT}"
environment:
# Required
- FLASK_ENV
Expand Down
13 changes: 13 additions & 0 deletions gunicorn_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os
import multiprocessing

APP_PORT = os.getenv("APP_PORT")
LOG_LEVEL = os.getenv("LOG_LEVEL")

worker_connections = 1000 # max number of simultaneous clients
worker_class = "gthread"
workers = 2 * multiprocessing.cpu_count() + 1
threads = 2
bind = f"0.0.0.0:{APP_PORT}"
wsgi_app = "app:create_app()"
loglevel = LOG_LEVEL

0 comments on commit 60a1379

Please sign in to comment.