Files
agents/venue/docker-compose.yml
2026-10-13 13:51:01 +07:00

179 lines
5.0 KiB
YAML

name: evening-detective-venue
x-app: &app
image: evening-detective-venue-app:1
build:
context: .
dockerfile: Dockerfile.backend
environment: &app-environment
APP_MODE: venue
DATABASE_URL: postgresql://${POSTGRES_USER:?}:${POSTGRES_PASSWORD:?}@postgres_evening_detective_server:5432/${POSTGRES_DB:?}?sslmode=disable
APP_BASE_URL: ${APP_BASE_URL:?}
FILE_PREFIX_DOMAIN: ${APP_BASE_URL:?}/api/files/
GAME_TIMEZONE: ${GAME_TIMEZONE:-Asia/Barnaul}
JWT_SECRET: ${JWT_SECRET:?}
PARTICIPATION_SECRET: ${PARTICIPATION_SECRET:?}
S3_HOST: http://rustfs_evening_detective_server:9000
S3_USER: ${S3_USER:?}
S3_PASSWORD: ${S3_PASSWORD:?}
S3_BUCKET: ${S3_BUCKET:-evening-detective}
services:
postgres_evening_detective_server:
image: postgres:15
environment:
POSTGRES_DB: ${POSTGRES_DB:?}
POSTGRES_USER: ${POSTGRES_USER:?}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?}
TZ: ${GAME_TIMEZONE:-Asia/Barnaul}
PGTZ: ${GAME_TIMEZONE:-Asia/Barnaul}
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: [CMD-SHELL, 'pg_isready -U "$${POSTGRES_USER}" -d "$${POSTGRES_DB}" -h localhost']
interval: 5s
timeout: 3s
retries: 12
rustfs_evening_detective_server:
image: rustfs/rustfs:latest
environment:
RUSTFS_ACCESS_KEY: ${S3_USER:?}
RUSTFS_SECRET_KEY: ${S3_PASSWORD:?}
RUSTFS_CONSOLE_ENABLE: "false"
RUSTFS_ADDRESS: 0.0.0.0:9000
volumes:
- rustfs_data:/data
restart: unless-stopped
healthcheck:
test: [CMD-SHELL, 'curl -f http://localhost:9000/health']
interval: 5s
timeout: 3s
retries: 12
start_period: 30s
migrate:
<<: *app
entrypoint: [/bin/sh, -ec]
command: ['exec goose -dir /migrations postgres "$$DATABASE_URL" up']
depends_on:
postgres_evening_detective_server:
condition: service_healthy
restart: "no"
evening_detective_server:
<<: *app
environment:
<<: *app-environment
CUDY_SNAPSHOT_FILE: /run/cudy/state.json
volumes:
- cudy_state:/run/cudy:ro
- receipt_printer_socket:/run/receipt-printer:ro
depends_on:
migrate:
condition: service_completed_successfully
rustfs_evening_detective_server:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: [CMD, wget, -q, -T, '2', -O, /dev/null, 'http://127.0.0.1:8090/api/test/ping']
interval: 5s
timeout: 3s
retries: 12
receipt_printer:
image: evening-detective-venue-app:1
command: [/usr/local/bin/evening_detective_server, --receipt-printer]
environment:
APP_MODE: venue
MXW01_ADDRESS: ${MXW01_ADDRESS:-}
network_mode: host
cap_drop: [ALL]
cap_add: [NET_RAW]
volumes:
- receipt_printer_socket:/run/receipt-printer
restart: unless-stopped
bootstrap:
image: postgres:15
profiles: [setup]
environment:
PGHOST: postgres_evening_detective_server
PGUSER: ${POSTGRES_USER:?}
PGPASSWORD: ${POSTGRES_PASSWORD:?}
PGDATABASE: ${POSTGRES_DB:?}
VENUE_USER_USERNAME: ${VENUE_USER_USERNAME:-Организатор}
VENUE_USER_EMAIL: ${VENUE_USER_EMAIL:-organizer@venue.invalid}
VENUE_USER_PASSWORD: ${VENUE_USER_PASSWORD:?}
volumes:
- ./backend/dev-user.sql:/bootstrap.sql:ro
entrypoint: [/bin/sh, -ec]
command:
- >-
exec psql -v ON_ERROR_STOP=1
-v dev_username="$$VENUE_USER_USERNAME"
-v dev_email="$$VENUE_USER_EMAIL"
-v dev_password="$$VENUE_USER_PASSWORD"
-f /bootstrap.sql
depends_on:
migrate:
condition: service_completed_successfully
restart: "no"
cudy_collector:
image: evening-detective-venue-app:1
command: [/usr/local/bin/evening_detective_server, --collect-cudy]
environment:
CUDY_URL: ${CUDY_URL:-http://192.168.10.1}
CUDY_PASSWORD_FILE: ${CUDY_PASSWORD_FILE:-}
CUDY_SNAPSHOT_FILE: /run/cudy/state.json
volumes:
- ./cudy:/run/secrets/cudy:ro
- cudy_state:/run/cudy
networks:
- entrance
restart: unless-stopped
evening_detective_frontend:
image: byjg/static-httpserver:latest
environment:
SPA_MODE: "true"
volumes:
- ./frontend/dist:/static:ro
expose:
- "8080"
restart: unless-stopped
proxy:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- '${VENUE_BIND_IP:-0.0.0.0}:${VENUE_PORT:-8088}:80'
depends_on:
evening_detective_server:
condition: service_healthy
evening_detective_frontend:
condition: service_started
networks:
- default
- entrance
restart: unless-stopped
volumes:
receipt_printer_socket:
cudy_state:
# Preserve existing data from the former Compose project.
postgres_data:
name: evening-detective-local_postgres_data
external: true
rustfs_data:
name: evening-detective-local_rustfs_data
external: true
networks:
default:
internal: true
entrance: