Skip to content

Instantly share code, notes, and snippets.

@baskeboler
Last active March 23, 2026 14:04
Show Gist options
  • Select an option

  • Save baskeboler/0f91daaf0db261014ec895b672b1bd86 to your computer and use it in GitHub Desktop.

Select an option

Save baskeboler/0f91daaf0db261014ec895b672b1bd86 to your computer and use it in GitHub Desktop.
xtdb docker compose deployment with kafka txn log and minio storage for dev environments
services:
minio:
image: minio/minio:latest
command: server /data --console-address :9001
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadminpassword
MINIO_DOMAIN: minio
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_data:/data
networks:
default:
aliases:
- xtdb-storage.minio
minio-init:
image: minio/mc:latest
depends_on:
- minio
restart: "no"
entrypoint:
- /bin/sh
- -ec
command:
- |
until mc alias set local http://minio:9000 minioadmin minioadminpassword; do
sleep 2
done
mc mb --ignore-existing local/xtdb-storage
kafka:
image: apache/kafka:latest
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: PLAINTEXT://:29092,PLAINTEXT_HOST://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_NUM_PARTITIONS: 1
KAFKA_LOG_DIRS: /var/lib/kafka/data
ports:
- "9092:9092"
volumes:
- kafka_data:/var/lib/kafka/data
kafka-init:
image: apache/kafka:latest
depends_on:
- kafka
restart: "no"
entrypoint:
- /bin/sh
- -ec
command:
- |
until /opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:29092 --list >/dev/null 2>&1; do
sleep 2
done
/opt/kafka/bin/kafka-topics.sh \
--bootstrap-server kafka:29092 \
--create \
--if-not-exists \
--topic xtdb-log \
--partitions 1 \
--replication-factor 1 \
--config cleanup.policy=delete \
--config message.timestamp.type=LogAppendTime \
--config retention.ms=86400000
xtdb:
image: ghcr.io/xtdb/xtdb-aws:2.0.0
depends_on:
minio-init:
condition: service_completed_successfully
kafka-init:
condition: service_completed_successfully
command:
- -f
- /etc/xtdb/xtdb.yaml
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:29092
XTDB_LOG_TOPIC: xtdb-log
XTDB_S3_BUCKET: xtdb-storage
XTDB_S3_PREFIX: xtdb-dev
XTDB_S3_ENDPOINT: http://minio:9000
XTDB_NODE_ID: xtdb-dev-1
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadminpassword
AWS_REGION: us-east-1
AWS_S3_FORCE_PATH_STYLE: "true"
ports:
- "15432:5432"
- "8080:8080"
volumes:
- ./xtdb.yaml:/etc/xtdb/xtdb.yaml:ro
- xtdb_cache:/var/cache/xtdb/object-store
volumes:
minio_data:
kafka_data:
xtdb_cache:
server:
port: 5432
healthz:
port: 8080
log: !Kafka
bootstrapServers: !Env KAFKA_BOOTSTRAP_SERVERS
topic: !Env XTDB_LOG_TOPIC
autoCreateTopic: false
storage: !Remote
objectStore: !S3
bucket: !Env XTDB_S3_BUCKET
prefix: !Env XTDB_S3_PREFIX
endpoint: !Env XTDB_S3_ENDPOINT
localDiskCache: /var/cache/xtdb/object-store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment