version: '3.7'
services:
  # Redpanda cluster
  redpanda-1:
    image: docker.redpanda.com/redpandadata/redpanda:v23.3.10
    container_name: redpanda-1
    command:
      - redpanda start
      - --smp 1
      - --overprovisioned
      - --node-id 1
      - --kafka-addr PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092
      - --advertise-kafka-addr PLAINTEXT://redpanda-1:29092,OUTSIDE://localhost:9092
      - --pandaproxy-addr PLAINTEXT://0.0.0.0:28082,OUTSIDE://0.0.0.0:8082
      - --advertise-pandaproxy-addr PLAINTEXT://redpanda-1:28082,OUTSIDE://localhost:8082
      - --rpc-addr 0.0.0.0:33145
      - --advertise-rpc-addr redpanda-1:33145
    ports:
      # - 8081:8081
      - 8082:8082
      - 9092:9092
      - 9644:9644
      - 28082:28082
      - 29092:29092
    volumes:
      - ./etc/redpanda/.bootstrap.yaml:/etc/redpanda/.bootstrap.yaml

  redpanda-2:
    image: docker.redpanda.com/redpandadata/redpanda:v23.3.10
    container_name: redpanda-2
    command:
      - redpanda start
      - --smp 1
      - --overprovisioned
      - --node-id 2
      - --seeds redpanda-1:33145
      - --kafka-addr PLAINTEXT://0.0.0.0:29093,OUTSIDE://0.0.0.0:9093
      - --advertise-kafka-addr PLAINTEXT://redpanda-2:29093,OUTSIDE://localhost:9093
      - --pandaproxy-addr PLAINTEXT://0.0.0.0:28083,OUTSIDE://0.0.0.0:8083
      - --advertise-pandaproxy-addr PLAINTEXT://redpanda-2:28083,OUTSIDE://localhost:8083
      - --rpc-addr 0.0.0.0:33146
      - --advertise-rpc-addr redpanda-2:33146
    ports:
      - 8083:8083
      - 9093:9093
    volumes:
      - ./etc/redpanda/.bootstrap.yaml:/etc/redpanda/.bootstrap.yaml

  redpanda-console:
    image: docker.redpanda.com/redpandadata/console:v2.4.5
    container_name: redpanda-console
    entrypoint: /bin/sh
    command: -c "echo \"$$CONSOLE_CONFIG_FILE\" > /tmp/config.yml; /app/console"
    environment:
      CONFIG_FILEPATH: /tmp/config.yml
      CONSOLE_CONFIG_FILE: |
        kafka:
          brokers: ["redpanda-1:29092"]
          schemaRegistry:
            enabled: false
        redpanda:
          adminApi:
            enabled: true
            urls: ["http://redpanda-1:9644"]
        connect:
          enabled: false
    ports:
      - 8080:8080
    depends_on:
      - redpanda-1
