From ec84fddfa91ace6f0a9d6cf9dfe1ba2e44e8b76f Mon Sep 17 00:00:00 2001 From: AlphaRoy14 Date: Thu, 27 Apr 2023 15:52:51 -0700 Subject: [PATCH] dockerize benchmarking --- Dockerfile | 10 ++++++++++ benchmark.sh | 10 ++++++++++ docker-compose.yml | 24 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 Dockerfile create mode 100644 benchmark.sh create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..94352eb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.11 + +WORKDIR /app +RUN apt-get update && apt-get install -y tee + +COPY . . + +RUN pip install -r requirements.txt + +CMD ["/bin/bash", "benchmark.sh"] diff --git a/benchmark.sh b/benchmark.sh new file mode 100644 index 0000000..2772016 --- /dev/null +++ b/benchmark.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Run the producer_benchmark.py script and print its output to the screen +python producer_benchmark.py | tee producer_output.txt & + +# Wait for a few seconds to let the producer start sending messages +sleep 5 + +# Run the consumer_benchmark.py script and print its output to the screen +python consumer_benchmark.py | tee consumer_output.txt \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e1abc34 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3.8" +services: + + kafka: + image: "bitnami/kafka:3.4.0" + container_name: kafka + environment: + - ALLOW_PLAINTEXT_LISTENER=yes + - KAFKA_CREATE_TOPICS=page-views:3:1 + - KAFKA_ENABLE_KRAFT=yes + ports: + - "9092:9092" + python-wrapper: + depends_on: + - kafka + build: + context: . + dockerfile: Dockerfile + + + + + +