Skip to content

Instantly share code, notes, and snippets.

@geoHeil
Last active July 14, 2022 07:32
Show Gist options
  • Save geoHeil/4b4bbe17d0dafd5ca8ebc2c611fdff0d to your computer and use it in GitHub Desktop.
Save geoHeil/4b4bbe17d0dafd5ca8ebc2c611fdff0d to your computer and use it in GitHub Desktop.
readpanda materialize automated CI setup with user auth
version: '3.7'
# based on
# 1. https://redpandacommunity.slack.com/archives/C01AJDUT88N/p1657529113002319?thread_ts=1657527079.070669&cid=C01AJDUT88N
# 2. https://redpandacommunity.slack.com/archives/C01AJDUT88N/p1652213796745369?thread_ts=1652195821.668589&cid=C01AJDUT88N
services:
redpanda:
image: docker.vectorized.io/vectorized/redpanda:v22.1.4
container_name: redpanda
hostname: redpanda
command:
- redpanda start
- --overprovisioned
- --smp 1
- --memory 1G
- --reserve-memory 0M
- --node-id 0
- --check=false
- --kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092
- --advertise-kafka-addr PLAINTEXT://redpanda:29092,OUTSIDE://127.0.0.1:9092
- --pandaproxy-addr 0.0.0.0:8082
- --advertise-pandaproxy-addr redpanda:8082
- --set redpanda.enable_transactions=true
- --set redpanda.enable_idempotence=true
- --set redpanda.auto_create_topics_enabled=true
- --set redpanda.cluster_id=redpanda
- --set schema_registry_client.sasl_mechanism=SCRAM-SHA-256
- --set schema_registry_client.scram_username=admin
- --set schema_registry_client.scram_password=rp123
- '--set schema_registry_client.brokers={"address":"redpanda","port":29092}'
- --set pandaproxy_client.sasl_mechanism=SCRAM-SHA-256
- --set pandaproxy_client.scram_username=admin
- --set pandaproxy_client.scram_password=rp123
- '--set pandaproxy_client.brokers={"address":"redpanda","port":29092}'
- '--set redpanda.kafka_api_tls={"name":"OUTSIDE","enabled":true,"cert_file":"/cert.pem","key_file":"/key.pem"}'
# - '--set redpanda.admin_api_tls={"name":"OUTSIDE","enabled":true,"cert_file":"/cert.pem","key_file":"/key.pem"}'
volumes:
- ./certs/node.crt:/cert.pem
- ./certs/node.key:/key.pem
ports:
- 9092:9092
- 8081:8081
- 8082:8082
- 9644:9644
- 29092:29092
networks:
- streaming_network
#expose:
# - 29092 # redpanda
# - 8081 # schema-registry
# - 8082 # restproxy
healthcheck: { test: curl -f localhost:9644/v1/status/ready, interval: 1s, start_period: 30s }
kafka-create-topics:
image: docker.vectorized.io/vectorized/redpanda:v22.1.4
entrypoint: []
networks:
- streaming_network
depends_on:
- redpanda
command: "sh -c 'echo Waiting for Kafka to be ready... && \
while ! rpk cluster health -e --api-urls redpanda:9644; \
do sleep 1; done && \
rpk topic create my_topic1 --brokers redpanda:29092 -p 3 -r 1 && \
rpk topic create my_topic2 --brokers redpanda:29092 -p 3 -r 1 && \
rpk acl user create admin -p rp123 --sasl-mechanism 'SCRAM-SHA-256' --api-urls redpanda:9644 && \
rpk cluster config set superusers ['admin'] --api-urls redpanda:9644 && \
rpk cluster config set enable_sasl true --api-urls redpanda:9644 && \
echo FINISH'"
# TODO put test data into topics
materialized:
image: materialize/materialized:v0.26.4
container_name: materialized
hostname: materialized
command: -w1
networks:
- streaming_network
volumes:
- ./certs/ca.crt:/etc/ssl/certs/ca-certificates.crt
ports:
- 6875:6875
environment:
MZ_LOG_FILTER: WARN
networks:
streaming_network:
driver: bridge
name: streaming_network