Adds NpTrackingClient (Protocol + real/stub impls) and an ARQ worker that polls Nova Poshta every minute for orders without a receipt, writing status, net COD amount (Контроль оплати), and payment status onto the order. Surfaced in the orders table and detail modal. Marks plan stages 3-4 done in README. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
107 lines
2.8 KiB
YAML
107 lines
2.8 KiB
YAML
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:
|
|
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:
|
|
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:
|
|
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:
|