Owl Shop Example Application in Docker

This Docker Compose example starts a single Redpanda broker, Redpanda Console, and an example application called owl shop. Owl shop simulates a simple e-commerce shop that uses Redpanda as an asynchronous communication exchange. You can use the sample data to see how to manage and monitor applications in Redpanda Console. Owl shop creates topics, produces sample data to those topics, and consumes from those topics so that you can test Redpanda Console with some.

Prerequisites

You must have Docker and Docker Compose installed on your host machine.

Run the lab

  1. Download the following Docker Compose file on your local file system.

    If you are running on an ARM-based device such as the Apple M1 chip, uncomment the platform: 'linux/amd64' lines.
    Reveal the Docker Compose file
    docker-compose.yml
    version: '3.7'
    name: redpanda-owl-shop
    networks:
      redpanda_network:
        driver: bridge
    volumes:
      redpanda: null
    services:
      redpanda:
        image: docker.redpanda.com/redpandadata/redpanda:v23.3.12
        command:
          - redpanda start
          - --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092
          # Address the broker advertises to clients that connect to the Kafka API.
          # Use the internal addresses to connect to the Redpanda brokers
          # from inside the same Docker network.
          # Use the external addresses to connect to the Redpanda brokers
          # from outside the Docker network.
          - --advertise-kafka-addr internal://redpanda:9092,external://localhost:19092
          - --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18082
          # Address the broker advertises to clients that connect to the HTTP Proxy.
          - --advertise-pandaproxy-addr internal://redpanda:8082,external://localhost:18082
          - --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18081
          # Redpanda brokers use the RPC API to communicate with each other internally.
          - --rpc-addr redpanda:33145
          - --advertise-rpc-addr redpanda:33145
          # Mode dev-container uses well-known configuration properties for development in containers.
          - --mode dev-container
          # Tells Seastar (the framework Redpanda uses under the hood) to use 1 core on the system.
          - --smp 1
        ports:
          - 18081:18081
          - 18082:18082
          - 19092:19092
          - 19644:9644
        volumes:
          - redpanda:/var/lib/redpanda/data
        networks:
          - redpanda_network
        healthcheck:
          test: ["CMD-SHELL", "rpk cluster health | grep -E 'Healthy:.+true' || exit 1"]
          interval: 15s
          timeout: 3s
          retries: 5
          start_period: 5s
      console:
        image: docker.redpanda.com/redpandadata/console:v2.4.6
        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:9092"]
              schemaRegistry:
                enabled: true
                urls: ["http://redpanda:8081"]
            redpanda:
              adminApi:
                enabled: true
                urls: ["http://redpanda:9644"]
            connect:
              enabled: true
              clusters:
                - name: local-connect-cluster
                  url: http://connect:8083
        ports:
          - 8080:8080
        networks:
          - redpanda_network
        depends_on:
          - redpanda
      owl-shop:
        image: quay.io/cloudhut/owl-shop:sha-042112b
        networks:
          - redpanda_network
        #platform: 'linux/amd64'
        entrypoint: /bin/sh
        command: -c "echo \"$$OWLSHOP_CONFIG_FILE\" > /tmp/config.yml; /app/owlshop"
        environment:
          CONFIG_FILEPATH: /tmp/config.yml
          OWLSHOP_CONFIG_FILE: |
            shop:
              requestRate: 1
              interval: 0.1s
              topicReplicationFactor: 1
              topicPartitionCount: 1
            kafka:
              brokers: "redpanda:9092"
        depends_on:
          - redpanda
      connect:
        image: docker.redpanda.com/redpandadata/connectors:latest
        hostname: connect
        container_name: connect
        networks:
          - redpanda_network
        #platform: 'linux/amd64'
        depends_on:
          - redpanda
        ports:
          - "8083:8083"
        environment:
          CONNECT_CONFIGURATION: |
              key.converter=org.apache.kafka.connect.converters.ByteArrayConverter
              value.converter=org.apache.kafka.connect.converters.ByteArrayConverter
              group.id=connectors-cluster
              offset.storage.topic=_internal_connectors_offsets
              config.storage.topic=_internal_connectors_configs
              status.storage.topic=_internal_connectors_status
              config.storage.replication.factor=-1
              offset.storage.replication.factor=-1
              status.storage.replication.factor=-1
              offset.flush.interval.ms=1000
              producer.linger.ms=50
              producer.batch.size=131072
          CONNECT_BOOTSTRAP_SERVERS: redpanda:9092
          CONNECT_GC_LOG_ENABLED: "false"
          CONNECT_HEAP_OPTS: -Xms512M -Xmx512M
          CONNECT_LOG_LEVEL: info
  2. Set the REDPANDA_VERSION environment variable to the version of Redpanda that you want to run. For all available versions, see the GitHub releases.

    For example:

    export REDPANDA_VERSION=23.3.12
  3. Set the REDPANDA_CONSOLE_VERSION environment variable to the version of Redpanda Console that you want to run. For all available versions, see the GitHub releases.

    For example:

    export REDPANDA_CONSOLE_VERSION=2.4.6
  4. Run the following in the directory where you saved the Docker Compose file:

    docker compose up -d
  5. Open Redpanda Console at localhost:8080 and go to Topics to see the owl shop topics.

Clean up

To shut down and delete the containers along with all your cluster data:

docker compose down -v