From 74e3a213749e4619285de75906f5948fffdbbb87 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Mon, 6 May 2024 21:04:31 +0200 Subject: [PATCH] Add explicit control over gunicorn concurrency in deploys Also remove Redis - we are not using it any more --- ansible/inventories/prod.yml | 13 +++++++++++++ ansible/inventories/staging.yml | 3 +++ ansible/templates/dotenv.j2 | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ansible/inventories/prod.yml b/ansible/inventories/prod.yml index 2fe3cba0..d14ac6fd 100644 --- a/ansible/inventories/prod.yml +++ b/ansible/inventories/prod.yml @@ -6,11 +6,18 @@ all: dramatiq_threads: 2 dramatiq_processes: 3 sentry_sample_rate: 0 + app_name: app1 + gunicorn_workers: 4 + gunicorn_threads: 1 + app2.thegreenwebfoundation.org: internal_ip: "10.0.0.4" dramatiq_threads: 2 dramatiq_processes: 3 sentry_sample_rate: 0 + app_name: app2 + gunicorn_workers: 4 + gunicorn_threads: 1 # TODO: once we have update the worker process names we can use app3 for serving production traffic # letting us decommission some of the older app servers app3.thegreenwebfoundation.org: @@ -18,11 +25,17 @@ all: dramatiq_threads: 1 dramatiq_processes: 1 sentry_sample_rate: 1 + app_name: app3 + gunicorn_workers: 4 + gunicorn_threads: 1 app4.thegreenwebfoundation.org: internal_ip: "10.0.0.7" dramatiq_threads: 2 dramatiq_processes: 3 sentry_sample_rate: 0 + app_name: app4 + gunicorn_workers: 4 + gunicorn_threads: 1 vars: tgwf_stage: "prod" diff --git a/ansible/inventories/staging.yml b/ansible/inventories/staging.yml index b9f390e2..47a930c9 100644 --- a/ansible/inventories/staging.yml +++ b/ansible/inventories/staging.yml @@ -7,6 +7,9 @@ all: dramatiq_threads: 1 dramatiq_processes: 1 sentry_trace_rate: 1 + app_name: "app-staging" + gunicorn_workers: 4 + gunicorn_threads: 1 vars: tgwf_stage: "staging" tgwf_domain_name: "admin-staging" diff --git a/ansible/templates/dotenv.j2 b/ansible/templates/dotenv.j2 index 68aaf4e5..fc970192 100644 --- a/ansible/templates/dotenv.j2 +++ b/ansible/templates/dotenv.j2 @@ -26,7 +26,6 @@ OBJECT_STORAGE_ACCESS_KEY_ID = "{{ lookup('env', 'OBJECT_STORAGE_ACCESS_KEY_ID') OBJECT_STORAGE_SECRET_ACCESS_KEY = "{{ lookup('env', 'OBJECT_STORAGE_SECRET_ACCESS_KEY') }}" OBJECT_STORAGE_BUCKET_NAME = "{{ lookup('env', 'OBJECT_STORAGE_BUCKET_NAME') }}" -REDIS_HOST = "{{ lookup('env', 'REDIS_HOST') }}" AMAZON_PROVIDER_ID = "{{ lookup('env', 'AMAZON_PROVIDER_ID') }}" AMAZON_REMOTE_API_ENDPOINT = "{{ lookup('env', 'AMAZON_REMOTE_API_ENDPOINT') }}" @@ -44,3 +43,5 @@ API_URL = "{{ lookup('env', 'API_URL') }}" TRELLO_REGISTRATION_EMAIL_TO_BOARD_ADDRESS = "{{ lookup('env', 'TRELLO_REGISTRATION_EMAIL_TO_BOARD_ADDRESS') }}" +GUNICORN_WORKERS={{ gunicorn_workers }} +GUNICORN_THREADS={{ gunicorn_threads }}