-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
278 lines (268 loc) · 10.4 KB
/
docker-compose.prod.yml
File metadata and controls
278 lines (268 loc) · 10.4 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
services:
# ============================================================================
# Fabrikam API - Core business logic REST API
# ============================================================================
fabrikam-api:
image: ${DOCKER_REGISTRY:-davebirr}/fabrikam-api:${VERSION:-latest}
container_name: fabrikam-api-prod
expose:
- "8080" # Exposed to Cloudflare Tunnel for workshop access
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:8080
- Logging__LogLevel__Default=Warning
- Logging__LogLevel__Microsoft.AspNetCore=Error
# JWT Authentication (REQUIRED for workshop participants)
- Authentication__AspNetIdentity__Jwt__SecretKey=${JWT_SECRET_KEY:-}
- Authentication__AspNetIdentity__Jwt__Issuer=${JWT_ISSUER:-https://fabrikam-api.csplevelup.com}
- Authentication__AspNetIdentity__Jwt__Audience=${JWT_AUDIENCE:-FabrikamApi}
- Authentication__AspNetIdentity__Jwt__RequireHttpsMetadata=false
networks:
- fabrikam-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ============================================================================
# Fabrikam MCP - Model Context Protocol server with Cloudflare Tunnel
# ============================================================================
fabrikam-mcp:
image: ${DOCKER_REGISTRY:-davebirr}/fabrikam-mcp:${VERSION:-latest}
container_name: fabrikam-mcp-prod
expose:
- "8080" # Only exposed to internal network (Cloudflare Tunnel handles HTTPS)
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:8080
- FabrikamApi__BaseUrl=http://fabrikam-api:8080
- Logging__LogLevel__Default=Information
- Logging__LogLevel__Microsoft.AspNetCore=Warning
# Authentication configuration (configure via environment variables or Azure Key Vault)
- Authentication__Mode=${AUTH_MODE:-Disabled}
- Authentication__Jwt__SecretKey=${JWT_SECRET_KEY:-}
- Authentication__Jwt__Issuer=${JWT_ISSUER:-https://fabrikam-mcp.csplevelup.com}
- Authentication__Jwt__Audience=${JWT_AUDIENCE:-FabrikamMcp}
- Authentication__Jwt__RequireHttpsMetadata=false # Cloudflare Tunnel handles HTTPS
depends_on:
fabrikam-api:
condition: service_healthy
networks:
- fabrikam-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/status"]
interval: 30s
timeout: 3s
retries: 3
start_period: 15s
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ============================================================================
# Cloudflare Tunnel - MCP Server (AI Assistant access)
# ============================================================================
cloudflared-mcp:
image: cloudflare/cloudflared:latest
container_name: cloudflare-tunnel-mcp
command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN_MCP}
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN_MCP}
depends_on:
fabrikam-mcp:
condition: service_healthy
networks:
- fabrikam-net
restart: always
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
# ============================================================================
# Cloudflare Tunnel - API (Workshop participant access)
# ============================================================================
cloudflared-api:
image: cloudflare/cloudflared:latest
container_name: cloudflare-tunnel-api
command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN_API}
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN_API}
depends_on:
fabrikam-api:
condition: service_healthy
networks:
- fabrikam-net
restart: always
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
# ============================================================================
# Cloudflare Tunnel - Dashboard (Workshop participant access)
# ============================================================================
cloudflared-dashboard:
image: cloudflare/cloudflared:latest
container_name: cloudflare-tunnel-dashboard
command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN_DASHBOARD}
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN_DASHBOARD}
depends_on:
fabrikam-dashboard:
condition: service_healthy
networks:
- fabrikam-net
restart: always
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
# ============================================================================
# Fabrikam Simulator - Business activity simulator (optional in production)
# ============================================================================
fabrikam-simulator:
image: ${DOCKER_REGISTRY:-davebirr}/fabrikam-simulator:${VERSION:-latest}
container_name: fabrikam-simulator-prod
expose:
- "8080"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:8080
- FabrikamApi__BaseUrl=http://fabrikam-api:8080
- Logging__LogLevel__Default=Warning
depends_on:
fabrikam-api:
condition: service_healthy
networks:
- fabrikam-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 15s
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
profiles:
- simulator # Only start with: docker-compose --profile simulator up
# ============================================================================
# Fabrikam Dashboard - Blazor real-time dashboard (workshop access)
# ============================================================================
fabrikam-dashboard:
image: ${DOCKER_REGISTRY:-davebirr}/fabrikam-dashboard:${VERSION:-latest}
container_name: fabrikam-dashboard-prod
expose:
- "8080" # Exposed to Cloudflare Tunnel for workshop access
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:8080
- FabrikamApi__BaseUrl=http://fabrikam-api:8080
- Logging__LogLevel__Default=Warning
# JWT Authentication (REQUIRED for workshop participants)
- Authentication__JwtBearer__SecretKey=${JWT_SECRET_KEY:-}
- Authentication__JwtBearer__Issuer=${JWT_ISSUER:-https://fabrikam-api.csplevelup.com}
- Authentication__JwtBearer__Audience=${JWT_AUDIENCE:-FabrikamApi}
- Authentication__JwtBearer__RequireHttpsMetadata=false
depends_on:
fabrikam-api:
condition: service_healthy
networks:
- fabrikam-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 30s
timeout: 3s
retries: 3
start_period: 15s
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ============================================================================
# Watchtower - Automatic container updates
# ============================================================================
watchtower:
image: containrrr/watchtower
container_name: watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_POLL_INTERVAL=300 # Check every 5 minutes
- WATCHTOWER_INCLUDE_RESTARTING=true
- WATCHTOWER_LABEL_ENABLE=false # Update all containers
restart: always
logging:
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
# ============================================================================
# Networks
# ============================================================================
networks:
fabrikam-net:
driver: bridge
name: fabrikam-network-prod
# ============================================================================
# Environment Variables (create .env file):
# ============================================================================
# DOCKER_REGISTRY=davebirr # Your Docker Hub username
# VERSION=latest # Or specific version like v1.2.0
#
# Cloudflare Tunnel Tokens (from Zero Trust dashboard):
# CLOUDFLARE_TUNNEL_TOKEN_MCP=eyJh... # MCP Server tunnel
# CLOUDFLARE_TUNNEL_TOKEN_API=eyJh... # API Server tunnel
# CLOUDFLARE_TUNNEL_TOKEN_DASHBOARD=eyJh... # Dashboard tunnel
#
# JWT Authentication (REQUIRED for workshop participants):
# JWT_SECRET_KEY=your-secret-key # Generate with: openssl rand -base64 32
# JWT_ISSUER=https://fabrikam-api.csplevelup.com # API issuer URL
# JWT_AUDIENCE=FabrikamApi # Token audience
#
# MCP Authentication (optional):
# AUTH_MODE=Disabled # Or BearerToken for MCP
# ============================================================================
# ============================================================================
# Usage:
# ============================================================================
# 1. Create .env file with required variables (see above)
#
# 2. Start all services (API + MCP + Dashboard + 3 Cloudflare Tunnels):
# docker-compose -f docker-compose.prod.yml up -d
#
# 3. Start with optional simulator:
# docker-compose -f docker-compose.prod.yml --profile simulator up -d
#
# 4. View logs:
# docker-compose -f docker-compose.prod.yml logs -f
#
# 5. Stop services:
# docker-compose -f docker-compose.prod.yml down
#
# 6. Update to latest version (Watchtower does this automatically):
# docker-compose -f docker-compose.prod.yml pull
# docker-compose -f docker-compose.prod.yml up -d
#
# 7. Access Services (all require JWT authentication):
# https://fabrikam-api.csplevelup.com (API - workshop access)
# https://fabrikam-mcp.csplevelup.com (MCP - AI assistants)
# https://fabrikam-dashboard.csplevelup.com (Dashboard - workshop access)
# ============================================================================