ЛР 2: Сохранение сессий PostgreSQL
Skeleton contracts / contracts (pull_request) Blocked by required conditions
Skeleton contracts / contracts (pull_request) Blocked by required conditions
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16.6-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${PGDATABASE:?Set PGDATABASE in .env}
|
||||
POSTGRES_USER: ${PGUSER:?Set PGUSER in .env}
|
||||
POSTGRES_PASSWORD: ${PGPASSWORD:?Set a local PGPASSWORD in .env}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
|
||||
interval: 3s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 5s
|
||||
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
APP_HOST: 0.0.0.0
|
||||
APP_PORT: 8080
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
DB_POOL_MAX_SIZE: ${DB_POOL_MAX_SIZE:-10}
|
||||
PGHOST: db
|
||||
PGPORT: 5432
|
||||
PGDATABASE: ${PGDATABASE:?Set PGDATABASE in .env}
|
||||
PGUSER: ${PGUSER:?Set PGUSER in .env}
|
||||
PGPASSWORD: ${PGPASSWORD:?Set a local PGPASSWORD in .env}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "127.0.0.1:${APP_PORT:-8080}:8080"
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- python
|
||||
- -c
|
||||
- "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 12
|
||||
start_period: 10s
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
Reference in New Issue
Block a user