Files
EvoBGP/deploy/compose/docker-compose.yaml
T

324 lines
8.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.
# EvoBGP Compose: профили `reference` (эталон) и `microvps` (одна VPS).
#
# Запуск:
# docker compose --profile reference up -d --build
# docker compose --profile microvps up -d --build
#
# reference: 5× Go (api + scheduler + ingest + render + deploy) + postgres + NATS JetStream + bird2 + agent + web.
# microvps: evobgp-all + postgres + bird2 + agent (без брокера).
#
# Опция microVPS_sqlite из плана (без контейнера Postgres): требует реализации store на SQLite в приложении;
# пока используйте microvps с контейнерным Postgres (единые миграции).
#
# Профиль reference: Web UI на http://localhost:3000 (nginx → /v1 и /metrics на evobgp-api:8080).
#
# Очистка неиспользуемых данных Docker (PowerShell; осторожно с -v):
# docker system prune -f
# docker volume prune -f
#
# Входящий BGP (TCP/179): на Linux для публичного пира часто нужен network_mode: host у bird2
# или macvlan/ipvlan — см. архитектурный план §4.1. Здесь опубликован порт 179 для отладки.
name: evobgp
x-logging: &default-logging
driver: json-file
options:
max-size: "10m"
max-file: "3"
x-env-ref: &env-ref
EVOBGP_DATABASE_URL: postgres://evobgp:evobgp@postgres:5432/evobgp?sslmode=disable
EVOBGP_BROKER_URL: nats://nats:4222
x-env-micro: &env-micro
EVOBGP_DATABASE_URL: postgres://evobgp:evobgp@postgres:5432/evobgp?sslmode=disable
services:
postgres:
profiles: ["reference", "microvps"]
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: evobgp
POSTGRES_PASSWORD: evobgp
POSTGRES_DB: evobgp
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U evobgp -d evobgp"]
interval: 10s
timeout: 5s
retries: 5
logging: *default-logging
deploy:
resources:
limits:
cpus: "1.0"
memory: 384M
nats:
profiles: ["reference"]
image: nats:2.10-alpine
restart: unless-stopped
command: ["-js", "-m", "8222"]
ports:
- "4222:4222"
logging: *default-logging
deploy:
resources:
limits:
memory: 256M
evobgp-api:
profiles: ["reference"]
build:
context: ../..
dockerfile: deploy/docker/gobinary/Dockerfile
args:
BIN: evobgp-api
INSTALL_BIRDC: "1"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
bird2:
condition: service_started
ports:
- "8080:8080"
environment:
<<: *env-ref
EVOBGP_HTTP_ADDR: ":8080"
EVOBGP_SEED_DEMO: "1"
EVOBGP_BIRDC_SOCKET: /run/bird/bird.ctl
EVOBGP_BIRDC_INTERVAL: 30s
EVOBGP_BIRD_ACTIVE_DIR: /etc/bird
EVOBGP_BIRD_STAGING_DIR: /tmp/evobgp-bird-staging
EVOBGP_CORS_ORIGINS: "http://localhost:5173,http://127.0.0.1:5173,http://localhost:3000,http://127.0.0.1:3000"
volumes:
- bird_etc:/etc/bird
- bird_run:/run/bird:ro
logging: *default-logging
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
evobgp-scheduler:
profiles: ["reference"]
build:
context: ../..
dockerfile: deploy/docker/gobinary/Dockerfile
args:
BIN: evobgp-scheduler
INSTALL_BIRDC: "0"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
environment:
<<: *env-ref
logging: *default-logging
deploy:
resources:
limits:
cpus: "0.25"
memory: 128M
evobgp-ingest:
profiles: ["reference"]
build:
context: ../..
dockerfile: deploy/docker/gobinary/Dockerfile
args:
BIN: evobgp-ingest
INSTALL_BIRDC: "0"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
environment:
<<: *env-ref
logging: *default-logging
deploy:
resources:
limits:
cpus: "0.25"
memory: 128M
evobgp-render:
profiles: ["reference"]
build:
context: ../..
dockerfile: deploy/docker/gobinary/Dockerfile
args:
BIN: evobgp-render
INSTALL_BIRDC: "0"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
environment:
<<: *env-ref
logging: *default-logging
deploy:
resources:
limits:
cpus: "0.25"
memory: 128M
evobgp-deploy:
profiles: ["reference"]
build:
context: ../..
dockerfile: deploy/docker/gobinary/Dockerfile
args:
BIN: evobgp-deploy
INSTALL_BIRDC: "0"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
environment:
<<: *env-ref
EVOBGP_BIRD_ACTIVE_DIR: /etc/bird
volumes:
- bird_etc:/etc/bird:ro
logging: *default-logging
deploy:
resources:
limits:
cpus: "0.25"
memory: 128M
evobgp-web:
profiles: ["reference"]
build:
context: ../..
dockerfile: deploy/docker/evobgp-web/Dockerfile
restart: unless-stopped
depends_on:
- evobgp-api
ports:
- "3000:80"
logging: *default-logging
deploy:
resources:
limits:
cpus: "0.5"
memory: 128M
evobgp-all:
profiles: ["microvps"]
build:
context: ../..
dockerfile: deploy/docker/gobinary/Dockerfile
args:
BIN: evobgp-all
INSTALL_BIRDC: "1"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
bird2:
condition: service_started
ports:
- "8080:8080"
environment:
<<: *env-micro
EVOBGP_HTTP_ADDR: ":8080"
EVOBGP_SEED_DEMO: "1"
EVOBGP_BIRDC_SOCKET: /run/bird/bird.ctl
EVOBGP_BIRDC_INTERVAL: 30s
EVOBGP_BIRD_ACTIVE_DIR: /etc/bird
EVOBGP_BIRD_STAGING_DIR: /tmp/evobgp-bird-staging
volumes:
- bird_etc:/etc/bird
- bird_run:/run/bird:ro
logging: *default-logging
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
bird2:
profiles: ["reference", "microvps"]
build:
context: ../..
dockerfile: deploy/docker/bird2/Dockerfile
restart: unless-stopped
cap_add:
- NET_ADMIN
sysctls:
net.ipv4.ip_forward: "1"
net.ipv6.conf.all.forwarding: "1"
volumes:
- bird_etc:/etc/bird
- bird_run:/run/bird
ports:
- "179:179/tcp"
logging: *default-logging
deploy:
resources:
limits:
memory: 256M
evobgp-agent:
profiles: ["reference", "microvps"]
build:
context: ../..
dockerfile: deploy/docker/evobgp-agent/Dockerfile
restart: unless-stopped
depends_on:
- bird2
cap_add:
- NET_ADMIN
volumes:
- bird_etc:/etc/bird
- bird_run:/run/bird
entrypoint: ["/usr/local/bin/evobgp-agent"]
command: ["watch", "-socket=/run/bird/bird.ctl", "-watch-interval=30s"]
logging: *default-logging
deploy:
resources:
limits:
memory: 128M
prometheus:
profiles: ["reference"]
image: prom/prometheus:v2.54.1
restart: unless-stopped
depends_on:
- evobgp-api
ports:
- "9090:9090"
volumes:
- ../prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ../prometheus/alerts.yml:/etc/prometheus/alerts.yml:ro
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=15d
- --web.enable-lifecycle
logging: *default-logging
deploy:
resources:
limits:
memory: 512M
volumes:
pgdata:
bird_etc:
bird_run: