-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcompose.development.yml
More file actions
274 lines (263 loc) · 7.55 KB
/
Copy pathcompose.development.yml
File metadata and controls
274 lines (263 loc) · 7.55 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
x-common-variables: &common-variables
DATABASE_URL: &database-url postgres://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-node_pulse_admiral}?sslmode=disable
services:
# PostgreSQL 18 - Main Database
postgres:
image: postgres:18-alpine@sha256:f898ac406e1a9e05115cc2efcb3c3abb3a92a4c0263f3b6f6aaae354cbb1953a
container_name: node-pulse-postgres
env_file:
- .env
environment:
<<: *common-variables
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-node_pulse_admiral}
ports:
- "5432:5432"
volumes:
- ./postgres_data:/var/lib/postgresql
healthcheck:
test:
- CMD-SHELL
- pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-node_pulse_admiral}
interval: 10s
timeout: 5s
retries: 5
networks:
- node-pulse-admiral
# Valkey - Redis alternative for caching and sessions
valkey:
image: valkey/valkey:latest@sha256:81db6d39e1bba3b3ff32bd3a1b19a6d69690f94a3954ec131277b9a26b95b3aa
container_name: node-pulse-valkey
env_file:
- .env
command:
- valkey-server
- --appendonly
- "yes"
- --appendfsync
- "everysec"
- --maxmemory
- "256mb"
- --maxmemory-policy
- "allkeys-lru"
- --requirepass
- "${VALKEY_PASSWORD:-valkeypassword}"
volumes:
- ./valkey_data:/data
ports:
- "6379:6379"
healthcheck:
test:
- CMD
- valkey-cli
- --raw
- incr
- ping
interval: 10s
timeout: 5s
retries: 5
networks:
- node-pulse-admiral
# Flagship Migration - Run database migrations (idempotent)
flagship-migrate:
platform: linux/amd64
build:
context: ./migrate
dockerfile: Dockerfile
container_name: node-pulse-flagship-migrate
env_file:
- .env
environment:
<<: *common-variables
depends_on:
postgres:
condition: service_healthy
volumes:
- ./migrate/migrations:/app/migrations # Mount migrations for hot reload in dev
networks:
- node-pulse-admiral
restart: "no"
# Go-Gin Submarines Ingest - Agent Metrics Ingestion (HTTP -> Valkey Stream)
submarines-ingest:
platform: linux/amd64
build:
context: ./submarines
dockerfile: Dockerfile.ingest.dev
container_name: node-pulse-submarines-ingest
env_file:
- .env
environment:
<<: *common-variables
MASTER_KEY_PATH: /secrets/master.key
ports:
- "8080:8080" # Hardcoded for Cloudflare Tunnel
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
volumes:
- ./submarines:/app
- ./secrets:/secrets:ro
networks:
- node-pulse-admiral
# Go Submarines Digest - Background processor (Valkey Stream -> PostgreSQL)
submarines-digest:
platform: linux/amd64
build:
context: ./submarines
dockerfile: Dockerfile.digest.dev
container_name: node-pulse-submarines-digest
env_file:
- .env
environment:
<<: *common-variables
ports:
- "8082:8081" # Health check endpoint
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
volumes:
- ./submarines:/app
- ./secrets:/secrets:ro
networks:
- node-pulse-admiral
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:8081/health"]
interval: 10s
timeout: 3s
retries: 3
start_period: 10s
# Go Submarines Deployer - Ansible deployment worker (Valkey Stream -> Ansible)
submarines-deployer:
platform: linux/amd64
build:
context: ./submarines
dockerfile: Dockerfile.deployer.dev
container_name: node-pulse-submarines-deployer
env_file:
- .env
environment:
<<: *common-variables
MASTER_KEY_PATH: /secrets/master.key
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
flagship:
condition: service_healthy
volumes:
- ./submarines:/app
- ./ansible:/app/ansible # Mount Ansible playbooks (writable for custom playbooks)
- ./secrets:/secrets:ro # Mount master key for SSH key decryption
networks:
- node-pulse-admiral
# Go Submarines SSH WebSocket - Interactive terminal access
submarines-sshws:
platform: linux/amd64
build:
context: ./submarines
dockerfile: Dockerfile.sshws.dev
container_name: node-pulse-submarines-sshws
env_file:
- .env
environment:
<<: *common-variables
MASTER_KEY_PATH: /secrets/master.key
ports:
- "6001:6001" # local development
depends_on:
postgres:
condition: service_healthy
flagship-migrate:
condition: service_completed_successfully
volumes:
- ./submarines:/app
- ./secrets:/secrets:ro
networks:
- node-pulse-admiral
# Laravel Flagship - Admin Dashboard
flagship:
platform: linux/amd64
build:
context: ./flagship
dockerfile: Dockerfile.dev # Development build with hot reload
container_name: node-pulse-flagship
env_file:
- .env
ports:
- "8090:8090" # Nginx server (external:internal)
- "5173:5173" # Vite dev server
- "9003:9003" # Xdebug port
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
flagship-migrate:
condition: service_completed_successfully
submarines-ingest:
condition: service_started
volumes:
- ./flagship:/var/www/html # Mount entire app for hot reload
- ./ansible:/var/www/html/ansible # Mount Ansible playbooks (writable for community/custom playbooks)
- ./logs/flagship:/var/www/html/storage/logs
- ./secrets:/secrets:rw # Changed to :rw for mTLS setup (writing ca.crt)
- ./compose.yml:/config/compose.yml:rw # For mTLS setup (uncomment CA mount)
- ./caddy:/caddy:rw # For mTLS setup (uncomment TLS block)
- /var/run/docker.sock:/var/run/docker.sock:rw # For container restart via Docker API
- ./flagship/docker-entrypoint-dev.sh:/usr/local/bin/docker-entrypoint-dev.sh:ro
networks:
- node-pulse-admiral
# Override CMD to run both Laravel dev server and Vite HMR
command: ["/bin/bash", "/usr/local/bin/docker-entrypoint-dev.sh"]
healthcheck:
test:
- CMD
- curl
- -f
- http://127.0.0.1:8090
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
# =============================================================================
# Caddy - Reverse Proxy (Development)
# =============================================================================
caddy:
image: caddy:2-alpine
container_name: node-pulse-caddy
env_file:
- .env
ports:
- "8000:8000" # HTTP (Proxy to Flagship dev server)
volumes:
# Use development Caddyfile
- ./caddy/Caddyfile.dev:/etc/caddy/Caddyfile:ro
# Logs
- ./logs/caddy:/var/log/caddy
depends_on:
- flagship
- submarines-ingest
networks:
- node-pulse-admiral
healthcheck:
test:
- CMD
- wget
- --no-verbose
- --tries=1
- --spider
- http://127.0.0.1:8000
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
networks:
node-pulse-admiral:
driver: bridge
name: node-pulse-admiral