-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
94 lines (91 loc) · 4.34 KB
/
Copy pathdocker-compose.yml
File metadata and controls
94 lines (91 loc) · 4.34 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
# Run the hosted trace dashboard (standalone Next.js: UI + same-origin API + SSE), Postgres (session store),
# and a local S3 (mock-aws) for recordings:
# docker compose up --build
# open http://localhost:14747 # the trace dashboard (sessions persisted in Postgres)
# open http://localhost:19001 # mock-aws (MinIO) console — minioadmin / minioadmin
# psql postgres://trace:trace@localhost:65432/trace -c 'select session_id, at from trace_sessions;'
#
# Emit traces from the host (the CLI runs where your debug target is reachable). Chrome traces record by
# default and upload the video to mock-aws, attaching a link to the trace:
# export S3_ENDPOINT=http://localhost:19000
# TRACE_COLLECTOR_URL=http://localhost:14747 trace run --chrome 9222 --url http://localhost:3000 --bp src/App.tsx:9
#
# Bringing the stack up runs the whole end-to-end demo too (Node + React + Chrome targets, all in
# one demo container), no host setup — `docker compose up --build` starts everything; `docker compose down` stops it all:
# docker compose up --build # then watch all 3 traces (incl. the React video) at :14747
services:
dashboard:
build: .
image: trace-cli
container_name: trace-dashboard
ports:
- "14747:4747"
environment:
# The dashboard is database-driven: sessions persist in Postgres (the `db` service).
- DATABASE_URL=postgres://trace:trace@db:5432/trace
# Optional: export the dashboard's own OpenTelemetry spans to a collector (Jaeger / Grafana Tempo).
# - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
depends_on:
db:
condition: service_healthy
restart: unless-stopped
# Postgres — the session store. The dashboard persists every trace envelope here (JSONB) via DATABASE_URL;
# in production you point DATABASE_URL at a managed Postgres instead — no code change.
db:
image: postgres:16
container_name: trace-db
environment:
- POSTGRES_USER=trace
- POSTGRES_PASSWORD=trace
- POSTGRES_DB=trace
ports:
- "65432:5432" # connect from the host: DATABASE_URL=postgres://trace:trace@localhost:65432/trace
volumes:
- ./.trace-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U trace -d trace"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# S3-compatible object store standing in for AWS S3. The CLI talks the S3 API (AWS SDK) to it; in
# production you point S3_ENDPOINT at real AWS instead — no code change.
mock-aws:
image: minio/minio
container_name: mock-aws
command: server /data --console-address ":9001"
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
ports:
- "19000:9000" # S3 API endpoint → set S3_ENDPOINT=http://localhost:19000
- "19001:9001" # web console
volumes:
- ./.mock-aws-data:/data
restart: unless-stopped
# ───────────────────────── demo (one container, comes up/down with the stack) ─────────────────────────
# The whole self-contained run of test/servers/scenarios.sh, collapsed into ONE container. It starts the
# Node/React apps being traced + a headless Chrome on its own loopback, waits for them and the
# dashboard, then drives all 3 scenarios once (uploading the React video to mock-aws) and exits. One
# container = one network namespace, so every target is on 127.0.0.1 (exactly as the CLI's localhost
# discovery expects) and all app/debug ports stay inside it — no shared-netns anchor, no host clashes.
demo:
build:
context: .
dockerfile: test/servers/runner/Dockerfile
image: trace-demo
container_name: trace-demo
working_dir: /app
volumes:
- ./test/servers:/app/test/servers:ro # scenarios + app sources (live-editable, no rebuild)
environment:
- TRACE_COLLECTOR_URL=http://dashboard:4747
- S3_ENDPOINT=http://mock-aws:9000 # upload the recording here (in-network)
- S3_PUBLIC_URL=http://localhost:19000 # …but store a host-reachable link for the browser
- S3_BUCKET=traces
- AWS_ACCESS_KEY_ID=minioadmin
- AWS_SECRET_ACCESS_KEY=minioadmin
- AWS_REGION=us-east-1
depends_on:
- dashboard
restart: "no"