services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: app
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
command:
- postgres
- -c
- wal_level=logical
- -c
- max_replication_slots=16
- -c
- max_wal_senders=16
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d app"]
interval: 5s
timeout: 3s
retries: 20
ports:
- "5432:5432"
volumes:
- ./docker/initdb/01_cdc_setup.sql:/docker-entrypoint-initdb.d/01_cdc_setup.sql:ro
cdc-rs:
build:
context: .
dockerfile: Dockerfile
depends_on:
postgres:
condition: service_healthy
environment:
CDC_RS_HOST: postgres
CDC_RS_PORT: "5432"
CDC_RS_USER: postgres
CDC_RS_PASSWORD: postgres
CDC_RS_DB: app
CDC_RS_SLOT: cdc_rs_example_slot
CDC_RS_PUBLICATION: cdc_rs_example_pub
CDC_RS_SNAPSHOT_TABLES: public.users
CDC_RS_CHECKPOINT_DIR: /var/lib/cdc-rs/checkpoints
RUST_LOG: info
volumes:
- cdc-rs-checkpoints:/var/lib/cdc-rs/checkpoints
volumes:
cdc-rs-checkpoints: