181 lines
4.0 KiB
YAML
181 lines
4.0 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# NATS message broker
|
|
nats:
|
|
image: nats:2.10-alpine
|
|
ports:
|
|
- "4222:4222"
|
|
- "8222:8222"
|
|
command: >
|
|
nats-server
|
|
--jetstream
|
|
--store_dir=/data
|
|
--http_port=8222
|
|
--port=4222
|
|
volumes:
|
|
- nats_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "nats-server", "--check"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# BACKBEAT pulse service (leader election + beat generation)
|
|
pulse-1:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: pulse
|
|
environment:
|
|
- BACKBEAT_ENV=development
|
|
command: >
|
|
./pulse
|
|
-cluster=chorus-dev
|
|
-node=pulse-1
|
|
-admin-port=8080
|
|
-raft-bind=0.0.0.0:9000
|
|
-data-dir=/data
|
|
-nats=nats://nats:4222
|
|
-log-level=info
|
|
ports:
|
|
- "8080:8080"
|
|
- "9000:9000"
|
|
volumes:
|
|
- pulse1_data:/data
|
|
depends_on:
|
|
nats:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Second pulse node for leader election testing
|
|
pulse-2:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: pulse
|
|
environment:
|
|
- BACKBEAT_ENV=development
|
|
command: >
|
|
./pulse
|
|
-cluster=chorus-dev
|
|
-node=pulse-2
|
|
-admin-port=8080
|
|
-raft-bind=0.0.0.0:9000
|
|
-data-dir=/data
|
|
-nats=nats://nats:4222
|
|
-peers=pulse-1:9000
|
|
-log-level=info
|
|
ports:
|
|
- "8081:8080"
|
|
- "9001:9000"
|
|
volumes:
|
|
- pulse2_data:/data
|
|
depends_on:
|
|
nats:
|
|
condition: service_healthy
|
|
pulse-1:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 15s
|
|
|
|
# BACKBEAT reverb service (status aggregation + bar reports)
|
|
reverb:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: reverb
|
|
environment:
|
|
- BACKBEAT_ENV=development
|
|
command: >
|
|
./reverb
|
|
-cluster=chorus-dev
|
|
-node=reverb-1
|
|
-nats=nats://nats:4222
|
|
-bar-length=120
|
|
-log-level=info
|
|
ports:
|
|
- "8082:8080"
|
|
depends_on:
|
|
nats:
|
|
condition: service_healthy
|
|
pulse-1:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Agent simulator for testing
|
|
agent-sim:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: agent-sim
|
|
environment:
|
|
- BACKBEAT_ENV=development
|
|
command: >
|
|
./agent-sim
|
|
-cluster=chorus-dev
|
|
-nats=nats://nats:4222
|
|
-agents=10
|
|
-rate=2.0
|
|
-log-level=info
|
|
depends_on:
|
|
nats:
|
|
condition: service_healthy
|
|
pulse-1:
|
|
condition: service_healthy
|
|
reverb:
|
|
condition: service_healthy
|
|
scale: 1
|
|
|
|
# Prometheus for metrics collection
|
|
prometheus:
|
|
image: prom/prometheus:latest
|
|
ports:
|
|
- "9090:9090"
|
|
volumes:
|
|
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- prometheus_data:/prometheus
|
|
command:
|
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
- '--storage.tsdb.path=/prometheus'
|
|
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
|
- '--web.console.templates=/etc/prometheus/consoles'
|
|
- '--storage.tsdb.retention.time=200h'
|
|
- '--web.enable-lifecycle'
|
|
depends_on:
|
|
- pulse-1
|
|
- reverb
|
|
|
|
# Grafana for metrics visualization
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
- GF_SECURITY_ADMIN_PASSWORD=admin
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
depends_on:
|
|
- prometheus
|
|
|
|
volumes:
|
|
nats_data:
|
|
pulse1_data:
|
|
pulse2_data:
|
|
prometheus_data:
|
|
grafana_data: |