-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
186 lines (176 loc) · 6.42 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
186 lines (176 loc) · 6.42 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
# Endpoints on localhost (host ports are offset from the in-container ports
# to avoid clashing with a Prometheus/VM/Grafana stack already bound to the
# conventional ports on the dev host):
# VictoriaMetrics :8429 (-> container :8428)
# Prometheus :9080 (-> container :9090)
# node-exporter :9100
# forecaster :9081 (-> container :9091; /metrics, /healthz, /-/reload)
# Redis :6378 (-> container :6379; query-cache backend; HA isn't
# wired in compose since leader election needs a
# kube API server)
# Grafana :3001 (-> container :3000; admin / admin) — "load" profile only
#
# Two profiles:
# default (`make dev-up`) — VM, Prometheus, Redis, node-exporter,
# forecaster. Minimum for forecaster
# development.
# load (`make dev-up-load`) — adds http-demo, http-demo-loadgen,
# Grafana. Full demo experience.
name: promforecast-dev
services:
victoriametrics:
image: victoriametrics/victoria-metrics:v1.142.0
container_name: pf-victoriametrics
command:
- "--storageDataPath=/storage"
- "--httpListenAddr=:8428"
- "--retentionPeriod=30d"
- "--futureRetention=2d"
# Deduplicate samples sharing a (series, timestamp). The remote_write
# sink rewrites the full forecast curve every refit, so each future
# step is re-emitted by ~horizon/refresh successive runs (here 30m/5m
# ≈ 6x) at the *same* grid timestamp with an updated value. The sink's
# documented contract is last-write-wins per (labels, timestamp) (see
# docs/operations/backfill.md); VictoriaMetrics only honours that when
# dedup is enabled, otherwise the overwrites pile up as raw duplicate
# samples and inflate count_over_time. 15s matches the Prometheus
# scrape_interval in docker/prometheus.yml so raw 15s resolution on the
# underlying signals is preserved while the curve overwrites collapse.
- "--dedup.minScrapeInterval=15s"
ports:
- "8429:8428"
volumes:
- vm-data:/storage
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 5s
timeout: 3s
retries: 20
restart: unless-stopped
http-demo:
# Tiny FastAPI app with a handful of endpoints + /metrics. Driven by
# the loadgen below so the forecaster has http_* time series to fit on.
# Behind the "load" profile so `make dev-up` (minimum dev stack)
# doesn't start it; `make dev-up-load` does.
profiles: ["load"]
build:
context: ./docker/http-demo
dockerfile: Dockerfile.app
image: promforecast-http-demo:dev
container_name: pf-http-demo
ports:
- "8001:8000"
restart: unless-stopped
http-demo-loadgen:
# ~20-30 req/min with a slow sinusoidal modulation so the rate has shape.
# Same profile as http-demo since one without the other is useless.
profiles: ["load"]
build:
context: ./docker/http-demo
dockerfile: Dockerfile.loadgen
image: promforecast-http-demo-loadgen:dev
container_name: pf-http-demo-loadgen
environment:
TARGET: http://http-demo:8000
BASE_RPM: "25"
AMPLITUDE_RPM: "15"
PERIOD_SECONDS: "600"
depends_on:
- http-demo
restart: unless-stopped
node-exporter:
image: prom/node-exporter:v1.11.1
container_name: pf-node-exporter
command:
- "--path.procfs=/host/proc"
- "--path.sysfs=/host/sys"
- "--path.rootfs=/rootfs"
- "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
pid: host
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
ports:
- "9100:9100"
restart: unless-stopped
redis:
# Lets the dev forecaster exercise the Redis-backed query cache path
# against a real backend instead of in-memory only. HA mode (leader
# election) needs a Kubernetes API server, which docker-compose does
# not provide — so the snapshot cache stays unused here. The query
# cache validates fine in single-replica mode.
image: redis:7-alpine
container_name: pf-redis
command: ["redis-server", "--save", "", "--appendonly", "no"]
ports:
- "6378:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
restart: unless-stopped
prometheus:
image: prom/prometheus:v3.11.3
container_name: pf-prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=2h"
- "--web.enable-lifecycle"
ports:
- "9080:9090"
volumes:
- ./docker/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prom-data:/prometheus
depends_on:
victoriametrics:
condition: service_healthy
restart: unless-stopped
forecaster:
build:
context: ./forecaster
image: promforecast:dev
container_name: pf-forecaster
command: ["--config", "/etc/promforecast/config.yaml"]
ports:
- "9081:9091"
volumes:
# Dev-tuned config: short lookback / step / min_points so the first fit
# happens minutes after `make dev-up` instead of needing days of data.
# examples/configs/* are production-grade and require a long-running TSDB.
- ./docker/dev-config.yaml:/etc/promforecast/config.yaml:ro
depends_on:
victoriametrics:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
grafana:
# Grafana is in the "load" profile because the bundled dashboards are
# tied to the http-demo data; a minimum `make dev-up` for forecaster
# development doesn't need it. `make dev-up-load` brings it up.
profiles: ["load"]
image: grafana/grafana:13.0.1
container_name: pf-grafana
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
GF_USERS_DEFAULT_THEME: dark
ports:
- "3001:3000"
volumes:
- ./docker/grafana/provisioning:/etc/grafana/provisioning:ro
- ./dashboards/grafana:/etc/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
depends_on:
- victoriametrics
- prometheus
restart: unless-stopped
volumes:
vm-data:
prom-data:
grafana-data: