Add CPU and memory limits to all production containers
Resource allocation (limits / reservations): - php x2: 1.0 CPU / 512M | 0.25 CPU / 128M - db-master: 1.5 CPU / 2G | 0.5 CPU / 512M - db-slave: 1.0 CPU / 1G | 0.25 CPU / 256M - pgbouncer: 0.25 CPU / 64M | 0.05 CPU / 16M - messenger x2: 0.5 CPU / 384M | 0.1 CPU / 64M - redis: 0.5 CPU / 256M | 0.1 CPU / 64M (maxmemory 200mb) - meilisearch: 0.5 CPU / 512M | 0.1 CPU / 128M Total max: ~8.5 CPU / ~6.5G RAM (with 2 php + 2 messenger replicas) Redis maxmemory with allkeys-lru eviction policy added. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,13 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
deploy:
|
||||
replicas: 2
|
||||
resources:
|
||||
limits:
|
||||
cpus: "1.0"
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: "0.25"
|
||||
memory: 128M
|
||||
restart: unless-stopped
|
||||
group_add:
|
||||
- "{{ docker_gid }}"
|
||||
@@ -26,6 +33,14 @@ services:
|
||||
db-master:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "1.5"
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: "0.5"
|
||||
memory: 512M
|
||||
environment:
|
||||
POSTGRES_USER: e-ticket
|
||||
POSTGRES_PASSWORD: {{ db_password }}
|
||||
@@ -54,6 +69,14 @@ services:
|
||||
db-slave:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "1.0"
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: "0.25"
|
||||
memory: 256M
|
||||
environment:
|
||||
POSTGRES_USER: e-ticket
|
||||
POSTGRES_PASSWORD: {{ db_password }}
|
||||
@@ -78,6 +101,14 @@ services:
|
||||
pgbouncer:
|
||||
image: edoburu/pgbouncer
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.25"
|
||||
memory: 64M
|
||||
reservations:
|
||||
cpus: "0.05"
|
||||
memory: 16M
|
||||
volumes:
|
||||
- ./docker/pgsql/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
|
||||
- ./docker/pgsql/userlist.txt:/etc/pgbouncer/userlist.txt:ro
|
||||
@@ -101,6 +132,13 @@ services:
|
||||
command: php bin/console messenger:consume async --time-limit=3600 --memory-limit=256M --limit=500 -vv
|
||||
deploy:
|
||||
replicas: 2
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: 384M
|
||||
reservations:
|
||||
cpus: "0.1"
|
||||
memory: 64M
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- .:/app
|
||||
@@ -117,7 +155,15 @@ services:
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
command: redis-server --requirepass {{ redis_password }}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: 256M
|
||||
reservations:
|
||||
cpus: "0.1"
|
||||
memory: 64M
|
||||
command: redis-server --requirepass {{ redis_password }} --maxmemory 200mb --maxmemory-policy allkeys-lru
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
networks:
|
||||
@@ -131,6 +177,14 @@ services:
|
||||
meilisearch:
|
||||
image: getmeili/meilisearch:latest
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: "0.1"
|
||||
memory: 128M
|
||||
environment:
|
||||
MEILI_MASTER_KEY: {{ meilisearch_master_key }}
|
||||
MEILI_ENV: production
|
||||
@@ -139,6 +193,7 @@ services:
|
||||
- meilisearch-data:/meili_data
|
||||
networks:
|
||||
- e-ticket
|
||||
|
||||
networks:
|
||||
e-ticket:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user