Files
ZBrain/deploy/docker/docker-compose.yml
T
zuevav f4bca8449e main
2026-05-20 19:33:02 +03:00

79 lines
2.5 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.
# ZBrain Production Docker Compose
#
# Запуск:
# docker compose -f deploy/docker/docker-compose.yml up -d
#
# Postgres работает на хосте (не в контейнере) - так проще делать
# нативный pg_dump, тюнинг и обновления без даунтайма всех брейнов.
# gbrain instances тоже работают через systemd на хосте.
# В контейнерах - только brainhub (api + web) и nginx.
version: "3.9"
services:
# ============================================================
# Brainhub API (Node.js + Express)
# ============================================================
brainhub-api:
build:
context: ../..
dockerfile: deploy/docker/api.Dockerfile
image: zbrain/brainhub-api:latest
container_name: zbrain-api
restart: unless-stopped
# Postgres на хосте, поэтому используем host network для api
# ИЛИ - оставляем bridge и в DATABASE_URL пишем host.docker.internal
network_mode: host
env_file:
- /etc/zbrain/.env
environment:
NODE_ENV: production
LOG_FILE: /var/log/zbrain/brainhub.log
volumes:
- /var/log/zbrain:/var/log/zbrain
- /etc/zbrain:/etc/zbrain:ro
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
# ============================================================
# Brainhub Web (статика через nginx внутри контейнера)
# ============================================================
brainhub-web:
build:
context: ../..
dockerfile: deploy/docker/web.Dockerfile
image: zbrain/brainhub-web:latest
container_name: zbrain-web
restart: unless-stopped
ports:
- "127.0.0.1:8080:80" # только localhost, внешний доступ через системный nginx
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
# ============================================================
# Networks
# ============================================================
# brainhub-api использует host network для прямого доступа к Postgres
# и к gbrain instances (localhost:3001-3099).
# brainhub-web стоит на bridge с port forward на 127.0.0.1:8080.