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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: rivet
POSTGRES_PASSWORD: rivet
POSTGRES_DB: rivet
ports:
- "5432:5432"
volumes:
- ./dev/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
# ---- Rivet state backend (RIVET_STATE_URL) -----------------------------------
# Separate from the source `postgres` service so state is never mixed with
# the data being extracted. Connect with:
# RIVET_STATE_URL=postgresql://rivet:rivet@localhost:5433/rivet_state
postgres-state:
image: postgres:16
environment:
POSTGRES_USER: rivet
POSTGRES_PASSWORD: rivet
POSTGRES_DB: rivet_state
ports:
- "5433:5432"
volumes:
- postgres_state_data:/var/lib/postgresql/data
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
# ---- Legacy Postgres versions (compatibility testing) ---------------------
# Opt in via `docker compose --profile legacy up -d`. Each listens on a
# non-default port so they coexist with the primary `postgres` service.
# The same `init.sql` is used — it intentionally avoids features newer than
# Postgres 11 so every supported version can run it.
postgres-12:
image: postgres:12
profiles:
environment:
POSTGRES_USER: rivet
POSTGRES_PASSWORD: rivet
POSTGRES_DB: rivet
ports:
- "5412:5432"
volumes:
- ./dev/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
postgres-13:
image: postgres:13
profiles:
environment:
POSTGRES_USER: rivet
POSTGRES_PASSWORD: rivet
POSTGRES_DB: rivet
ports:
- "5413:5432"
volumes:
- ./dev/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
postgres-14:
image: postgres:14
profiles:
environment:
POSTGRES_USER: rivet
POSTGRES_PASSWORD: rivet
POSTGRES_DB: rivet
ports:
- "5414:5432"
volumes:
- ./dev/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
postgres-15:
image: postgres:15
profiles:
environment:
POSTGRES_USER: rivet
POSTGRES_PASSWORD: rivet
POSTGRES_DB: rivet
ports:
- "5415:5432"
volumes:
- ./dev/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
mysql:
image: mysql:8.0
# `mysql_native_password` is required so the `pool` profile's ProxySQL
# service can authenticate to MySQL as `rivet`. ProxySQL 2.5 talks to
# backend MySQL over plain TCP, where MySQL 8's default
# `caching_sha2_password` requires either TLS or an RSA key exchange that
# the backend connection path does not perform. The rust `mysql` driver
# used by direct tests handles both plugins, so this only affects auth
# — query semantics, performance, and tuning are unchanged.
command:
- "--default-authentication-plugin=mysql_native_password"
environment:
MYSQL_ROOT_PASSWORD: rivet
MYSQL_USER: rivet
MYSQL_PASSWORD: rivet
MYSQL_DATABASE: rivet
ports:
- "3306:3306"
volumes:
- ./dev/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
# ---- SQL Server -----------------------------------------------------------
# MSSQL source engine (tiberius driver). This image has no
# /docker-entrypoint-initdb.d hook, so the `rivet` database + fixture are
# seeded after the container is healthy via `dev/mssql/init.sql`
# (`make seed-mssql` / the live-test harness pipes it through sqlcmd).
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "Rivet_Passw0rd!"
MSSQL_PID: Developer
ports:
- "1433:1433"
healthcheck:
# sqlcmd lives at tools18 on the 2022 image; `-C` trusts the self-signed
# server cert the container generates on first boot.
test:
interval: 10s
timeout: 5s
retries: 20
# ---- CDC-configured source engines (cdc profile) --------------------------
# Dedicated instances carrying the server-side config change data capture
# needs — logical WAL (PostgreSQL), a REPLICATION grant (MySQL), the SQL
# Server Agent (the capture job) — kept SEPARATE from the shared source
# services so those CDC settings never touch the batch tests. Ports are the
# shared port + 1: PostgreSQL 5434, MySQL 3307, SQL Server 1434. Brought up
# with `docker compose --profile cdc up -d postgres-cdc mysql-cdc mssql-cdc`.
postgres-cdc:
image: postgres:16
profiles:
command:
environment:
POSTGRES_USER: rivet
POSTGRES_PASSWORD: rivet
POSTGRES_DB: rivet
ports:
- "5434:5432"
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
mysql-cdc:
image: mysql:8.0
profiles:
# binlog is ON by default in MySQL 8 (ROW format); set a server id and grant
# the REPLICATION privileges the binlog dump (`COM_BINLOG_DUMP`) needs.
command:
- "--default-authentication-plugin=mysql_native_password"
- "--server-id=1"
- "--log-bin=binlog"
- "--binlog-format=ROW"
environment:
MYSQL_ROOT_PASSWORD: rivet
MYSQL_USER: rivet
MYSQL_PASSWORD: rivet
MYSQL_DATABASE: rivet
ports:
- "3307:3306"
volumes:
- ./dev/cdc/mysql-grant.sql:/docker-entrypoint-initdb.d/grant.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
mssql-cdc:
image: mcr.microsoft.com/mssql/server:2022-latest
profiles:
# The Agent runs the CDC capture job that populates the change tables.
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "Rivet_Passw0rd!"
MSSQL_PID: Developer
MSSQL_AGENT_ENABLED: "true"
ports:
- "1434:1433"
healthcheck:
test:
interval: 10s
timeout: 5s
retries: 20
# ---- MySQL primary → replica (replica profile) ----------------------------
# Proves CDC can read a *replica's* binlog (the "no master access" case): the
# replica re-logs replicated changes into its own binlog via log_replica_updates,
# and rivet reads that. The test wires up replication at runtime (CHANGE
# REPLICATION SOURCE / START REPLICA). GTID so SOURCE_AUTO_POSITION=1 needs no
# manual coordinates. Ports: primary 3308, replica 3309.
mysql-primary:
image: mysql:8.0
profiles:
command:
- "--default-authentication-plugin=mysql_native_password"
- "--server-id=10"
- "--log-bin=binlog"
- "--binlog-format=ROW"
- "--gtid-mode=ON"
- "--enforce-gtid-consistency=ON"
environment:
MYSQL_ROOT_PASSWORD: rivet
MYSQL_USER: rivet
MYSQL_PASSWORD: rivet
MYSQL_DATABASE: rivet
ports:
- "3308:3306"
volumes:
- ./dev/cdc/replica-primary-init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
mysql-replica:
image: mysql:8.0
profiles:
command:
- "--default-authentication-plugin=mysql_native_password"
- "--server-id=11"
- "--log-bin=binlog"
- "--binlog-format=ROW"
- "--log-replica-updates=ON" # re-log replicated changes into the replica's own binlog
- "--gtid-mode=ON"
- "--enforce-gtid-consistency=ON"
environment:
MYSQL_ROOT_PASSWORD: rivet
MYSQL_USER: rivet
MYSQL_PASSWORD: rivet
MYSQL_DATABASE: rivet
ports:
- "3309:3306"
volumes:
- ./dev/cdc/replica-grant.sql:/docker-entrypoint-initdb.d/grant.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
# ---- Legacy MySQL ---------------------------------------------------------
# MySQL 5.7 is EOL (Oct 2023) but still widely deployed. Use mysql_native_password
# as the default auth plugin so older clients (and the `mysql` Rust crate's
# pre-caching-sha2 path) connect without tweaks. Listens on 3357.
mysql-57:
image: mysql:5.7
profiles:
# MySQL 5.7 has no official arm64 image; run it under x86_64 emulation on
# Apple Silicon hosts. Native amd64 hosts ignore this field.
platform: linux/amd64
command:
- "--default-authentication-plugin=mysql_native_password"
- "--max-allowed-packet=67108864"
environment:
MYSQL_ROOT_PASSWORD: rivet
MYSQL_USER: rivet
MYSQL_PASSWORD: rivet
MYSQL_DATABASE: rivet
ports:
- "3357:3306"
volumes:
# Dedicated 5.7 init that skips MySQL 8-only features (window functions
# in `orders_sparse_for_export`). See dev/mysql/init_57.sql.
- ./dev/mysql/init_57.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 10
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "9000:9000"
- "9001:9001"
# GCS JSON API emulator (OpenDAL uses /storage/v1/... under this base URL).
fake-gcs:
image: fsouza/fake-gcs-server:latest
ports:
- "4443:4443"
command:
- "-scheme"
- "http"
- "-host"
- "0.0.0.0"
- "-port"
- "4443"
# Azure Blob Storage emulator. Uses the well-known dev account
# (devstoreaccount1) + key; the blob endpoint is
# http://127.0.0.1:10000/devstoreaccount1. `--skipApiVersionCheck` keeps it
# tolerant of the OpenDAL/azure REST version rivet sends.
azurite:
image: mcr.microsoft.com/azure-storage/azurite:latest
command:
- "azurite-blob"
- "--blobHost"
- "0.0.0.0"
- "--blobPort"
- "10000"
- "--skipApiVersionCheck"
ports:
- "10000:10000"
# --- Monitoring stack (Postgres metrics under load) ---
postgres-exporter:
image: prometheuscommunity/postgres-exporter:latest
environment:
DATA_SOURCE_NAME: "postgresql://rivet:rivet@postgres:5432/rivet?sslmode=disable"
ports:
- "9187:9187"
depends_on:
- postgres
prometheus:
image: prom/prometheus:latest
volumes:
- ./dev/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
depends_on:
- postgres-exporter
grafana:
image: grafana/grafana:latest
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
volumes:
- ./dev/grafana/provisioning:/etc/grafana/provisioning:ro
- ./dev/grafana/dashboards:/var/lib/grafana/dashboards:ro
ports:
- "3000:3000"
depends_on:
- prometheus
# Toxiproxy — network fault injection proxy for retry/resilience testing.
# Postgres is proxied on port 15432; MySQL on port 13306.
# ---- pgBouncer (pool safety tests) ----------------------------------------
# Transaction-mode pooler with pool_size=1 so the same physical connection
# is always reused — makes session-state leak tests deterministic.
# Opt in: docker compose --profile pool up -d pgbouncer
pgbouncer:
# edoburu/pgbouncer is the working community image after bitnami yanked
# `bitnami/pgbouncer:latest` (manifest unknown upstream as of 2026-05).
image: edoburu/pgbouncer:latest
profiles:
environment:
DATABASE_URL: "postgres://rivet:rivet@postgres:5432/rivet"
POOL_MODE: transaction
DEFAULT_POOL_SIZE: 1
MAX_CLIENT_CONN: 50
AUTH_TYPE: plain
LISTEN_PORT: 6432
ports:
- "6432:6432"
depends_on:
postgres:
condition: service_healthy
healthcheck:
# edoburu image does not bundle pg_isready; use a raw TCP connect.
test:
interval: 5s
timeout: 3s
retries: 10
# ---- ProxySQL (MySQL pool safety + multiplexing detection tests) ---------
# Single-backend ProxySQL configured to forward to `mysql:3306`. The
# docker-entry config sets up:
# - one backend server (`mysql:3306`, hostgroup 0)
# - one mysql_users row for `rivet/rivet` mapped to hostgroup 0
# - admin user proxysql/admin on the admin interface (port 6032)
# so a `mysql -h 127.0.0.1 -P 6033 -urivet -privet` session reaches MySQL.
#
# Opt in: `docker compose --profile pool up -d proxysql`
# The mysql:3306 service is depends_on so it must already exist (it is the
# default profile, started by `docker compose up -d mysql`).
proxysql:
image: proxysql/proxysql:2.5.5
profiles:
ports:
# 6033: client-facing MySQL protocol port; 6032: ProxySQL admin SQL.
- "6033:6033"
- "6032:6032"
depends_on:
mysql:
condition: service_healthy
volumes:
- ./dev/proxysql/proxysql.cnf:/etc/proxysql.cnf:ro
healthcheck:
# Wait for the client-facing 6033 port to accept connections. ProxySQL's
# admin port (6032) comes up first; using 6033 ensures backend wiring is
# in place before tests dial in.
test:
interval: 5s
timeout: 3s
retries: 20
toxiproxy:
image: ghcr.io/shopify/toxiproxy:latest
ports:
- "8474:8474" # HTTP API
- "15432:15432" # proxied Postgres
- "13306:13306" # proxied MySQL
depends_on:
- postgres
- mysql
# ---- DuckDB & ClickHouse — Parquet validators (ADR-0014) ─────────────────
# These two services are kept running so live type-roundtrip tests can pipe
# the *same* Parquet artifact through two independent readers and assert
# round-trip on values + Parquet-level type semantics (decimals, JSON, UUID,
# tz-aware timestamps, binary, lists). They are not productive components —
# they are oracles for the Rivet → Parquet layer.
#
# Shared bind mount `./tests/.live-tmp` is the handoff: Rivet tests write a
# Parquet file there from the host, then `docker exec` reads it inside the
# container at the same path under `/work`.
duckdb:
image: python:3.12-slim
# Holds a `duckdb` Python install — talked to via `docker exec rivet-duckdb
# python -c "..."`. No port is published; tests reach it through `docker
# exec`, not over TCP.
entrypoint:
- bash
- -lc
# `pytz` is required by the duckdb Python adapter to materialise
# TIMESTAMP WITH TIME ZONE values — without it, every `SELECT *` over
# a Parquet with a tz-aware timestamp column raises ModuleNotFoundError.
# `pyarrow` is the third independent Parquet reader used by tests
# (alongside duckdb and clickhouse) — it is the reference Arrow
# implementation, so it sees field metadata and statistics exactly
# the way we wrote them.
- "pip install --quiet --disable-pip-version-check \
duckdb==1.4.1 pytz==2024.1 pyarrow==18.1.0 && \
python -c 'import duckdb, pytz, pyarrow; print(\"duckdb\", duckdb.__version__, \"pyarrow\", pyarrow.__version__)' && \
exec tail -f /dev/null"
container_name: rivet-duckdb
init: true
volumes:
- ./tests/.live-tmp:/work
healthcheck:
# Healthy once the python `duckdb` module imports — pip install finished.
test:
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
clickhouse:
image: clickhouse/clickhouse-server:24.8
container_name: rivet-clickhouse
# `ulimits` are required by the official image at runtime.
ulimits:
nofile:
soft: 262144
hard: 262144
environment:
CLICKHOUSE_USER: rivet
CLICKHOUSE_PASSWORD: rivet
CLICKHOUSE_DB: rivet
ports:
# MinIO already publishes 9000 (S3) and 9001 (console), so the ClickHouse
# native protocol is exposed on 9002 to avoid collisions. Tests use the
# HTTP interface on 8123 anyway.
- "8123:8123"
- "9002:9000"
volumes:
- ./tests/.live-tmp:/work
# Allow the `file()` table function to read Parquet from /work — by
# default ClickHouse only trusts /var/lib/clickhouse/user_files.
- ./dev/clickhouse/user_files.xml:/etc/clickhouse-server/config.d/user_files.xml:ro
healthcheck:
test:
interval: 5s
timeout: 3s
retries: 30
start_period: 15s
volumes:
postgres_state_data: