-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
195 lines (188 loc) · 6.15 KB
/
Copy pathdocker-compose.yml
File metadata and controls
195 lines (188 loc) · 6.15 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
# Unified docker-compose: one file for local dev, CI, and the real-LLM
# harness tier.
#
# The three previous overlays (docker-compose.{ci,real-llm}.yml) are
# replaced by env-var substitution + optional service profiles. Same
# set of core services (postgres + api + dashboard + inngest-dev) runs
# everywhere; only the secrets/passwords/profiles change per caller.
#
# Usage
# -----
#
# Local dev (defaults — dashboard + api hot-reload, observability off):
#
# docker compose up -d
#
# CI (ephemeral postgres password; minimal set; BuildKit GHA cache):
#
# POSTGRES_PASSWORD=ci_test \
# docker compose up -d postgres api inngest-dev dashboard
#
# Real-LLM harness (provider keys):
#
# POSTGRES_PASSWORD=ergon \
# OPENROUTER_API_KEY="$OPENROUTER_API_KEY" \
# OPENAI_API_KEY="$OPENAI_API_KEY" \
# EXA_API_KEY="$EXA_API_KEY" \
# HF_API_KEY="$HF_API_KEY" \
# docker compose up -d
#
# Observability stack (otel + jaeger) on demand:
#
# docker compose --profile observability up -d
#
# Service port conventions (host:container):
# postgres 5433:5432
# api 9000:9000
# dashboard 3001:3000
# inngest-dev 8289:8288
#
# All of the above can be overridden via env vars without editing this
# file (see the ``${VAR:-default}`` forms).
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: ergon
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ergon_dev}
POSTGRES_DB: ergon
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ergon"]
interval: 2s
timeout: 3s
retries: 10
api:
build:
context: .
dockerfile: Dockerfile
# BuildKit GHA cache: CI passes these through via buildx. Local
# developers get a no-op (``type=gha`` is only honoured when the
# buildx GHA-cache endpoints are present, which GitHub Actions
# sets automatically). No local setup required.
cache_from:
- type=gha,scope=ergon-api
cache_to:
- type=gha,scope=ergon-api,mode=max
image: ergon-api:local
ports:
- "9000:9000"
env_file:
- path: .env
required: false
environment:
- ERGON_DATABASE_URL=postgresql://ergon:${POSTGRES_PASSWORD:-ergon_dev}@postgres:5432/ergon
- INNGEST_DEV=1
- INNGEST_EVENT_KEY=dev
- INNGEST_API_BASE_URL=http://inngest-dev:8288
- ERGON_API_BASE_URL=http://api:9000
- ERGON_BLOB_ROOT=/tmp/ergon-blob
- OTEL_TRACES_ENABLED=false
- OTEL_SERVICE_NAME=ergon-core
- E2B_API_KEY=${E2B_API_KEY:-}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
- EXA_API_KEY=${EXA_API_KEY:-}
- HF_API_KEY=${HF_API_KEY:-}
# Put /app on sys.path so editable source mounts resolve in the API
# container while local smoke fixtures live under tests.fixtures.
- PYTHONPATH=/app
# Unbuffered Python stdio so ``docker compose logs api`` streams
# logger output as it happens. Default (buffered) hides
# exceptions behind the uvicorn worker's output queue for many
# seconds, turning any "why is this stuck" investigation into a
# long stare at stale logs.
- PYTHONUNBUFFERED=1
volumes:
# Source mounts: support ``--reload`` in dev. Harmless in CI —
# the same source is on the runner's filesystem from ``checkout``.
- ./ergon_core:/app/ergon_core
- ./ergon_builtins:/app/ergon_builtins
- ./ergon_cli:/app/ergon_cli
- ./tests:/app/tests
- ./data:/app/data
# Blob store bind mount so host-side pytest can read files the
# SandboxResourcePublisher writes from inside the container. The
# mount uses the same path on both sides so the DB-stored
# ``file_path`` (computed from ``ERGON_BLOB_ROOT``) resolves on
# both ends.
- /tmp/ergon-blob:/tmp/ergon-blob
depends_on:
postgres:
condition: service_healthy
# Without this, ``docker compose up --wait`` only waits for Postgres.
# Uvicorn + ``--reload`` can still be importing when CI starts Playwright,
# so ``GET /api/health`` in the dashboard sees a failing ``ergon_api``
# probe and returns 503 (see ``ergon-dashboard/tests/e2e/health.spec.ts``).
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:9000/health >/dev/null || exit 1"]
interval: 3s
timeout: 5s
retries: 30
start_period: 120s
command: >
uvicorn ergon_cli.api_app:app
--host 0.0.0.0 --port 9000 --reload
--reload-dir /app/ergon_core
--reload-dir /app/ergon_builtins
--reload-dir /app/tests
--timeout-graceful-shutdown 30
dashboard:
build:
context: ./ergon-dashboard
dockerfile: Dockerfile
ports:
- "3001:3000"
environment:
- NODE_ENV=development
- ERGON_API_BASE_URL=http://api:9000
- INNGEST_DEV=1
- INNGEST_EVENT_KEY=dev
- INNGEST_API_BASE_URL=http://inngest-dev:8288
- WATCHPACK_POLLING=true
depends_on:
- inngest-dev
- api
command: pnpm dev
volumes:
- ./ergon-dashboard:/app
- /app/node_modules
- /app/.next
inngest-dev:
image: inngest/inngest:latest
command: >
inngest dev --no-discovery
-u http://api:9000/api/inngest
-u http://dashboard:3000/api/inngest
ports:
- "8289:8288"
environment:
- INNGEST_DEV=1
depends_on:
api:
condition: service_started
# -- Observability stack (opt-in via ``--profile observability``) ---
#
# Not started by default. Enables OTel trace export to Jaeger for
# debugging runtime + execution ordering.
otel-collector:
profiles: ["observability"]
image: otel/opentelemetry-collector-contrib:latest
command: ["--config=/etc/otelcol-contrib/config.yaml"]
volumes:
- ./ergon_infra/ergon_infra/templates/otel-collector.yaml:/etc/otelcol-contrib/config.yaml
ports:
- "4319:4317"
jaeger:
profiles: ["observability"]
image: jaegertracing/all-in-one:latest
ports:
- "16687:16686"
- "4320:4318"
environment:
- COLLECTOR_OTLP_ENABLED=true
volumes:
postgres_data: