feat-(migrations race in api's replicas stopped)new service migrate created

This commit is contained in:
2026-11-16 14:19:50 +03:00
parent 5d539cd6a4
commit 5d958f22b1
4 changed files with 46 additions and 15 deletions
+14
View File
@@ -1,4 +1,12 @@
services:
migrate:
build: .
command: python -m scripts.run_migrations
environment:
- DATABASE_URL=postgresql+asyncpg://mtusi:1878@postgres:5432/mtusi-messenger
depends_on:
postgres:
condition: service_healthy
nginx:
image: nginx:1.25-alpine
ports:
@@ -24,6 +32,8 @@ services:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"] #засекретить?
@@ -33,6 +43,10 @@ services:
retries: 3
deploy:
replicas: 2
resources:
limits:
cpus: '0.5'
memory: 512M
postgres:
image: postgres:16.3-alpine