-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yml
More file actions
308 lines (294 loc) · 9.79 KB
/
compose.yml
File metadata and controls
308 lines (294 loc) · 9.79 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
# =============================================================================
# Docker Compose - Nexus Backend (Isolated Stack)
# =============================================================================
# This is the SOURCE OF TRUTH for running the backend locally.
#
# ISOLATION: This stack uses its own network and volumes, completely
# independent from any other Docker projects on this machine.
#
# Quick start:
# export JWT_SECRET="YourSecure32CharacterSecretHere!" # or set in .env
# docker compose up -d
# docker compose logs -f api
#
# IMPORTANT: JWT_SECRET must be set via environment variable or .env file
# =============================================================================
name: nexus-backend
services:
# ---------------------------------------------------------------------------
# API Service (ASP.NET Core 8)
# ---------------------------------------------------------------------------
api:
build:
context: .
dockerfile: Dockerfile
container_name: nexus-backend-api
ports:
- "5080:8080" # Host:Container - Access at http://localhost:5080
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__DefaultConnection=Host=db;Port=5432;Database=nexus_dev;Username=postgres;Password=postgres
# JWT_SECRET MUST be provided via environment variable or .env file
# DO NOT hardcode secrets here - the app will fail to start without this
- Jwt__Secret=${JWT_SECRET:?JWT_SECRET environment variable is required}
- Jwt__Issuer=
- Jwt__Audience=
- Cors__AllowedOrigins__0=http://localhost:5080
- Cors__AllowedOrigins__1=http://localhost:5170
- Cors__AllowedOrigins__2=http://localhost:5180
- Cors__AllowedOrigins__3=http://localhost:5190
- Cors__AllowedOrigins__4=http://localhost:5200
# Rate limiting (relaxed for development)
- RateLimiting__Auth__PermitLimit=10
- RateLimiting__Auth__WindowSeconds=60
- RateLimiting__General__PermitLimit=200
- RateLimiting__General__WindowSeconds=60
# RabbitMQ configuration
- RabbitMq__Host=rabbitmq
- RabbitMq__Port=5672
- RabbitMq__Username=guest
- RabbitMq__Password=guest
- RabbitMq__VirtualHost=/
- RabbitMq__ExchangeName=nexus.events
- RabbitMq__Enabled=true
# WebAuthn/Passkey (FIDO2) configuration
- Fido2__ServerDomain=localhost
- Fido2__ServerName=Project NEXUS
- Fido2__Origins__0=http://localhost:5080
- Fido2__Origins__1=http://localhost:5170
- Fido2__Origins__2=http://localhost:5180
# Llama AI service configuration
- LlamaService__BaseUrl=http://llama-service:11434
- LlamaService__Model=llama3.2:11b
- LlamaService__TimeoutSeconds=180
depends_on:
db:
condition: service_healthy
rabbitmq:
condition: service_healthy
llama-service:
condition: service_started
networks:
- nexus-backend-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:8080/health || exit 1"]
interval: 30s
timeout: 10s
start_period: 60s
retries: 3
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 512M
# ---------------------------------------------------------------------------
# Database (PostgreSQL 16)
# ---------------------------------------------------------------------------
db:
image: postgres:16.4-bookworm
container_name: nexus-backend-db
# DB is internal-only by default (no host port exposed)
# Uncomment the next two lines if you need direct DB access from host:
# ports:
# - "5435:5432"
environment:
POSTGRES_DB: nexus_dev
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- nexus-backend-db-data:/var/lib/postgresql/data
networks:
- nexus-backend-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d nexus_dev"]
interval: 5s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Message Broker (RabbitMQ)
# ---------------------------------------------------------------------------
rabbitmq:
image: rabbitmq:3.13-management
container_name: nexus-backend-rabbitmq
ports:
- "5672:5672" # AMQP protocol
- "15672:15672" # Management UI (http://localhost:15672)
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
volumes:
- nexus-backend-rabbitmq-data:/var/lib/rabbitmq
networks:
- nexus-backend-net
restart: unless-stopped
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
interval: 10s
timeout: 10s
retries: 5
# ---------------------------------------------------------------------------
# AI Service (Ollama with Llama 3.2)
# ---------------------------------------------------------------------------
# NOTE: After starting, you must pull the model:
# docker compose exec llama-service ollama pull llama3.2:3b
# ---------------------------------------------------------------------------
llama-service:
image: ollama/ollama:latest
container_name: nexus-backend-llama
# No port exposed — accessible only via Docker network (http://llama-service:11434)
environment:
- OLLAMA_HOST=0.0.0.0
volumes:
- nexus-backend-llama-models:/root/.ollama
networks:
- nexus-backend-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:11434/api/tags || exit 1"]
interval: 60s
timeout: 30s
start_period: 180s
retries: 5
deploy:
resources:
limits:
memory: 12G
reservations:
memory: 8G
# ---------------------------------------------------------------------------
# GOV.IE Design System Frontend (Nexus Community - web-govie)
# NOTE: Not an official government service. Uses @govie-ds/* open-source
# packages as a UI foundation only. See apps/web-govie/BRANDING.md.
# ---------------------------------------------------------------------------
web-govie:
build:
context: ./apps/web-govie
dockerfile: Dockerfile
args:
VITE_API_BASE_URL: http://localhost:5080
VITE_APP_NAME: Nexus Community
VITE_APP_VERSION: 0.1.0
VITE_TENANT_SLUG: acme
container_name: nexus-web-govie
ports:
- "5200:80"
networks:
- nexus-backend-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/health || exit 1"]
interval: 30s
timeout: 5s
start_period: 15s
retries: 3
deploy:
resources:
limits:
memory: 256M
reservations:
memory: 128M
# ---------------------------------------------------------------------------
# Admin Panel (Nexus Admin - apps/admin)
# Refine v4 + Ant Design + Vite - migrated from htdocs/nexus-admin
# ---------------------------------------------------------------------------
admin:
build:
context: ./apps/admin
dockerfile: Dockerfile
target: dev
container_name: nexus-admin-dev
ports:
- "5190:5190"
volumes:
- ./apps/admin:/app
- /app/node_modules
environment:
- NODE_ENV=development
- VITE_API_URL=http://api:8080
depends_on:
api:
condition: service_healthy
networks:
- nexus-backend-net
restart: unless-stopped
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 256M
# ---------------------------------------------------------------------------
# Modern Frontend (apps/web-modern) - Next.js + HeroUI
# Previously at htdocs/nexus-modern-frontend/
# ---------------------------------------------------------------------------
web-modern:
build:
context: ./apps/web-modern
dockerfile: Dockerfile
target: dev
container_name: nexus-frontend-dev
ports:
- "5170:3002"
volumes:
- ./apps/web-modern:/app
- /app/node_modules
- /app/.next
env_file:
- ./apps/web-modern/.env.docker
environment:
- NODE_ENV=development
networks:
- nexus-backend-net
restart: unless-stopped
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
# ---------------------------------------------------------------------------
# UK Frontend (apps/web-uk) - GOV.UK Design System (Express/Node)
# Previously at htdocs/nexus-uk-frontend/
# ---------------------------------------------------------------------------
web-uk:
build:
context: ./apps/web-uk
dockerfile: Dockerfile
target: development
container_name: nexus-uk-frontend-dev
ports:
- "5180:3001"
volumes:
- ./apps/web-uk:/app
- /app/node_modules
env_file:
- ./apps/web-uk/.env.docker
networks:
- nexus-backend-net
restart: unless-stopped
deploy:
resources:
limits:
memory: 256M
reservations:
memory: 128M
# -----------------------------------------------------------------------------
# Networks (isolated from other Docker projects)
# -----------------------------------------------------------------------------
networks:
nexus-backend-net:
name: nexus-backend-net
driver: bridge
# -----------------------------------------------------------------------------
# Volumes (persistent, isolated)
# -----------------------------------------------------------------------------
volumes:
nexus-backend-db-data:
name: nexus-backend-db-data
nexus-backend-rabbitmq-data:
name: nexus-backend-rabbitmq-data
nexus-backend-llama-models:
name: nexus-backend-llama-models