127 lines
3.4 KiB
YAML
127 lines
3.4 KiB
YAML
services:
|
|
nats:
|
|
image: nats:2.10-alpine
|
|
container_name: nats_server
|
|
command: ["-js"]
|
|
ports:
|
|
- "4222:4222"
|
|
- "8222:8222"
|
|
|
|
postgres:
|
|
image: postgres:16
|
|
container_name: postgres
|
|
environment:
|
|
POSTGRES_USER: test
|
|
POSTGRES_PASSWORD: test
|
|
POSTGRES_DB: test
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./misc/postgres/init-replication.sh:/docker-entrypoint-initdb.d/init-replication.sh
|
|
command:
|
|
- "postgres"
|
|
- "-c"
|
|
- "wal_level=logical"
|
|
- "-c"
|
|
- "max_wal_senders=4"
|
|
- "-c"
|
|
- "hot_standby=on"
|
|
- "-c"
|
|
- "wal_writer_delay=10ms"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U test -d test"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Test/Demo-only setup. NOT suitable for production use.
|
|
# The replica wipes its data on every restart (pg_basebackup from primary).
|
|
postgres-replica:
|
|
image: postgres:16
|
|
container_name: postgres_replica
|
|
environment:
|
|
POSTGRES_USER: test
|
|
POSTGRES_PASSWORD: test
|
|
ports:
|
|
- "5433:5432"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
entrypoint: |
|
|
bash -c '
|
|
# Test/Demo only: wipe and re-basebackup on every restart.
|
|
# In production, use persistent volumes and proper replica management.
|
|
rm -rf /var/lib/postgresql/data/*
|
|
until pg_isready -h postgres -U test; do sleep 1; done
|
|
chown postgres:postgres /var/lib/postgresql/data
|
|
chmod 700 /var/lib/postgresql/data
|
|
gosu postgres pg_basebackup -h postgres -U test -D /var/lib/postgresql/data -Fp -Xs -R
|
|
exec gosu postgres postgres
|
|
'
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U test -d test"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
google-pubsub-emulator:
|
|
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:572.0.0-emulators
|
|
command: gcloud beta emulators pubsub start --host-port=0.0.0.0:8085
|
|
ports:
|
|
- "8085:8085"
|
|
|
|
aws-localstack:
|
|
image: localstack/localstack:4.14
|
|
container_name: localstack
|
|
ports:
|
|
- "4566:4566" # Edge port for all services.
|
|
environment:
|
|
- SERVICES=sqs,sns
|
|
- DEFAULT_REGION=us-east-1
|
|
- DATA_DIR=/tmp/localstack/data
|
|
|
|
redpanda:
|
|
image: redpandadata/redpanda:latest
|
|
container_name: redpanda
|
|
ports:
|
|
- "29092:29092"
|
|
- "9644:9644" # Admin API
|
|
command:
|
|
- redpanda start
|
|
- --smp 1
|
|
- --memory 1G
|
|
- --overprovisioned
|
|
- --node-id 0
|
|
- --check=false
|
|
- --kafka-addr PLAINTEXT://0.0.0.0:29092
|
|
- --advertise-kafka-addr PLAINTEXT://localhost:29092
|
|
healthcheck:
|
|
test: ["CMD", "rpk", "cluster", "info"]
|
|
interval: 2s
|
|
timeout: 5s
|
|
retries: 10
|
|
profiles: ["redpanda"]
|
|
|
|
kafka:
|
|
image: confluentinc/cp-kafka:8.0.0
|
|
ports:
|
|
- "29092:29092"
|
|
environment:
|
|
KAFKA_NODE_ID: 1
|
|
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,CONTROLLER://kafka:9093
|
|
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:29092
|
|
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
|
|
KAFKA_PROCESS_ROLES: broker,controller
|
|
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
|
|
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
|
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
|
CLUSTER_ID: centrifugo-kafka
|
|
|
|
redis:
|
|
image: redis:${REDIS_VERSION:-7}-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
|
|
volumes:
|
|
postgres_data: |