Files
lux_fiscal/docker-compose.yml
lauadminandClaude Opus 5.5 44fe648ebc Add production compose overlay for deploy behind Nginx Proxy Manager
The prod overlay drops host ports for api/frontend and attaches frontend
to the server's external `web` network (alias lux-fiscal-frontend), where
NPM terminates TLS for asist.ystyle.com.ua. migrate/api/worker now share
a single lux-fiscal-backend image instead of three identical copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 20:23:12 +03:00

111 lines
3.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: lux-fiscal
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
# Порт наружу не публикуется: доступ только из сети compose.
# Для локальной отладки раскомментируйте, привязав к loopback.
# ports:
# - "127.0.0.1:5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# Миграции выполняются отдельным одноразовым контейнером, а не при старте api.
# Иначе при нескольких репликах api они пошли бы параллельно.
migrate:
# Один образ на migrate/api/worker, а не три одинаковых копии на диске.
image: lux-fiscal-backend:latest
build:
context: ./backend
env_file: .env
environment:
POSTGRES_HOST: postgres
REDIS_HOST: redis
command: ["alembic", "upgrade", "head"]
depends_on:
postgres:
condition: service_healthy
restart: "no"
api:
image: lux-fiscal-backend:latest
build:
context: ./backend
restart: unless-stopped
env_file: .env
environment:
POSTGRES_HOST: postgres
REDIS_HOST: redis
ports:
- "127.0.0.1:8000:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
volumes:
- receipt_storage:/app/storage
worker:
image: lux-fiscal-backend:latest
build:
context: ./backend
restart: unless-stopped
env_file: .env
environment:
POSTGRES_HOST: postgres
REDIS_HOST: redis
command: ["arq", "app.worker.WorkerSettings"]
# ARQ ничего не слушает на 8000, а HEALTHCHECK бэкенда унаследован из
# общего образа — без отключения контейнер вечно висел бы "unhealthy".
healthcheck:
disable: true
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
volumes:
- receipt_storage:/app/storage
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
restart: unless-stopped
ports:
- "127.0.0.1:5173:80"
depends_on:
- api
volumes:
postgres_data:
redis_data:
receipt_storage: