-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.fullstack.yml
More file actions
214 lines (205 loc) · 6.94 KB
/
compose.fullstack.yml
File metadata and controls
214 lines (205 loc) · 6.94 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
# =============================================================================
# Docker Compose - NEXUS Full Stack LOCAL Development
# =============================================================================
# Runs ALL services locally for development: Backend + Both Frontends
#
# Usage:
# docker compose -f compose.fullstack.yml up -d --build
#
# Services:
# - API: http://localhost:5080 (+ Swagger at /swagger)
# - Modern Frontend: http://localhost:5170 (Next.js + HeroUI)
# - UK Frontend: http://localhost:5180 (Express + GOV.UK)
# - RabbitMQ UI: http://localhost:15672 (guest/guest)
# - Ollama API: http://localhost:11434
#
# After first start, pull the AI model:
# docker compose -f compose.fullstack.yml exec llama-service ollama pull llama3.2:3b
# =============================================================================
name: nexus-fullstack
services:
# ---------------------------------------------------------------------------
# API Backend (ASP.NET Core 8)
# ---------------------------------------------------------------------------
api:
build:
context: .
dockerfile: Dockerfile
container_name: nexus-fullstack-api
ports:
- "5080:8080"
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__DefaultConnection=Host=db;Port=5432;Database=nexus_dev;Username=postgres;Password=postgres
- 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
- RateLimiting__Auth__PermitLimit=10
- RateLimiting__Auth__WindowSeconds=60
- RateLimiting__General__PermitLimit=200
- RateLimiting__General__WindowSeconds=60
- RabbitMq__Host=rabbitmq
- RabbitMq__Port=5672
- RabbitMq__Username=guest
- RabbitMq__Password=guest
- RabbitMq__VirtualHost=/
- RabbitMq__ExchangeName=nexus.events
- RabbitMq__Enabled=true
- LlamaService__BaseUrl=http://llama-service:11434
- LlamaService__Model=llama3.2:3b
- LlamaService__TimeoutSeconds=180
depends_on:
db:
condition: service_healthy
rabbitmq:
condition: service_healthy
llama-service:
condition: service_started
networks:
- nexus-fullstack-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:8080/health || exit 1"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
# ---------------------------------------------------------------------------
# Modern Frontend (Next.js + HeroUI) - Development Mode
# ---------------------------------------------------------------------------
modern-frontend:
build:
context: ../nexus-modern-frontend
dockerfile: Dockerfile
target: dev
container_name: nexus-fullstack-modern
ports:
- "5170:3002"
environment:
- NODE_ENV=development
- NEXT_PUBLIC_API_URL=http://localhost:5080
volumes:
# Mount source for hot reload (exclude node_modules)
- ../nexus-modern-frontend/src:/app/src:ro
- ../nexus-modern-frontend/public:/app/public:ro
depends_on:
api:
condition: service_healthy
networks:
- nexus-fullstack-net
restart: unless-stopped
# ---------------------------------------------------------------------------
# UK Frontend (Express + GOV.UK) - Development Mode
# ---------------------------------------------------------------------------
uk-frontend:
build:
context: ../nexus-uk-frontend
dockerfile: Dockerfile
target: development
container_name: nexus-fullstack-uk
ports:
- "5180:3001"
environment:
- NODE_ENV=development
- PORT=3001
- API_URL=http://api:8080
- SESSION_SECRET=dev-session-secret-not-for-production
volumes:
# Mount source for hot reload
- ../nexus-uk-frontend/src:/app/src:ro
- ../nexus-uk-frontend/public:/app/public
depends_on:
api:
condition: service_healthy
networks:
- nexus-fullstack-net
restart: unless-stopped
# ---------------------------------------------------------------------------
# Database (PostgreSQL 16)
# ---------------------------------------------------------------------------
db:
image: postgres:16.4-bookworm
container_name: nexus-fullstack-db
environment:
POSTGRES_DB: nexus_dev
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- nexus-fullstack-db-data:/var/lib/postgresql/data
networks:
- nexus-fullstack-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-fullstack-rabbitmq
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
volumes:
- nexus-fullstack-rabbitmq-data:/var/lib/rabbitmq
networks:
- nexus-fullstack-net
restart: unless-stopped
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
interval: 10s
timeout: 10s
retries: 5
# ---------------------------------------------------------------------------
# AI Service (Ollama)
# ---------------------------------------------------------------------------
llama-service:
image: ollama/ollama:latest
container_name: nexus-fullstack-llama
ports:
- "11434:11434"
environment:
- OLLAMA_HOST=0.0.0.0
volumes:
- nexus-fullstack-llama-models:/root/.ollama
networks:
- nexus-fullstack-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:11434/api/tags || exit 1"]
interval: 30s
timeout: 10s
start_period: 120s
retries: 3
deploy:
resources:
limits:
memory: 8G
reservations:
memory: 4G
# -----------------------------------------------------------------------------
# Networks
# -----------------------------------------------------------------------------
networks:
nexus-fullstack-net:
name: nexus-fullstack-net
driver: bridge
# -----------------------------------------------------------------------------
# Volumes
# -----------------------------------------------------------------------------
volumes:
nexus-fullstack-db-data:
name: nexus-fullstack-db-data
nexus-fullstack-rabbitmq-data:
name: nexus-fullstack-rabbitmq-data
nexus-fullstack-llama-models:
name: nexus-fullstack-llama-models