Files
chatballs/compose.dev.yaml
T

158 lines
5.1 KiB
YAML
Raw 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.
# Override для локальной разработки (ADR-HUB-0028 §compose.dev).
# Применяется поверх canonical compose.yaml:
# docker compose -f compose.yaml -f compose.dev.yaml --env-file .env.example --env-file .env up
# Переопределяет image на build, dev-команды, bind mounts и host-порты.
# Не определяет отдельную production-топологию.
services:
postgres:
ports:
- "${POSTGRES_HOST_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
ports:
- "${REDIS_HOST_PORT:-6379}:6379"
# Dev: migrate через init, без collectstatic (испечён только в prod-образе).
init:
build:
context: .
dockerfile: apps/backend/Dockerfile
environment:
CUS_HELP_BASE_DOMAIN: localhost
CUS_HELP_PUBLIC_SCHEME: http
CUS_HELP_PUBLIC_PORT: ""
backend-app:
build:
context: .
dockerfile: apps/backend/Dockerfile
# Миграции выполняет one-shot init (CUS_DB_ROLE=migration); runtime-роль app
# не имеет прав на django_migrations, поэтому migrate здесь запускать нельзя.
command: uvicorn hub_backend.asgi_app:application --host 0.0.0.0 --port 8000 --reload
ports:
- "${BACKEND_APP_PORT:-8010}:8000"
environment:
CUS_ALLOWED_HOSTS: "localhost,127.0.0.1,.localhost"
CUS_HELP_BASE_DOMAIN: localhost
CUS_HELP_PUBLIC_SCHEME: http
CUS_HELP_PUBLIC_PORT: ""
volumes:
- ./apps/backend:/app/apps/backend
depends_on:
init:
condition: service_completed_successfully
postgres:
condition: service_healthy
redis:
condition: service_healthy
backend-platform:
build:
context: .
dockerfile: apps/backend/Dockerfile
command: uvicorn hub_backend.asgi_platform:application --host 0.0.0.0 --port 8000 --reload
ports:
- "${BACKEND_PLATFORM_PORT:-8011}:8000"
environment:
CUS_ALLOWED_HOSTS: "localhost,127.0.0.1,.localhost"
CUS_HELP_BASE_DOMAIN: localhost
CUS_HELP_PUBLIC_SCHEME: http
CUS_HELP_PUBLIC_PORT: ""
volumes:
- ./apps/backend:/app/apps/backend
backend-admin:
build:
context: .
dockerfile: apps/backend/Dockerfile
command: uvicorn hub_backend.asgi_admin:application --host 0.0.0.0 --port 8000 --reload
volumes:
- ./apps/backend:/app/apps/backend
worker:
build:
context: .
dockerfile: apps/backend/Dockerfile
volumes:
- ./apps/backend:/app/apps/backend
# Dev: frontend-сервис превращается в Vite dev-сервер internal-ui (HMR).
frontend:
build:
context: .
dockerfile: apps/internal-ui/Dockerfile
command: npm run dev -- --host 0.0.0.0 --port 5173
environment:
# Direct Vite remains same-origin for cookies/CSRF and proxies only to the
# real local Django service. This variable exists only in dev compose.
VITE_DEV_API_TARGET: http://backend-app:8000
ports:
- "${INTERNAL_UI_PORT:-5173}:5173"
volumes:
- ./apps/internal-ui:/app/apps/internal-ui
- ./packages:/app/packages
- /app/node_modules
- /app/apps/internal-ui/node_modules
# Dev-only: web-chat как отдельный Vite-сервер (в prod встроен в frontend-образ).
web-chat:
build:
context: .
dockerfile: apps/web-chat/Dockerfile
command: npm run dev -- --host 0.0.0.0 --port 5175
ports:
- "${WEB_CHAT_PORT:-5175}:5175"
volumes:
- ./apps/web-chat:/app/apps/web-chat
- ./packages:/app/packages
- /app/node_modules
- /app/apps/web-chat/node_modules
# Явный одноразовый импорт демонстрационных данных. Сервис существует только
# в compose.dev.yaml, профилем не включается в обычный `up` и не попадает в
# canonical production compose или backend image.
local-seed:
profiles: ["local-seed"]
build:
context: .
dockerfile: apps/backend/Dockerfile
env_file:
- .env
command: ["python", "/opt/custocrm-local-seed/seed.py"]
working_dir: /app/apps/backend
environment:
CUS_DB_ROLE: migration
CUSTOCRM_LOCAL_SEED: "1"
volumes:
- ./apps/backend:/app/apps/backend
- ./dev/local-seed:/opt/custocrm-local-seed:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# Dev: gateway — nginx с local.conf вместо Caddy (та же маршрутизация, HMR-friendly).
gateway:
image: nginx:1.27-alpine
command: ["nginx", "-g", "daemon off;"]
ports:
- "80:80"
volumes:
- ./deploy/nginx/local.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
backend-app:
condition: service_healthy
backend-platform:
condition: service_healthy
frontend:
condition: service_started
web-chat:
condition: service_started
volumes:
postgres_data: