forked from mtusi2026/mtusi2026lab3
feat: implement estim 4
This commit is contained in:
+47
-4
@@ -11,6 +11,8 @@ services:
|
||||
- postgres_password
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql
|
||||
networks:
|
||||
- backend
|
||||
ports:
|
||||
- "127.0.0.1:55432:5432"
|
||||
healthcheck:
|
||||
@@ -18,6 +20,11 @@ services:
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "1.0"
|
||||
memory: 512M
|
||||
restart: unless-stopped
|
||||
|
||||
redis:
|
||||
@@ -25,6 +32,8 @@ services:
|
||||
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"]
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
networks:
|
||||
- backend
|
||||
ports:
|
||||
- "127.0.0.1:56379:6379"
|
||||
healthcheck:
|
||||
@@ -32,6 +41,11 @@ services:
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: 128M
|
||||
restart: unless-stopped
|
||||
|
||||
migrate:
|
||||
@@ -42,9 +56,16 @@ services:
|
||||
- database_url
|
||||
volumes:
|
||||
- ./internal/repository/postgres/migrations:/migrations:ro
|
||||
networks:
|
||||
- backend
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: 64M
|
||||
restart: "no"
|
||||
|
||||
api:
|
||||
@@ -60,9 +81,22 @@ services:
|
||||
secrets:
|
||||
- database_url
|
||||
- cache_url
|
||||
networks:
|
||||
- edge
|
||||
- backend
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/health/ready"]
|
||||
interval: 5s
|
||||
timeout: 2s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
stop_grace_period: 10s
|
||||
scale: ${API_REPLICAS:-2}
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: ${API_REPLICAS:-2}
|
||||
resources:
|
||||
limits:
|
||||
cpus: "1.0"
|
||||
memory: 256M
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
@@ -74,12 +108,21 @@ services:
|
||||
image: docker.io/library/haproxy:3.4.7-alpine
|
||||
volumes:
|
||||
- ./infra/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
networks:
|
||||
- edge
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
- api
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: 64M
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
edge:
|
||||
backend:
|
||||
|
||||
secrets:
|
||||
postgres_password:
|
||||
file: ./secrets/postgres_password
|
||||
|
||||
Reference in New Issue
Block a user