-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.failover-controller.yml
More file actions
203 lines (194 loc) · 5.93 KB
/
docker-compose.failover-controller.yml
File metadata and controls
203 lines (194 loc) · 5.93 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
x-rust-common: &rust-common
build:
context: .
dockerfile: control-plane/Dockerfile.dev.shared
volumes:
- ./control-plane/shared:/app/control-plane/shared
- ./Cargo.toml:/app/Cargo.toml
- ./Cargo.lock:/app/Cargo.lock
- cargo_cache:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
networks:
- csf-network
restart: unless-stopped
services:
postgres:
image: postgres:16-alpine
container_name: csf-postgres-failover
environment:
POSTGRES_USER: csf_user
POSTGRES_PASSWORD: csf_password
POSTGRES_DB: csf_core
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U csf_user -d csf_core"]
interval: 10s
timeout: 5s
retries: 5
networks:
- csf-network
etcd:
image: gcr.io/etcd-development/etcd:v3.5.21
container_name: csf-etcd-failover
command:
- etcd
- --advertise-client-urls=http://etcd:2379
- --listen-client-urls=http://0.0.0.0:2379
ports:
- "2379:2379"
networks:
- csf-network
api-gateway:
<<: *rust-common
container_name: csf-api-gateway-failover
environment:
DATABASE_URL: postgres://csf_user:csf_password@postgres:5432/csf_core
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
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
volumes:
- ./control-plane/api-gateway:/app/control-plane/api-gateway
- ./control-plane/shared:/app/control-plane/shared
- ./Cargo.toml:/app/Cargo.toml
- ./Cargo.lock:/app/Cargo.lock
- cargo_cache:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- cargo_target_api_gateway:/app/target
command: cargo watch -x "run -p api-gateway"
registry:
<<: *rust-common
container_name: csf-registry-failover
environment:
DATABASE_URL: postgres://csf_user:csf_password@postgres:5432/csf_core
ETCD_ENDPOINTS: http://etcd:2379
REGISTRY_PORT: "8001"
RUST_LOG: debug
SCHEDULER_SERVICE_URL: http://scheduler:8002
ports:
- "8001:8001"
depends_on:
postgres:
condition: service_healthy
etcd:
condition: service_started
volumes:
- ./control-plane/registry:/app/control-plane/registry
- ./control-plane/shared:/app/control-plane/shared
- ./Cargo.toml:/app/Cargo.toml
- ./Cargo.lock:/app/Cargo.lock
- cargo_cache:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- cargo_target_registry:/app/target
command: cargo watch -x "run -p registry"
scheduler:
<<: *rust-common
container_name: csf-scheduler-failover
environment:
DATABASE_URL: postgres://csf_user:csf_password@postgres:5432/csf_core
ETCD_ENDPOINTS: http://etcd:2379
SCHEDULER_PORT: "8002"
RUST_LOG: debug
ports:
- "8002:8002"
depends_on:
postgres:
condition: service_healthy
etcd:
condition: service_started
volumes:
- ./control-plane/scheduler:/app/control-plane/scheduler
- ./control-plane/shared:/app/control-plane/shared
- ./Cargo.toml:/app/Cargo.toml
- ./Cargo.lock:/app/Cargo.lock
- cargo_cache:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- cargo_target_scheduler:/app/target
command: cargo watch -x "run -p scheduler"
volume-manager:
<<: *rust-common
container_name: csf-volume-manager-failover
environment:
DATABASE_URL: postgres://csf_user:csf_password@postgres:5432/csf_core
ETCD_ENDPOINTS: http://etcd:2379
VOLUME_MANAGER_PORT: "8003"
RUST_LOG: debug
ports:
- "8003:8003"
depends_on:
postgres:
condition: service_healthy
etcd:
condition: service_started
volumes:
- ./control-plane/volume-manager:/app/control-plane/volume-manager
- ./control-plane/shared:/app/control-plane/shared
- ./Cargo.toml:/app/Cargo.toml
- ./Cargo.lock:/app/Cargo.lock
- cargo_cache:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- cargo_target_volume_manager:/app/target
command: cargo watch -x "run -p volume-manager"
failover-controller:
<<: *rust-common
container_name: csf-failover-controller
environment:
DATABASE_URL: postgres://csf_user:csf_password@postgres:5432/csf_core
FAILOVER_CONTROLLER_PORT: "8004"
SCHEDULER_SERVICE_URL: http://scheduler:8002
VOLUME_MANAGER_URL: http://volume-manager:8003
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
- ./control-plane/shared:/app/control-plane/shared
- ./Cargo.toml:/app/Cargo.toml
- ./Cargo.lock:/app/Cargo.lock
- cargo_cache:/usr/local/cargo/registry
- cargo_git:/usr/local/cargo/git
- cargo_target_failover_controller:/app/target
command: cargo watch -x "run -p failover-controller"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8004/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
postgres_data:
driver: local
cargo_cache:
driver: local
cargo_git:
driver: local
cargo_target_api_gateway:
driver: local
cargo_target_registry:
driver: local
cargo_target_scheduler:
driver: local
cargo_target_volume_manager:
driver: local
cargo_target_failover_controller:
driver: local
networks:
csf-network:
driver: bridge