-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
188 lines (167 loc) · 5.88 KB
/
Copy pathdocker-compose.yml
File metadata and controls
188 lines (167 loc) · 5.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# ─────────────────────────────────────────────
# CNF — local development stack
# Simulates two OpenStack clusters + shared infrastructure
# ─────────────────────────────────────────────
x-cnf-base: &cnf-base
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
etcd:
condition: service_healthy
environment: &cnf-env
CNF_DB_URL: "postgresql+asyncpg://cnf:cnf@postgres:5432/cnf"
CNF_CELERY_BROKER_URL: "redis://redis:6379/0"
CNF_CELERY_RESULT_BACKEND: "redis://redis:6379/1"
CNF_RAFT_ETCD_ENDPOINTS: '["etcd:2379"]'
CNF_GRPC_TLS_ENABLED: "false"
CNF_BGP_ENABLED: "false"
CNF_METRICS_ENABLED: "true"
CNF_LOG_FORMAT: "console"
CNF_LOG_LEVEL: "DEBUG"
# OpenStack (DevStack or MicroStack)
OS_AUTH_URL: "${OS_AUTH_URL:-http://devstack:5000/v3}"
OS_USERNAME: "${OS_USERNAME:-admin}"
OS_PASSWORD: "${OS_PASSWORD:-secret}"
OS_PROJECT_NAME: "admin"
OS_USER_DOMAIN_NAME: "Default"
OS_PROJECT_DOMAIN_NAME: "Default"
OS_REGION_NAME: "RegionOne"
services:
# ── Shared infrastructure ──────────────────────────────────────────
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: cnf
POSTGRES_PASSWORD: cnf
POSTGRES_DB: cnf
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cnf"]
interval: 5s
timeout: 3s
retries: 10
ports:
- "5432:5432"
redis:
image: redis:7-alpine
command: redis-server --save "" --appendonly no
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
ports:
- "6379:6379"
etcd:
image: quay.io/coreos/etcd:v3.5.12
command:
- etcd
- --name=etcd0
- --data-dir=/etcd-data
- --listen-client-urls=http://0.0.0.0:2379
- --advertise-client-urls=http://etcd:2379
- --listen-peer-urls=http://0.0.0.0:2380
- --initial-advertise-peer-urls=http://etcd:2380
- --initial-cluster=etcd0=http://etcd:2380
- --initial-cluster-state=new
volumes:
- etcd_data:/etcd-data
healthcheck:
test: ["CMD", "etcdctl", "--endpoints=http://localhost:2379", "endpoint", "health"]
interval: 5s
timeout: 3s
retries: 10
ports:
- "2379:2379"
# ── CNF Agent — Cluster 1 (will compete to become master) ─────────
cnf-agent-1:
<<: *cnf-base
environment:
<<: *cnf-env
CNF_CLUSTER_ID: "11111111-1111-1111-1111-000000000001"
CNF_CLUSTER_NAME: "openstack-1"
CNF_CLUSTER_GRPC_ADDR: "cnf-agent-1:50051"
CNF_API_PORT: "8080"
CNF_GRPC_PORT: "50051"
CNF_METRICS_PORT: "9090"
ports:
- "8081:8080" # REST API
- "9091:9090" # Prometheus
volumes:
- ./deploy/dev/cnf-1.yaml:/etc/cnf/cnf.yaml:ro
# ── CNF Agent — Cluster 2 (worker) ────────────────────────────────
cnf-agent-2:
<<: *cnf-base
environment:
<<: *cnf-env
CNF_CLUSTER_ID: "22222222-2222-2222-2222-000000000002"
CNF_CLUSTER_NAME: "openstack-2"
CNF_CLUSTER_GRPC_ADDR: "cnf-agent-2:50051"
CNF_API_PORT: "8080"
CNF_GRPC_PORT: "50051"
CNF_METRICS_PORT: "9090"
ports:
- "8082:8080"
- "9092:9090"
volumes:
- ./deploy/dev/cnf-2.yaml:/etc/cnf/cnf.yaml:ro
# ── Celery worker (migration task executor) ───────────────────────
celery-worker:
<<: *cnf-base
command: ["celery", "-A", "cnf.tasks.migration_tasks", "worker",
"--loglevel=info", "--concurrency=4", "-Q", "migrations"]
environment:
<<: *cnf-env
CNF_CLUSTER_ID: "11111111-1111-1111-1111-000000000001"
CNF_CLUSTER_NAME: "openstack-1"
depends_on:
- redis
- postgres
# ── Celery beat (scheduler trigger) ──────────────────────────────
celery-beat:
<<: *cnf-base
command: ["celery", "-A", "cnf.tasks.migration_tasks", "beat",
"--loglevel=info"]
environment:
<<: *cnf-env
CNF_CLUSTER_ID: "11111111-1111-1111-1111-000000000001"
CNF_CLUSTER_NAME: "openstack-1"
depends_on:
- redis
# ── Prometheus ────────────────────────────────────────────────────
prometheus:
image: prom/prometheus:v2.51.0
volumes:
- ./deploy/dev/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prom_data:/prometheus
ports:
- "9093:9090"
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=7d
# ── Grafana ───────────────────────────────────────────────────────
grafana:
image: grafana/grafana:10.4.0
environment:
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "true"
volumes:
- grafana_data:/var/lib/grafana
- ./deploy/dev/grafana/provisioning:/etc/grafana/provisioning:ro
ports:
- "3000:3000"
depends_on:
- prometheus
volumes:
pg_data:
etcd_data:
prom_data:
grafana_data: