2 lab
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
name: mtusilab2
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16.10-alpine
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
command: ["postgres", "-c", "synchronous_commit=on", "-c", "fsync=on", "-c", "max_connections=50"]
|
||||
volumes:
|
||||
- pg-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
start_period: 5s
|
||||
networks: [lab]
|
||||
restart: unless-stopped
|
||||
|
||||
redis:
|
||||
image: redis:7.4.6-alpine
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
command:
|
||||
[
|
||||
"redis-server",
|
||||
"--appendonly",
|
||||
"yes",
|
||||
"--appendfsync",
|
||||
"everysec",
|
||||
"--requirepass",
|
||||
"${REDIS_PASSWORD}",
|
||||
]
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "redis-cli --no-auth-warning -a \"$$REDIS_PASSWORD\" ping | grep -q PONG"]
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
start_period: 3s
|
||||
networks: [lab]
|
||||
restart: unless-stopped
|
||||
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
image: mtusi-messenger:lab2
|
||||
environment:
|
||||
APP_HOST: 0.0.0.0
|
||||
APP_PORT: "8080"
|
||||
APP_ENV: ${APP_ENV:-lab}
|
||||
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable
|
||||
CACHE_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
MIGRATIONS_DIR: /migrations
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
mem_limit: 768m
|
||||
cpus: 2
|
||||
networks: [lab]
|
||||
restart: unless-stopped
|
||||
|
||||
postgres-restore:
|
||||
profiles: ["restore"]
|
||||
image: postgres:16.10-alpine
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
command: ["postgres", "-c", "synchronous_commit=on", "-c", "fsync=on"]
|
||||
volumes:
|
||||
- pg-restore-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
start_period: 5s
|
||||
networks: [lab]
|
||||
|
||||
volumes:
|
||||
pg-data:
|
||||
redis-data:
|
||||
pg-restore-data:
|
||||
|
||||
networks:
|
||||
lab:
|
||||
Reference in New Issue
Block a user