Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ansible/roles/backend/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ backend_docker_tag: "{{ lookup('env', 'VERSION') | default('latest', true) }}"
backend_app_name: "guitar0-backend-{{ app_env }}"
backend_app_port: 8000

# Gunicorn defaults to `2 * host CPU cores + 1`, which ignores the
# container's cgroup CPU/memory limits and over-provisions workers.
# Set explicitly to fit the memory limit below.
backend_gunicorn_workers: 3

# Directories
backend_app_dir: "/opt/{{ backend_app_name }}"
backend_shared_dir: "{{ backend_app_dir }}/shared"
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/backend/templates/docker-compose.prod.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ services:
resources:
limits:
cpus: "1.0"
memory: 512M
memory: 1024M
reservations:
cpus: "0.25"
memory: 256M
memory: 512M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/metrics/"]
interval: 30s
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/backend/templates/env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ DATABASE_URL=postgres://{{ backend_db_user }}:{{ backend_db_password }}@db:5432/
ALLOWED_HOSTS={{ (app_hosts + ['127.0.0.1', 'localhost', backend_app_name ~ '-app-1']) | to_json }}
CSRF_TRUSTED_ORIGINS={{ app_hosts | map('regex_replace', '^', 'https://') | list | to_json }}
GIT_SHA={{ lookup('env', 'GIT_SHA') | default('unknown', true) }}
GUNICORN_WORKERS={{ backend_gunicorn_workers }}
Loading