-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
87 lines (82 loc) · 3.2 KB
/
Copy pathdocker-compose.yml
File metadata and controls
87 lines (82 loc) · 3.2 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
# The application and its observability stack.
#
# rss-server holds the Next.js server, its API and the SQLite database in one
# container: SQLite keeps the application to a single process with no start-up
# ordering to get wrong, and the database file lives on a named volume so
# content survives `docker compose down`.
#
# The other three services are the Assessment 3 addition. The application never
# talks to Jaeger or Prometheus directly — it emits OTLP to the collector, and
# the collector decides where telemetry goes. Swapping Jaeger for something
# else is then a change to otel-collector-config.yaml rather than to the app.
#
# rss-server ──OTLP/HTTP──▶ otel-collector ──▶ jaeger (traces)
# ▲
# └────────────scrape /api/metrics──── prometheus (metrics)
#
# All images are pinned. An unpinned :latest silently changed the collector's
# config format underneath this stack once already.
services:
rss-server:
build: .
image: latrobe-rss-server:3.0.0
container_name: rss-server
ports:
- "3000:3000"
environment:
DATABASE_URL: "file:/data/rss.db"
NODE_ENV: production
# Absolute URLs inside the RSS feed. Change this when serving from a
# different host so <link> and <guid> stay resolvable for clients.
SITE_URL: "http://localhost:3000"
# Service name as it appears in Jaeger's service dropdown.
OTEL_SERVICE_NAME: "rss-server"
# The collector, by compose service name — not localhost, which inside
# this container would mean the container itself.
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4318"
volumes:
- rss-data:/data
depends_on:
- otel-collector
restart: unless-stopped
# Receives OTLP from the application and forwards it. The contrib image
# rather than core: core omits several exporters, including the one used
# here, and fails at start-up with an unhelpful "unknown type" error.
otel-collector:
image: otel/opentelemetry-collector-contrib:0.145.0
container_name: otel-collector
command: ["--config=/etc/otel-collector-config.yaml"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml:ro
ports:
- "4318:4318" # OTLP/HTTP — what the app exports to
- "4317:4317" # OTLP/gRPC
- "8889:8889" # collector's own metrics, scraped by Prometheus
- "13133:13133" # health check extension
depends_on:
- jaeger
restart: unless-stopped
# Trace storage and UI. In-memory storage is deliberate: traces are for the
# live demonstration, and persisting them would mean another volume and
# another thing to run out of disk on the EC2 box.
jaeger:
image: jaegertracing/jaeger:2.14.0
container_name: jaeger
ports:
- "16686:16686" # Jaeger UI
restart: unless-stopped
prometheus:
image: prom/prometheus:v3.9.1
container_name: prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.retention.time=6h"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
depends_on:
- rss-server
restart: unless-stopped
volumes:
rss-data: