-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
326 lines (311 loc) · 9.62 KB
/
Copy pathdocker-compose.yml
File metadata and controls
326 lines (311 loc) · 9.62 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
x-rust-service: &rust-service
build:
context: .
dockerfile: control-plane/Dockerfile
volumes:
- ./Cargo.toml:/app/Cargo.toml
- ./Cargo.lock:/app/Cargo.lock
- ./control-plane/shared:/app/control-plane/shared
- cargo_cache:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
networks:
- csfx-network
restart: unless-stopped
services:
postgres:
image: postgres:16-alpine
container_name: csfx-postgres-dev
environment:
POSTGRES_USER: ${POSTGRES_USER:-csfx_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-csfx_password}
POSTGRES_DB: ${POSTGRES_DB:-csfx_core}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-csfx_user} -d ${POSTGRES_DB:-csfx_core}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- csfx-network
etcd:
image: gcr.io/etcd-development/etcd:v3.5.21
container_name: csfx-etcd-dev
command:
- etcd
- --advertise-client-urls=http://etcd:2379
- --listen-client-urls=http://0.0.0.0:2379
ports:
- "2379:2379"
networks:
- csfx-network
migrate:
<<: *rust-service
container_name: csfx-migrate-dev
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-csfx_user}:${POSTGRES_PASSWORD:-csfx_password}@postgres:5432/${POSTGRES_DB:-csfx_core}
RUST_LOG: info
depends_on:
postgres:
condition: service_healthy
volumes:
- ./control-plane/csfx-migrate:/app/control-plane/csfx-migrate
- ./control-plane/shared:/app/control-plane/shared
- cargo_target_migrate:/app/target
command: cargo run -p csfx-migrate
restart: "no"
healthcheck:
test: ["CMD-SHELL", "[ $$(cat /tmp/migrate-done 2>/dev/null) = 'ok' ] || exit 1"]
interval: 5s
timeout: 5s
retries: 20
api-gateway:
<<: *rust-service
container_name: csfx-api-gateway-dev
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-csfx_user}:${POSTGRES_PASSWORD:-csfx_password}@postgres:5432/${POSTGRES_DB:-csfx_core}
RUST_LOG: ${RUST_LOG:-debug}
JWT_SECRET: ${JWT_SECRET:-dev_jwt_secret_change_in_production}
RSA_KEY_SIZE: "2048"
REGISTRY_SERVICE_URL: http://registry:8001
SCHEDULER_SERVICE_URL: http://scheduler:8002
VOLUME_MANAGER_URL: http://volume-manager:8003
FAILOVER_CONTROLLER_URL: http://failover-controller:8004
SDN_CONTROLLER_URL: http://sdn-controller:8005
FRONTEND_URL: http://localhost:5173
CSFX_INCLUDE_CONTAINERS: "true"
TLS_ENABLED: "false"
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
migrate:
condition: service_completed_successfully
volumes:
- ./control-plane/api-gateway:/app/control-plane/api-gateway
- cargo_target_api_gateway:/app/target
command: cargo watch -x "run -p api-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/system/health"]
interval: 10s
timeout: 5s
retries: 10
start_period: 60s
registry:
<<: *rust-service
container_name: csfx-registry-dev
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-csfx_user}:${POSTGRES_PASSWORD:-csfx_password}@postgres:5432/${POSTGRES_DB:-csfx_core}
ETCD_ENDPOINTS: http://etcd:2379
REGISTRY_PORT: "8001"
LISTEN_ADDR: "0.0.0.0"
RUST_LOG: ${RUST_LOG:-debug}
SCHEDULER_SERVICE_URL: http://scheduler:8002
API_GATEWAY_URL: http://api-gateway:8000
ports:
- "8001:8001"
depends_on:
postgres:
condition: service_healthy
etcd:
condition: service_started
migrate:
condition: service_completed_successfully
volumes:
- ./control-plane/registry:/app/control-plane/registry
- cargo_target_registry:/app/target
command: cargo watch -x "run -p registry"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
interval: 30s
timeout: 10s
retries: 3
scheduler:
<<: *rust-service
container_name: csfx-scheduler-dev
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-csfx_user}:${POSTGRES_PASSWORD:-csfx_password}@postgres:5432/${POSTGRES_DB:-csfx_core}
ETCD_ENDPOINTS: http://etcd:2379
SCHEDULER_PORT: "8002"
LISTEN_ADDR: "0.0.0.0"
RUST_LOG: ${RUST_LOG:-debug}
ports:
- "8002:8002"
depends_on:
postgres:
condition: service_healthy
etcd:
condition: service_started
migrate:
condition: service_completed_successfully
volumes:
- ./control-plane/scheduler:/app/control-plane/scheduler
- cargo_target_scheduler:/app/target
command: cargo watch -x "run -p scheduler"
volume-manager:
<<: *rust-service
container_name: csfx-volume-manager-dev
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-csfx_user}:${POSTGRES_PASSWORD:-csfx_password}@postgres:5432/${POSTGRES_DB:-csfx_core}
ETCD_ENDPOINTS: http://etcd:2379
VOLUME_MANAGER_PORT: "8003"
LISTEN_ADDR: "0.0.0.0"
RUST_LOG: ${RUST_LOG:-debug}
ports:
- "8003:8003"
depends_on:
postgres:
condition: service_healthy
etcd:
condition: service_started
migrate:
condition: service_completed_successfully
volumes:
- ./control-plane/volume-manager:/app/control-plane/volume-manager
- cargo_target_volume_manager:/app/target
command: cargo watch -x "run -p volume-manager"
failover-controller:
<<: *rust-service
container_name: csfx-failover-controller-dev
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-csfx_user}:${POSTGRES_PASSWORD:-csfx_password}@postgres:5432/${POSTGRES_DB:-csfx_core}
FAILOVER_CONTROLLER_PORT: "8004"
LISTEN_ADDR: "0.0.0.0"
SCHEDULER_SERVICE_URL: http://scheduler:8002
VOLUME_MANAGER_URL: http://volume-manager:8003
RUST_LOG: ${RUST_LOG:-debug}
ports:
- "8004:8004"
depends_on:
postgres:
condition: service_healthy
scheduler:
condition: service_started
volume-manager:
condition: service_started
volumes:
- ./control-plane/failover-controller:/app/control-plane/failover-controller
- cargo_target_failover_controller:/app/target
command: cargo watch -x "run -p failover-controller"
sdn-controller:
<<: *rust-service
container_name: csfx-sdn-controller-dev
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-csfx_user}:${POSTGRES_PASSWORD:-csfx_password}@postgres:5432/${POSTGRES_DB:-csfx_core}
ETCD_URL: http://etcd:2379
SDN_CONTROLLER_PORT: "8005"
LISTEN_ADDR: "0.0.0.0"
RUST_LOG: ${RUST_LOG:-debug}
ports:
- "8005:8005"
depends_on:
postgres:
condition: service_healthy
etcd:
condition: service_started
migrate:
condition: service_completed_successfully
volumes:
- ./control-plane/sdn-controller:/app/control-plane/sdn-controller
- cargo_target_sdn_controller:/app/target
command: cargo watch -x "run -p sdn-controller"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8005/health"]
interval: 30s
timeout: 10s
retries: 3
agent-1:
<<: *rust-service
container_name: csfx-agent-dev-1
hostname: dev-node-1
environment:
CSFX_GATEWAY_URL: http://api-gateway:8000
CSFX_HEARTBEAT_INTERVAL: "15"
RUST_LOG: ${RUST_LOG:-debug}
depends_on:
api-gateway:
condition: service_healthy
registry:
condition: service_healthy
volumes:
- ./agent:/app/agent
- ./control-plane/shared:/app/control-plane/shared
- cargo_target_agent:/app/target
- agent_state_1:/var/lib/csfx-agent
command: cargo run -p csfx-agent
agent-2:
<<: *rust-service
container_name: csfx-agent-dev-2
hostname: dev-node-2
environment:
CSFX_GATEWAY_URL: http://api-gateway:8000
CSFX_HEARTBEAT_INTERVAL: "15"
RUST_LOG: ${RUST_LOG:-debug}
depends_on:
api-gateway:
condition: service_healthy
registry:
condition: service_healthy
volumes:
- ./agent:/app/agent
- ./control-plane/shared:/app/control-plane/shared
- cargo_target_agent:/app/target
- agent_state_2:/var/lib/csfx-agent
command: cargo run -p csfx-agent
agent-3:
<<: *rust-service
container_name: csfx-agent-dev-3
hostname: dev-node-3
environment:
CSFX_GATEWAY_URL: http://api-gateway:8000
CSFX_HEARTBEAT_INTERVAL: "15"
RUST_LOG: ${RUST_LOG:-debug}
depends_on:
api-gateway:
condition: service_healthy
registry:
condition: service_healthy
volumes:
- ./agent:/app/agent
- ./control-plane/shared:/app/control-plane/shared
- cargo_target_agent:/app/target
- agent_state_3:/var/lib/csfx-agent
command: cargo run -p csfx-agent
app:
build:
context: ./app
dockerfile: Dockerfile
container_name: csfx-app-dev
environment:
VITE_API_URL: http://api-gateway:8000
ports:
- "5173:5173"
volumes:
- ./app/src:/app/src
- ./app/static:/app/static
depends_on:
- api-gateway
networks:
- csfx-network
restart: unless-stopped
volumes:
postgres_data:
cargo_cache:
cargo_git:
cargo_target_migrate:
cargo_target_api_gateway:
cargo_target_registry:
cargo_target_scheduler:
cargo_target_volume_manager:
cargo_target_failover_controller:
cargo_target_sdn_controller:
cargo_target_agent:
agent_state_1:
agent_state_2:
agent_state_3:
networks:
csfx-network:
driver: bridge