-
Notifications
You must be signed in to change notification settings - Fork 172
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
242 lines (233 loc) · 5.61 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
242 lines (233 loc) · 5.61 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
services:
# VNC Server (Ubuntu)
remote-desktop:
image: nishanb/ck-x-simulator-remote-desktop:latest
build:
context: ./remote-desktop
hostname: terminal
expose:
- "5901" # VNC port (internal only)
- "6901" # Web VNC port (internal only)
environment:
- VNC_PW=bakku-the-wizard
- VNC_PASSWORD=bakku-the-wizard
- VNC_VIEW_ONLY=false
- VNC_RESOLUTION=1280x800
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:6901/"]
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: "1"
memory: 1G
reservations:
cpus: "0.5"
memory: 512M
networks:
- ckx-network
# Web Application (not directly exposed to users)
webapp:
image: nishanb/ck-x-simulator-webapp:latest
build:
context: ./app
expose:
- "3000" # Only exposed to internal network
environment:
- VNC_SERVICE_HOST=remote-desktop
- VNC_SERVICE_PORT=6901
- VNC_PASSWORD=bakku-the-wizard
- SSH_HOST=remote-terminal
- SSH_PORT=22
- SSH_USER=candidate
- SSH_PASSWORD=password
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
reservations:
cpus: "0.2"
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:3000/"]
interval: 10s
timeout: 5s
retries: 3
networks:
- ckx-network
# Nginx Reverse Proxy - ONLY SERVICE EXPOSED TO USERS
nginx:
image: nishanb/ck-x-simulator-nginx:latest
build:
context: ./nginx
depends_on:
- webapp
- remote-desktop
- remote-terminal
- facilitator
- k8s-api-server
ports:
- "30080:80" # Expose Nginx on port 30080
deploy:
resources:
limits:
cpus: "0.2"
memory: 256M
reservations:
cpus: "0.1"
memory: 128M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 10s
timeout: 5s
retries: 3
networks:
- ckx-network
# Jump Host (ckad9999 and ckad9988)
jumphost:
image: nishanb/ck-x-simulator-jumphost:latest
build:
context: ./jumphost
hostname: ckad9999
privileged: true
# No external port mappings - only accessible internally
expose:
- "22" # SSH port (internal only)
volumes:
- kube-config:/home/candidate/.kube # Shared volume for Kubernetes config
deploy:
resources:
limits:
cpus: "1"
reservations:
cpus: "0.5"
memory: 512M
networks:
- ckx-network
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "22"]
interval: 10s
timeout: 5s
retries: 3
# Remote Terminal Service
remote-terminal:
image: nishanb/ck-x-simulator-remote-terminal:latest
build:
context: ./remote-terminal
hostname: remote-terminal
expose:
- "22" # SSH port (internal only)
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
reservations:
cpus: "0.2"
memory: 256M
networks:
- ckx-network
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "22"]
interval: 10s
timeout: 5s
retries: 3
# KIND Kubernetes Cluster
k8s-api-server: # Service name that will be used for DNS resolution
image: nishanb/ck-x-simulator-cluster:latest
build:
context: ./kind-cluster
container_name: kind-cluster
hostname: k8s-api-server
privileged: true # Required for running containers inside KIND
expose:
- "6443"
- "22"
volumes:
- kube-config:/home/candidate/.kube # Shared volume for Kubernetes config
deploy:
resources:
limits:
cpus: "2"
memory: 4G
reservations:
cpus: "1"
memory: 2G
networks:
- ckx-network
healthcheck:
test: ["CMD", "ls", "/ready"]
interval: 30s
timeout: 5s
retries: 20
start_period: 60s
# Redis Database for Facilitator
redis:
image: redis:alpine
hostname: redis
command: ["redis-server", "--appendonly", "yes"]
expose:
- "6379"
restart: unless-stopped
networks:
- ckx-network
deploy:
resources:
limits:
cpus: "0.3"
memory: 256M
reservations:
cpus: "0.1"
memory: 128M
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
# Facilitator Service
facilitator:
image: nishanb/ck-x-simulator-facilitator:latest
build:
context: ./facilitator
dockerfile: Dockerfile
hostname: facilitator
expose:
- "3000"
environment:
- PORT=3000
- NODE_ENV=prod
- SSH_HOST=jumphost
- SSH_PORT=22
- SSH_USERNAME=candidate
- LOG_LEVEL=info
- REDIS_HOST=redis
- REDIS_PORT=6379
- TRACK_METRICS=true # based on the environment variable TRACK_METRICS, the facilitator will send metrics to the metric server
restart: unless-stopped
depends_on:
- jumphost
- redis
networks:
- ckx-network
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
reservations:
cpus: "0.2"
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:3000"]
interval: 10s
timeout: 5s
retries: 3
networks:
ckx-network:
name: ckx-network
driver: bridge
volumes:
kube-config: # Shared volume for Kubernetes configuration