Repository navigation
Expand file tree
/
Copy pathcompose.prod.yaml
More file actions
131 lines (127 loc) · 5.95 KB
/
Copy pathcompose.prod.yaml
File metadata and controls
131 lines (127 loc) · 5.95 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
name: useagent-${USEAGENT_RELEASE_COLOR:?set USEAGENT_RELEASE_COLOR to blue or green}
# Logs go to the host journal (rotated by journald) so they survive the blue/green
# container swap; json-file logs were deleted with each replaced container.
x-logging: &logging
driver: journald
options:
tag: "useagent-{{.Name}}"
services:
backend:
image: ${USEAGENT_BACKEND_IMAGE:?set an immutable backend image digest}
logging: *logging
network_mode: host
labels:
io.useagent.release.color: ${USEAGENT_RELEASE_COLOR}
io.useagent.release.commit: ${USEAGENT_RELEASE_COMMIT}
io.useagent.release.service: backend
env_file:
- ${USEAGENT_BACKEND_ENV_FILE:-/etc/useagent/backend.env}
# Auth mode and identity secret are captured with this release. Compensation
# must not borrow a candidate's auth selection from the shared host env.
- ${USEAGENT_FRONTEND_ENV_FILE:-/etc/useagent/frontend.env}
environment:
NODE_ENV: production
PORT: ${USEAGENT_BACKEND_PORT:?set the inactive-color backend port}
USEAGENT_BIND_HOST: 127.0.0.1
USEAGENT_RELEASE_COMMIT: ${USEAGENT_RELEASE_COMMIT:?set the exact release commit}
REQUIRE_SINGLE_BACKEND: "true"
# Runtime compatibility belongs to the immutable image. An empty override
# defeats stale host env pins while letting each image use its own default,
# so rollback selects the previous generation automatically.
USEAGENT_RUNTIME_GENERATION: ""
# Artifact bytes are shared with the gateway: same host directory, same
# path inside both containers, because the gateway publishes too.
ARTIFACT_STORAGE_DIR: /var/lib/useagent/artifacts
RUNS_ROOT: /app/backend/.runs
SLACK_UPLOAD_STAGING_ROOT: /app/backend/.slack-uploads
SCRATCH_DIR: /var/lib/useagent/scratch/${USEAGENT_RELEASE_COLOR}
CODEX_APP_SERVER_HOME_ROOT: /var/lib/useagent/codex-app-server
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
GATEWAY_PUBLIC_URL: ${USEAGENT_GATEWAY_PUBLIC_URL:?set the sandbox-reachable HTTPS gateway origin}
PROVIDER_GATEWAY_PUBLIC_URL: ${USEAGENT_GATEWAY_PUBLIC_URL}
healthcheck:
test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:'+(process.env.PORT||'3201')+'/api/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
interval: 5s
timeout: 3s
start_period: 15s
retries: 12
read_only: true
tmpfs:
- /tmp:size=256m,mode=1777
volumes:
- /var/lib/useagent/artifacts:/var/lib/useagent/artifacts
- /var/lib/useagent/runs:/app/backend/.runs
- /var/lib/useagent/slack-uploads:/app/backend/.slack-uploads
- /var/lib/useagent/scratch:/var/lib/useagent/scratch
- /var/lib/useagent/codex-app-server:/var/lib/useagent/codex-app-server
- /opt/useagent/pi-runtime:/opt/useagent/pi-runtime
- ${USEAGENT_HOST_CA_BUNDLE:-/etc/ssl/certs/ca-certificates.crt}:/etc/ssl/certs/ca-certificates.crt:ro
- ${USEAGENT_UPLOAD_SCAN_DATABASE_DIR:-/var/lib/clamav}:/var/lib/clamav:ro
restart: unless-stopped
stop_grace_period: 30s
gateway:
image: ${USEAGENT_GATEWAY_IMAGE:?set an immutable gateway image digest}
logging: *logging
network_mode: host
labels:
io.useagent.release.color: ${USEAGENT_RELEASE_COLOR}
io.useagent.release.commit: ${USEAGENT_RELEASE_COMMIT}
io.useagent.release.service: gateway
env_file:
- ${USEAGENT_GATEWAY_ENV_FILE:-/etc/useagent/gateway.env}
environment:
NODE_ENV: production
GATEWAY_PORT: ${USEAGENT_GATEWAY_PORT:?set the inactive-color gateway port}
USEAGENT_BIND_HOST: 127.0.0.1
# The gateway's artifact_publish tool writes the bytes it receives from a
# sandbox. Without this override and the matching mount below, the read-only
# root filesystem turns every publish into EROFS.
ARTIFACT_STORAGE_DIR: /var/lib/useagent/artifacts
USEAGENT_RELEASE_COMMIT: ${USEAGENT_RELEASE_COMMIT:?set the exact release commit}
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
USEAGENT_API_ORIGIN: http://127.0.0.1:${USEAGENT_BACKEND_PORT}
GATEWAY_PUBLIC_URL: ${USEAGENT_GATEWAY_PUBLIC_URL:?set the sandbox-reachable HTTPS gateway origin}
PROVIDER_GATEWAY_PUBLIC_URL: ${USEAGENT_GATEWAY_PUBLIC_URL}
healthcheck:
test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:'+(process.env.GATEWAY_PORT||'3202')+'/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
interval: 5s
timeout: 3s
start_period: 10s
retries: 12
read_only: true
tmpfs:
- /tmp:size=128m,mode=1777
volumes:
- /var/lib/useagent/artifacts:/var/lib/useagent/artifacts
- ${USEAGENT_HOST_CA_BUNDLE:-/etc/ssl/certs/ca-certificates.crt}:/etc/ssl/certs/ca-certificates.crt:ro
restart: unless-stopped
stop_grace_period: 30s
frontend:
image: ${USEAGENT_FRONTEND_IMAGE:?set an immutable frontend image digest}
logging: *logging
network_mode: host
labels:
io.useagent.release.color: ${USEAGENT_RELEASE_COLOR}
io.useagent.release.commit: ${USEAGENT_RELEASE_COMMIT}
io.useagent.release.service: frontend
env_file:
- ${USEAGENT_FRONTEND_ENV_FILE:-/etc/useagent/frontend.env}
environment:
NODE_ENV: production
HOSTNAME: 127.0.0.1
PORT: ${USEAGENT_FRONTEND_PORT:?set the inactive-color frontend port}
USEAGENT_API_ORIGIN: http://127.0.0.1:${USEAGENT_BACKEND_PORT}
NEXT_PUBLIC_USEAGENT_RELEASE_COMMIT: ${USEAGENT_RELEASE_COMMIT}
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:'+(process.env.PORT||'3400')+'/healthz').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
interval: 5s
timeout: 3s
start_period: 15s
retries: 12
read_only: true
tmpfs:
- /tmp:size=128m,mode=1777
restart: unless-stopped
stop_grace_period: 30s