Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
202 lines (193 loc) · 7.58 KB
/
Copy pathdocker-compose.yml
File metadata and controls
202 lines (193 loc) · 7.58 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
# CodeBaseFoundation - Full Stack Docker Compose
#
# Profiles:
# infra → redis, convex-backend, convex-dashboard, mailhog
# (stateful deps for native dev)
# trailbase → local TrailBase sidecar (parked; opt in explicitly)
# mail → MailHog dev SMTP catcher only
# app → backend, frontend (containerized app for prod-parity)
# mcp → private Streamable HTTP MCP service (loopback only)
#
# Services have no default profile, so `docker compose up` alone is a no-op.
# Use ./dev.sh as the entry point — it handles profile selection for you.
services:
# ─── Infrastructure ────────────────────────────────────────
redis:
image: redis:7-alpine
profiles: ["infra"]
# Loopback only — no password, used only by the local backend.
ports:
- "127.0.0.1:${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
# noeviction, not allkeys-lru: this Redis backs the BullMQ build queue, and
# BullMQ warns on every boot that lru lets Redis silently drop queued job
# data under memory pressure — builds would vanish with no error. With
# noeviction a full instance rejects writes loudly instead.
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy noeviction
healthcheck:
test: redis-cli ping
interval: 5s
start_period: 5s
restart: unless-stopped
mailhog:
image: mailhog/mailhog:v1.0.1
profiles: ["infra", "mail"]
# Dev-only SMTP catcher: every email the backend sends in dev lands in
# the MailHog inbox instead of leaving the machine. Loopback only.
# SMTP on 1025, web UI + JSON API on 8025.
ports:
- "127.0.0.1:${MAILHOG_SMTP_PORT:-1025}:1025"
- "127.0.0.1:${MAILHOG_UI_PORT:-8025}:8025"
restart: unless-stopped
# Convex images are pinned: `latest` let any `docker compose pull` or host
# rebuild silently upgrade (or change) the database engine under production.
# The default tag is the upstream commit `latest` pointed to on 2026-09-21.
# Before the first `up` on a host, confirm it matches what is running:
# docker inspect <convex backend container> \
# --format '{{index .Config.Labels "org.opencontainers.image.revision"}}'
# and set CONVEX_BACKEND_TAG / CONVEX_DASHBOARD_TAG to that value if it differs.
# Upgrade deliberately: back up (scripts/backup-convex.sh), bump, pull, up.
convex-backend:
image: ghcr.io/get-convex/convex-backend:${CONVEX_BACKEND_TAG:-0cf49cbf8c4b7e22e631ceda9b5111f6cccbcd49}
profiles: ["infra"]
stop_grace_period: 10s
stop_signal: SIGINT
# Loopback only — admin port 3211 must not be reachable from
# LAN or internet. External access via nginx → Express → Convex.
ports:
- "127.0.0.1:${CONVEX_PORT:-3232}:3210"
- "127.0.0.1:${CONVEX_SITE_PORT:-3233}:3211"
volumes:
- convex_data:/convex/data
environment:
- CONVEX_CLOUD_ORIGIN=${CONVEX_CLOUD_ORIGIN:-http://127.0.0.1:${CONVEX_PORT:-3232}}
- CONVEX_SITE_ORIGIN=${CONVEX_SITE_ORIGIN:-http://127.0.0.1:${CONVEX_SITE_PORT:-3233}}
- DISABLE_BEACON=true
- RUST_LOG=${RUST_LOG:-info}
- DOCUMENT_RETENTION_DELAY=${DOCUMENT_RETENTION_DELAY:-172800}
healthcheck:
test: curl -f http://localhost:3210/version
interval: 5s
start_period: 10s
restart: unless-stopped
convex-dashboard:
image: ghcr.io/get-convex/convex-dashboard:${CONVEX_DASHBOARD_TAG:-0cf49cbf8c4b7e22e631ceda9b5111f6cccbcd49}
profiles: ["infra"]
stop_grace_period: 10s
stop_signal: SIGINT
# Dashboard is unauthenticated full-DB admin. Loopback only —
# reach via `ssh -L 6791:127.0.0.1:6791` from a trusted host.
ports:
- "127.0.0.1:${CONVEX_DASHBOARD_PORT:-6791}:6791"
environment:
- NEXT_PUBLIC_DEPLOYMENT_URL=${NEXT_PUBLIC_DEPLOYMENT_URL:-http://127.0.0.1:${CONVEX_PORT:-3232}}
depends_on:
convex-backend:
condition: service_healthy
restart: unless-stopped
trailbase:
image: ${TRAILBASE_IMAGE:-trailbase/trailbase:latest}
profiles: ["trailbase"]
# Parked: FEATURE_AI_BACKEND_TOOLS is off, so opt in with --profile trailbase.
# Loopback only — local sidecar, not for external exposure.
ports:
- "127.0.0.1:${TRAILBASE_PORT:-4000}:4000"
volumes:
- trailbase_data:/app/traildepot
environment:
- RUST_BACKTRACE=1
restart: unless-stopped
# ─── Backend (Express + tRPC + WebSocket) ──────────────────
backend:
build:
context: ./web
dockerfile: backend/Dockerfile
profiles: ["app"]
ports:
- "${BACKEND_PORT:-3001}:3001"
volumes:
- generated_projects:/app/generated-projects
- backend_logs:/app/logs
env_file:
- .env.docker
environment:
- NODE_ENV=production
- PORT=3001
- REDIS_URL=redis://redis:6379
- CONVEX_SELF_HOSTED_URL=http://convex-backend:3210
- NEXT_PUBLIC_CONVEX_URL=http://convex-backend:3210
depends_on:
redis:
condition: service_healthy
convex-backend:
condition: service_healthy
trailbase:
condition: service_started
restart: unless-stopped
# ─── MCP Server (stateless Streamable HTTP) ────────────────
mcp-server:
build:
context: ./web/mcp-server
dockerfile: Dockerfile
profiles: ["mcp"]
# Private deployment target only. A public endpoint still requires the
# documented TLS gateway and per-key rate limits.
ports:
- "127.0.0.1:${CODEBASE_MCP_DOCKER_PORT:-3012}:3002"
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- NODE_ENV=production
- CODEBASE_MCP_TRANSPORT=http
- CODEBASE_MCP_HOST=0.0.0.0
- CODEBASE_MCP_PORT=3002
- CODEBASE_BASE_URL=${CODEBASE_MCP_BASE_URL:-http://host.docker.internal:3001}
healthcheck:
test:
- CMD
- node
- -e
- "fetch('http://127.0.0.1:3002/health').then((response) => { if (!response.ok) process.exit(1); }).catch(() => process.exit(1))"
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
restart: unless-stopped
# ─── Frontend (Next.js 15) ─────────────────────────────────
frontend:
profiles: ["app"]
build:
context: ./web
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_BACKEND_HOST=${NEXT_PUBLIC_BACKEND_HOST:-localhost}
- NEXT_PUBLIC_BACKEND_HTTP_PORT=${NEXT_PUBLIC_BACKEND_HTTP_PORT:-3001}
- NEXT_PUBLIC_BACKEND_WS_PORT=${NEXT_PUBLIC_BACKEND_WS_PORT:-3001}
- NEXT_PUBLIC_BACKEND_PROTOCOL=${NEXT_PUBLIC_BACKEND_PROTOCOL:-http}
- NEXT_PUBLIC_BACKEND_WS_PROTOCOL=${NEXT_PUBLIC_BACKEND_WS_PROTOCOL:-ws}
- NEXT_PUBLIC_CONVEX_URL=${NEXT_PUBLIC_CONVEX_URL:-http://127.0.0.1:3232}
- NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
ports:
- "${FRONTEND_PORT:-3000}:3000"
env_file:
- .env.docker
environment:
- NODE_ENV=production
- PORT=3000
- HOSTNAME=0.0.0.0
depends_on:
- backend
restart: unless-stopped
volumes:
# Reuse the volumes created by the legacy web/convex-docker/ compose so
# existing Convex data (and the admin key in .env.local) remain valid.
redis_data:
name: convex-docker_redis_data
external: true
convex_data:
name: convex-docker_convex_data
external: true
generated_projects:
backend_logs:
trailbase_data: