-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
260 lines (250 loc) · 9.47 KB
/
docker-compose.prod.yml
File metadata and controls
260 lines (250 loc) · 9.47 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
# Production deployment — run with: docker compose -f docker-compose.prod.yml up -d
# Requires .env and .env.prod files — see .env.example for required variables.
# Images pulled from GHCR (built by GitHub Actions)
# GitHub repository: VitalPointAI/Bastion
services:
# ==========================================
# PostgreSQL Database with TimescaleDB
# ==========================================
postgres:
image: timescale/timescaledb:latest-pg16
container_name: bastion-postgres
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: coalition_ops
# NO host port mapping — only accessible on bastion-network
# Databases must not be reachable from the internet
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backend/database/init.sql:/docker-entrypoint-initdb.d/01-init.sql
- ./backend/database/schema.sql:/docker-entrypoint-initdb.d/02-schema.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d coalition_ops"]
interval: 10s
timeout: 5s
retries: 5
networks:
- bastion-network
# ==========================================
# Neo4j Graph Database
# ==========================================
neo4j:
image: neo4j:2025-community
container_name: bastion-neo4j
restart: always
environment:
NEO4J_AUTH: neo4j/${NEO4J_PASSWORD}
NEO4J_PLUGINS: '["apoc"]'
# Tuned for CAX21 (8GB RAM shared with all services)
# Reduced from dev (1g→512m) to leave headroom for PostgreSQL + Node.js
NEO4J_server_memory_heap_initial__size: 256m
NEO4J_server_memory_heap_max__size: 512m
NEO4J_server_memory_pagecache_size: 256m
# NO host port mapping — only accessible on bastion-network
volumes:
- neo4j_data:/data
- neo4j_logs:/logs
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:7474 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
networks:
- bastion-network
# ==========================================
# Ironclaw PostgreSQL (pgvector) — isolated on ironclaw-network
# ==========================================
ironclaw-postgres:
image: pgvector/pgvector:pg16
container_name: bastion-ironclaw-postgres
restart: always
environment:
POSTGRES_DB: ironclaw
POSTGRES_USER: ironclaw
POSTGRES_PASSWORD: ${IRONCLAW_DB_PASSWORD}
volumes:
- ironclaw_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ironclaw -d ironclaw"]
interval: 10s
timeout: 5s
retries: 5
networks:
- ironclaw-network
# ==========================================
# Ironclaw Agent Sidecar
# ==========================================
ironclaw:
image: ghcr.io/vitalpointai/bastion/ironclaw:latest
container_name: bastion-ironclaw
# sleep infinity keeps stdin open so the repl channel doesn't EOF-shutdown.
# --no-onboard skips the interactive setup wizard.
entrypoint: ["/usr/local/bin/entrypoint.sh"]
restart: unless-stopped
environment:
# LLM backend — Anthropic via OAuth (subscription only, no API key fallback)
LLM_BACKEND: anthropic
ANTHROPIC_OAUTH_TOKEN: ${ANTHROPIC_OAUTH_TOKEN:-}
ANTHROPIC_MODEL: claude-haiku-4-5-20251001
# Database (ironclaw's own pgvector instance)
DATABASE_URL: postgresql://ironclaw:${IRONCLAW_DB_PASSWORD}@ironclaw-postgres:5432/ironclaw
# HTTP webhook server
HTTP_HOST: 0.0.0.0
HTTP_PORT: "8080"
HTTP_WEBHOOK_SECRET: ${IRONCLAW_SHARED_SECRET}
# Secrets keychain master key (stable across restarts)
IRONCLAW_SECRETS_MASTER_KEY: ${IRONCLAW_MASTER_KEY}
# NEAR AI API key for embeddings
NEARAI_API_KEY: ${NEARAI_API_KEY}
# Agent settings
AGENT_NAME: ironclaw
AGENT_USE_PLANNING: "true"
RUST_LOG: ironclaw=info
# MCP server URL — entrypoint registers this with Ironclaw's REPL at startup
MCP_BASTION_URL: http://bastion-mcp:3334/mcp
volumes:
- ironclaw-data:/home/ironclaw/.ironclaw
- token-sync:/shared/tokens # OAuth token file from backend
depends_on:
ironclaw-postgres:
condition: service_healthy
networks:
# Ironclaw is on a separate network — NO access to postgres or neo4j.
- ironclaw-network
# ==========================================
# SearXNG — Self-hosted meta-search engine for doc-intelligence researcher
# ==========================================
searxng:
image: searxng/searxng:latest
container_name: bastion-searxng
restart: always
volumes:
- ./searxng/settings.yml:/etc/searxng/settings.yml:ro
- ./searxng/limiter.toml:/etc/searxng/limiter.toml:ro
environment:
- SEARXNG_BASE_URL=http://searxng:8080/
# NO host port mapping — only accessible on bastion-network
networks:
- bastion-network
# ==========================================
# BASTION MCP Server
# Exposes BASTION tools to AI agents via Model Context Protocol (SSE transport)
# ==========================================
bastion-mcp:
image: ghcr.io/vitalpointai/bastion/backend:latest
container_name: bastion-mcp
restart: always
command: node dist/mcp/index.js
# NO host port mapping — only accessible on internal networks
environment:
NODE_ENV: production
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/coalition_ops
NEO4J_URI: bolt://neo4j:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: ${NEO4J_PASSWORD}
MCP_PORT: "3334"
SEARXNG_URL: http://searxng:8080
TAVILY_API_KEY: ${TAVILY_API_KEY:-}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3334/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"]
interval: 30s
timeout: 10s
start_period: 10s
retries: 3
depends_on:
postgres:
condition: service_healthy
networks:
- bastion-network
- ironclaw-network
# ==========================================
# Backend API Server
# ==========================================
backend:
image: ghcr.io/vitalpointai/bastion/backend:latest
# NO build block — uses pre-built GHCR image pushed by GitHub Actions
container_name: bastion-backend
restart: always
# NO host port mapping — only accessible via bastion-network
# Frontend container's nginx proxies /api/ to http://backend:3001
env_file:
- .env.prod
environment:
NODE_ENV: production
PORT: "3001"
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/coalition_ops
NEO4J_URI: bolt://neo4j:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: ${NEO4J_PASSWORD}
IRONCLAW_URL: http://ironclaw:8080
# IRONCLAW_VERSION: auto-detected from health endpoint at startup
IRONCLAW_SHARED_SECRET: ${IRONCLAW_SHARED_SECRET}
DATABASE_URL_IRONCLAW: postgresql://ironclaw:${IRONCLAW_DB_PASSWORD}@ironclaw-postgres:5432/ironclaw
MCP_BASTION_URL: http://bastion-mcp:3334/mcp
SEARXNG_URL: http://searxng:8080
depends_on:
postgres:
condition: service_healthy
neo4j:
condition: service_healthy
ironclaw:
condition: service_started
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3001/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"]
interval: 30s
timeout: 10s
start_period: 10s
retries: 3
group_add:
- "988" # Docker group GID — grants access to /var/run/docker.sock for Ironclaw self-update
volumes:
- token-sync:/shared/tokens # Write refreshed OAuth tokens for Ironclaw
- ${HOME}/.claude:/home/nodejs/.claude:ro # Claude Code OAuth credentials (read by LLM factory)
- /var/run/docker.sock:/var/run/docker.sock # Docker socket for Ironclaw self-update
networks:
- bastion-network
- ironclaw-network
# ==========================================
# Frontend (nginx:alpine serving static files)
# ==========================================
frontend:
image: ghcr.io/vitalpointai/bastion/frontend:latest
# NO build block — uses pre-built GHCR image pushed by GitHub Actions
container_name: bastion-frontend
restart: always
ports:
# Host nginx (port 443) proxies to this port
# Container runs nginx:alpine serving pre-built static files on port 80
- "8080:80"
# NO source volume mounts — production serves pre-built static files from image
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1/health || exit 1"]
interval: 30s
timeout: 10s
start_period: 5s
retries: 3
networks:
- bastion-network
# Named volumes for persistent data
volumes:
postgres_data:
neo4j_data:
neo4j_logs:
ironclaw_postgres_data:
ironclaw-data:
token-sync: # Shared volume: backend writes OAuth tokens, Ironclaw reads them
# Internal Docker network — databases never exposed to host network
networks:
bastion-network:
driver: bridge
# Isolated network for Ironclaw agent — only the backend can reach it.
# Ironclaw has NO access to postgres, neo4j, or any other bastion-network service.
ironclaw-network:
driver: bridge