Add api3 service and update resource limits and restarts

This commit is contained in:
Jose Eduardo 2025-08-17 04:30:20 -04:00
parent 4ee047fb9b
commit ac1dcc2a6b

View File

@ -1,6 +1,7 @@
services:
api1:
image: payment2:latest
restart: always
networks:
- backend
- payment-processor
@ -10,12 +11,12 @@ services:
deploy:
resources:
limits:
cpus: "0.40"
memory: "85MB"
cpus: '0.3'
memory: '65MB'
api2:
image: payment2:latest
restart: always
depends_on:
- redis
- database
@ -25,14 +26,28 @@ services:
deploy:
resources:
limits:
cpus: "0.40"
memory: "85MB"
cpus: '0.3'
memory: '65MB'
api3:
image: payment2:latest
restart: always
depends_on:
- redis
- database
networks:
- backend
- payment-processor
deploy:
resources:
limits:
cpus: '0.3'
memory: '65MB'
nginx:
image: nginx:latest
ports:
- "9999:9999"
- '9999:9999'
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
@ -40,31 +55,34 @@ services:
depends_on:
- api1
- api2
- api3
deploy:
resources:
limits:
cpus: "0.1"
memory: "10MB"
cpus: '0.15'
memory: '10MB'
redis:
image: redis:7.2-alpine
restart: always
platform: linux/amd64
ports:
- "6379:6379"
- '6379:6379'
networks:
- backend
deploy:
resources:
limits:
cpus: "0.20"
memory: "70MB"
cpus: '0.40'
memory: '22MB'
database:
image: postgres:17-alpine
restart: always
command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c fsync=0 -c full_page_writes=0
platform: linux/amd64
ports:
- "5432:5432"
- '5432:5432'
environment:
- POSTGRES_DB=payment
- POSTGRES_USER=postgres
@ -72,7 +90,7 @@ services:
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 3s
timeout: 3s
retries: 5
@ -81,8 +99,8 @@ services:
deploy:
resources:
limits:
cpus: "0.30"
memory: "100MB"
cpus: '0.25'
memory: '125MB'
networks:
backend: