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