commit 81a43bfd08b8e3c1312ca344fe366ad8f6377f7f Author: Reinaldy Rafli Date: Thu Apr 13 08:13:24 2023 +0700 initailize diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0745ab4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Reinaldy Rafli + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..54eb63b --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Local Redpanda Cluster with Docker Compose + +Sets up a local Redpanda cluster with 3 nodes. + +To run it: + +```bash +docker compose up -d +``` + +There is no authentication. + +Connect to Kafka with `KAFKA_BROKERS` set to `rp1:9092,rp2:9093,rp3:9094`. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a7dc829 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,103 @@ +services: + rp1: + image: docker.redpanda.com/vectorized/redpanda:v22.2.2 + restart: on-failure:10 + ports: + - 9092:9092 + command: + - redpanda start + - --smp 1 + - --memory 1G + - --reserve-memory 0M + - --overprovisioned + - --node-id 0 + - --check=false + - --pandaproxy-addr PLAINTEXT://0.0.0.0:28082,OUTSIDE://0.0.0.0:8082 + - --advertise-pandaproxy-addr PLAINTEXT://rp1:28082,OUTSIDE://rp1:8082 + - --kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 + - --advertise-kafka-addr PLAINTEXT://rp1:29092,OUTSIDE://rp1:9092 + - --rpc-addr 0.0.0.0:33145 + - --advertise-rpc-addr rp1:33145 + volumes: + - rp1data:/var/lib/redpanda/data + healthcheck: + test: [ "CMD", "rpk", "cluster", "health" ] + interval: 30s + timeout: 5s + retries: 3 + start_period: 30s + + rp2: + image: docker.redpanda.com/vectorized/redpanda:v22.2.2 + restart: on-failure:10 + ports: + - 9093:9092 + command: + - redpanda start + - --smp 1 + - --memory 1G + - --reserve-memory 0M + - --overprovisioned + - --node-id 0 + - --check=false + - --pandaproxy-addr PLAINTEXT://0.0.0.0:28082,OUTSIDE://0.0.0.0:8082 + - --advertise-pandaproxy-addr PLAINTEXT://rp2:28082,OUTSIDE://rp2:8082 + - --kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 + - --advertise-kafka-addr PLAINTEXT://rp2:29092,OUTSIDE://rp2:9092 + - --rpc-addr 0.0.0.0:33145 + - --advertise-rpc-addr rp2:33145 + - --seeds rp1:33145 + volumes: + - rp2data:/var/lib/redpanda/data + healthcheck: + test: [ "CMD", "rpk", "cluster", "health" ] + interval: 30s + timeout: 5s + retries: 3 + start_period: 30s + depends_on: + rp1: + condition: service_healthy + + rp3: + image: docker.redpanda.com/vectorized/redpanda:v22.2.2 + restart: on-failure:10 + ports: + - 9094:9092 + command: + - redpanda start + - --smp 1 + - --memory 1G + - --reserve-memory 0M + - --overprovisioned + - --node-id 0 + - --check=false + - --pandaproxy-addr PLAINTEXT://0.0.0.0:28082,OUTSIDE://0.0.0.0:8082 + - --advertise-pandaproxy-addr PLAINTEXT://rp3:28082,OUTSIDE://rp3:8082 + - --kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092 + - --advertise-kafka-addr PLAINTEXT://rp3:29092,OUTSIDE://rp3:9092 + - --rpc-addr 0.0.0.0:33145 + - --advertise-rpc-addr rp3:33145 + - --seeds rp1:33145,rp2:33145 + volumes: + - rp3data:/var/lib/redpanda/data + healthcheck: + test: [ "CMD", "rpk", "cluster", "health" ] + interval: 30s + timeout: 5s + retries: 3 + start_period: 30s + depends_on: + rp1: + condition: service_healthy + + # This is for viewing the Redpanda topics and the contents within it. + kafka-console: + image: docker.redpanda.com/vectorized/console:latest + environment: + KAFKA_BROKERS: rp1:29092,rp2:29092,rp3:29092 + ports: + - 8080:8080 + depends_on: + kafka: + condition: service_healthy \ No newline at end of file