Repository navigation
Expand file tree
/
Copy pathdocker-compose.local.yml
More file actions
206 lines (192 loc) · 7.96 KB
/
Copy pathdocker-compose.local.yml
File metadata and controls
206 lines (192 loc) · 7.96 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
# =============================================================================
# Local Laptop Overrides — macOS / Windows (Docker Desktop)
# =============================================================================
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.local.yml up -d
# (or simply: make local-up / make local-deploy)
#
# Why this exists:
# The main docker-compose.yml uses network_mode: host for Linux servers.
# Docker Desktop (macOS/Windows) runs containers in a Linux VM, so host
# networking doesn't expose ports to the host machine. This overlay uses
# !reset to clear network_mode and switches to a shared bridge network
# with explicit port mappings.
#
# What changes:
# - Clears network_mode: host (via !reset) and adds a shared bridge network
# - Adds port mappings so services are reachable from localhost
# - Overrides DATABASE_URL / REDIS_URL to use Docker DNS (service names)
# - Mounts local nginx configs that use Docker DNS instead of localhost
#
# Ports exposed on your laptop:
# 443 → Nginx proxy (HTTPS — accept the self-signed cert warning; maps to container 8443)
# 80 → Nginx proxy (HTTP → redirects to HTTPS; maps to container 8080)
# 8080 → Frontend direct (no proxy, no HTTPS)
# 8000 → Backend API direct
#
# NOTE: The GUI "Upgrade Now" feature (System > Upgrade) is not available in
# local mode — it requires Docker socket access and a host repo path.
#
# Requires: Docker Compose v2.24.0+ (for !reset support)
#
x-local-backend-env: &local-backend-env
BNK_FORGE_DEPLOY_MODE: local
DATABASE_URL: postgresql://bnkforge:${POSTGRES_PASSWORD:-bnkforge_dev_password}@postgres:5432/bnkforge
REDIS_URL: redis://:${REDIS_PASSWORD:-bnkforge_redis_dev}@redis:6379/0
CELERY_BROKER_URL: redis://:${REDIS_PASSWORD:-bnkforge_redis_dev}@redis:6379/0
CELERY_RESULT_BACKEND: redis://:${REDIS_PASSWORD:-bnkforge_redis_dev}@redis:6379/0
TF_PLUGIN_CACHE_DIR: /app/provider-cache
# #186: plumb the operator-chosen initial admin password to the backend
# (config.py has no env_file, so an unpassed var never reaches the container).
# bonnyr-f5 #193 B1 (r4): OMIT-when-unset (null-value passthrough) — a present-but-empty
# "" (from `${VAR:-}`) would OVERRIDE a pinned 3.1.6 image's `DEFAULT_ADMIN_PASSWORD:
# str = "changeme"` and lock admin out (login schema rejects ""). A map entry with NO
# value is passthrough: omitted when unset, forwarded when set — so each backend applies
# its own default (3.1.6 "changeme"; generating backend a random pw).
DEFAULT_ADMIN_PASSWORD:
# #186: plumb the must-change gate too, or the seeded admin owes a password
# change no route accepts (login is exempt; every other /api route 403s).
# Defaults to "true" (secure); ephemeral CI overrides to "false" to let the
# e2e suite reach protected routes.
DEFAULT_ADMIN_MUST_CHANGE: ${DEFAULT_ADMIN_MUST_CHANGE:-true}
# #186/#187 (bonnyr-f5 r5): the backend reconciles the mcp account to
# MCP_SERVICE_PASSWORD on every boot and seeds it from the same .env value the
# MCP server authenticates with; plumb it (and the username) here or the mcp
# account is never seeded and the mcp client cannot authenticate. Unset -> not
# seeded (no secret is generated for MCP -- #188-over-#186 consolidation).
# bonnyr-f5 #193 B1/M3: alias the PASSWORD only, and only for a NON-DEFAULT value —
# a legacy MCP_PASSWORD=changeme is a known-default the backend rejects, so it
# resolves through the alias but leaves MCP disabled. The USERNAME is not aliased — a
# legacy MCP_USERNAME=admin must never resolve the service username (old default admin,
# new default mcp), or a pre-guard backend rewrites the human admin row to changeme.
MCP_SERVICE_USERNAME: ${MCP_SERVICE_USERNAME:-mcp}
MCP_SERVICE_PASSWORD: ${MCP_SERVICE_PASSWORD:-${MCP_PASSWORD:-}}
# bonnyr-f5 #193 B3: plumb ENVIRONMENT so staging/production reaches the fail-fast.
ENVIRONMENT: ${ENVIRONMENT:-development}
# bonnyr-f5 #193 B2: plumb the three vars validate_production also gates on, or
# ENVIRONMENT=production bricks the backend. bonnyr-f5 #193 B1 (r4): OMIT-when-unset
# (null-value passthrough) — a pinned 3.1.6 backend uses `if self.KEY is None`, so a
# present-but-empty "" would boot with an empty JWT secret / invalid Fernet key instead
# of auto-generating. A map entry with NO value is passthrough: omitted when unset,
# forwarded when set; set real values in .env for production.
JWT_SECRET_KEY:
ENCRYPTION_KEY:
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-*}
# Shared bridge network — all services can resolve each other by service name
networks:
bnk-local:
driver: bridge
services:
postgres:
network_mode: !reset null
networks:
- bnk-local
ports:
- "5432:5432"
redis:
network_mode: !reset null
networks:
- bnk-local
ports:
- "6379:6379"
backend:
network_mode: !reset null
networks:
- bnk-local
ports:
- "8000:8000"
environment:
<<: *local-backend-env
# Override volumes to remove Docker socket and HOST_REPO_PATH (not needed on laptop)
volumes:
- module_catalog:/tmp/bnk-forge-modules
- bnk-forge-data:/app/projects
- bnk-forge-keys:/app/keys
# This override REPLACES the base volume list, so the agent bootstrap
# token mount must be repeated here (#148).
- bnk-forge-agent-token:/app/agent-token
- state_data:/app/state
- helm_cache:/home/bnkforge/.cache/helm
- helm_config:/home/bnkforge/.config/helm
- helm_charts:/app/helm_charts
- workspace_data:/app/workspaces
- provider_cache:/app/provider-cache
- ./secrets:/app/secrets:ro
- ./VERSION:/app/VERSION:ro
celery-worker:
network_mode: !reset null
networks:
- bnk-local
environment:
<<: *local-backend-env
# Artifact engine reaches the daemon via the scoped socket proxy (bridge DNS).
DOCKER_HOST: tcp://docker-socket-proxy:2375
celery-worker-2:
network_mode: !reset null
networks:
- bnk-local
environment:
<<: *local-backend-env
DOCKER_HOST: tcp://docker-socket-proxy:2375
docker-socket-proxy:
network_mode: !reset null
networks:
- bnk-local
celery-beat:
network_mode: !reset null
networks:
- bnk-local
environment:
<<: *local-backend-env
frontend:
network_mode: !reset null
networks:
- bnk-local
ports:
- "8080:8080"
volumes:
- ./frontend-v2/nginx.local.conf:/etc/nginx/conf.d/default.conf:ro
proxy:
network_mode: !reset null
networks:
- bnk-local
ports:
- "443:8443"
- "80:8080"
volumes:
- ./proxy/nginx.local.conf:/etc/nginx/conf.d/nginx.conf:ro
mcp:
network_mode: !reset null
networks:
- bnk-local
ports:
- "8081:8081"
environment:
BNK_FORGE_API_URL: http://backend:8000
# bonnyr-f5 #193 B1: PASSWORD aliased from legacy MCP_PASSWORD; USERNAME is not.
BNK_FORGE_USERNAME: ${MCP_SERVICE_USERNAME:-mcp}
# MCP authenticates as the dedicated service account seeded by the backend.
# Set MCP_SERVICE_PASSWORD in .env; backend reconciles the stored hash on
# every startup so backend and MCP always stay in sync. No shipped default
# (#186): the old mcp-service-changeme can no longer authenticate.
BNK_FORGE_PASSWORD: ${MCP_SERVICE_PASSWORD:-${MCP_PASSWORD:-}}
MCP_PORT: "8081"
postgres-backup:
network_mode: !reset null
networks:
- bnk-local
environment:
PGHOST: postgres
forge-agent:
network_mode: !reset null
networks:
- bnk-local
environment:
# On laptop use Docker compose DNS (backend service name)
FORGE_URL: http://backend:8000
AGENT_NAME: ${FORGE_AGENT_NAME:-forge-local}
AGENT_TOKEN: ${FORGE_AGENT_TOKEN:-}
# On macOS host IP is typically 192.168.65.1 (Docker Desktop gateway) or
# leave blank to let the agent resolve its hostname via container DNS.
AGENT_ADVERTISE_IP: ${FORGE_AGENT_ADVERTISE_IP:-}