Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
92 lines (86 loc) · 3.44 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
92 lines (86 loc) · 3.44 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
# docker-compose.prod.yml — Production overlay
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#
# What this file changes vs. docker-compose.yml:
# - Removes ALL host-port bindings for postgres, redis, and qdrant so they
# are only reachable inside the Docker network (not exposed to the host).
# - Keeps the api (8080) and frontend (5173 -> container 8080) accessible via
# a reverse proxy.
# - Keeps MCP loopback-bound for local/private clients only.
# - Expects real secrets in the environment (APP_ENV=production enforced by
# the API startup validator).
# - Disables POST /v1/workspaces by default. Temporarily set
# WORKSPACE_CREATION_ENABLED=true during initial bootstrap, then turn it off.
#
# Prerequisites:
# - Set APP_ENV=production in your .env or shell.
# - APP_SECRET_KEY and WORKSPACE_CREATION_SECRET must be real values (not dev-placeholder).
# - Place a reverse proxy (e.g. nginx/Caddy/Traefik) in front of port 8080
# and 5173 (mapped to frontend container port 8080) before exposing them to
# the internet.
services:
postgres:
# Remove host-facing port binding; only accessible within the Docker network.
ports: !reset []
# Postgres needs a writable data directory, so read_only is intentionally not set.
redis:
# Redis stays internal-only; persistence requires writes to /data.
ports: !reset []
qdrant:
# Qdrant stays internal-only; vector storage requires writes to /qdrant/storage.
ports: !reset []
api:
# Bind only on loopback so the host reverse proxy connects locally.
ports:
- "127.0.0.1:8080:8080"
environment:
APP_ENV: production
WORKSPACE_CREATION_ENABLED: ${WORKSPACE_CREATION_ENABLED:-false}
# Do not inherit local-dev bind mounts into production; bake or mount custom resources read-only explicitly.
volumes: !reset []
# Drop ambient Linux capabilities; the Rust API does not need them.
cap_drop: ["ALL"]
# Prevent privilege escalation through setuid/setgid binaries.
security_opt: ["no-new-privileges:true"]
# Make the container filesystem immutable; /tmp is kept as scratch space.
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
# Reap orphaned child processes cleanly.
init: true
# Bound process creation in case of dependency or handler bugs.
pids_limit: 256
mcp:
# MCP is intentionally loopback-only. Put it behind VPN/SSH/Tailscale if remote access is needed.
ports:
- "127.0.0.1:3003:3003"
# Do not inherit local-dev bind mounts into production; bake or mount custom resources read-only explicitly.
volumes: !reset []
# The MCP service runs as the non-root image user and needs no Linux capabilities.
cap_drop: ["ALL"]
security_opt: ["no-new-privileges:true"]
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
init: true
pids_limit: 128
healthcheck:
test: ["CMD", "/usr/local/bin/memoryops-healthcheck", "3003", "/health"]
interval: 10s
timeout: 5s
retries: 12
start_period: 20s
frontend:
ports:
- "127.0.0.1:5173:8080"
# The scratch frontend image runs as a numeric non-root user and needs no Linux capabilities.
cap_drop: ["ALL"]
security_opt: ["no-new-privileges:true"]
# The frontend serves static files, runtime config, and /api proxying without writing to disk.
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
init: true
pids_limit: 128