Skip to content

Commit

Permalink
add dockerfile for tools
Browse files Browse the repository at this point in the history
  • Loading branch information
sauljabin committed Jul 11, 2024
1 parent eafcbce commit 754357e
Show file tree
Hide file tree
Showing 56 changed files with 442 additions and 1,965 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CP_VERSION=7.6.1
CONFLUENT_VERSION=7.6.1
CLUSTER_ID=bgwoWzvSSlKmk2ysynPDNg
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM ubuntu:24.04

ARG CONFLUENT_VERSION
WORKDIR /kafka-sandbox

ENV GRADLE_VERSION "8.8"
ENV GRADLE_HOME "/opt/gradle"
ENV GRADLE_BIN "${GRADLE_HOME}/bin"
ENV CONFLUENT_VERSION "$CONFLUENT_VERSION"
ENV CONFLUENT_HOME "/opt/confluent"
ENV CONFLUENT_BIN "${CONFLUENT_HOME}/bin"
ENV PATH "${PATH}:${CONFLUENT_BIN}:${GRADLE_BIN}:/root/.local/bin"
ENV COLORTERM "truecolor"
ENV TERM "xterm-256color"

RUN apt update \
&& apt install -y \
wget \
curl \
vim \
unzip \
kcat \
openjdk-17-jdk-headless \
jq \
httpie \
postgresql-client \
mysql-client \
mosquitto-clients \
python-is-python3 \
python3 \
pipx \
&& rm -rf /var/lib/apt/lists/* \
&& pipx install kaskade

RUN wget -q "http://packages.confluent.io/archive/$(echo "${CONFLUENT_VERSION}" | cut -c 1-3)/confluent-community-${CONFLUENT_VERSION}.zip" -O /tmp/confluent.zip \
&& unzip /tmp/confluent.zip -d /tmp \
&& mv "/tmp/confluent-${CONFLUENT_VERSION}" "${CONFLUENT_HOME}" \
&& rm /tmp/confluent.zip

RUN wget -q "https://services.gradle.org/distributions/gradle-8.8-bin.zip" -O /tmp/gradle.zip \
&& unzip /tmp/gradle.zip -d /tmp \
&& mv "/tmp/gradle-${GRADLE_VERSION}" "${GRADLE_HOME}" \
&& rm /tmp/gradle.zip
82 changes: 19 additions & 63 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
kafka1:
image: confluentinc/cp-kafka:${CP_VERSION}
image: confluentinc/cp-kafka:${CONFLUENT_VERSION}
environment:
KAFKA_NODE_ID: 1
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:9092,EXTERNAL://localhost:19092
Expand All @@ -17,15 +17,9 @@ services:
restart: on-failure
volumes:
- kafka1_data:/var/lib/kafka/data
healthcheck:
test: kafka-topics --bootstrap-server localhost:9092 --list > /dev/null 2>&1
interval: 10s
timeout: 10s
retries: 5
start_period: 10s

kafka2:
image: confluentinc/cp-kafka:${CP_VERSION}
image: confluentinc/cp-kafka:${CONFLUENT_VERSION}
environment:
KAFKA_NODE_ID: 2
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka2:9092,EXTERNAL://localhost:29092
Expand All @@ -42,15 +36,9 @@ services:
restart: on-failure
volumes:
- kafka2_data:/var/lib/kafka/data
healthcheck:
test: kafka-topics --bootstrap-server localhost:9092 --list > /dev/null 2>&1
interval: 10s
timeout: 10s
retries: 5
start_period: 10s

kafka3:
image: confluentinc/cp-kafka:${CP_VERSION}
image: confluentinc/cp-kafka:${CONFLUENT_VERSION}
environment:
KAFKA_NODE_ID: 3
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka3:9092,EXTERNAL://localhost:39092
Expand All @@ -67,15 +55,9 @@ services:
restart: on-failure
volumes:
- kafka3_data:/var/lib/kafka/data
healthcheck:
test: kafka-topics --bootstrap-server localhost:9092 --list > /dev/null 2>&1
interval: 10s
timeout: 10s
retries: 5
start_period: 10s

schema-registry:
image: confluentinc/cp-schema-registry:${CP_VERSION}
image: confluentinc/cp-schema-registry:${CONFLUENT_VERSION}
environment:
SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_METHODS: GET,POST,PUT,OPTIONS
SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_ORIGIN: "*"
Expand All @@ -86,15 +68,9 @@ services:
ports:
- "8081:8081"
restart: on-failure
healthcheck:
test: curl http://localhost:8081
interval: 30s
timeout: 30s
retries: 5
start_period: 30s

kafka-connect:
image: confluentinc/cp-kafka-connect:${CP_VERSION}
image: confluentinc/cp-kafka-connect:${CONFLUENT_VERSION}
environment:
CONNECT_BOOTSTRAP_SERVERS: kafka1:9092,kafka2:9092,kafka3:9092
CONNECT_REST_ADVERTISED_HOST_NAME: localhost
Expand All @@ -112,24 +88,12 @@ services:
restart: on-failure
volumes:
- ./kafka-connect/plugins:/usr/local/share/kafka/plugins
healthcheck:
test: curl http://localhost:8083
interval: 30s
timeout: 30s
retries: 5
start_period: 30s

akhq:
image: tchiotludo/akhq:latest
ports:
- "8080:8080"
restart: on-failure
healthcheck:
test: curl http://localhost:8080
interval: 30s
timeout: 30s
retries: 5
start_period: 30s
environment:
AKHQ_CONFIGURATION: |
akhq:
Expand All @@ -142,6 +106,7 @@ services:
connect:
- name: kafka-connect
url: http://kafka-connect:8083
mysql:
image: mysql:latest
profiles:
Expand Down Expand Up @@ -188,7 +153,7 @@ services:
- mosquitto_data:/mosquitto/data

kafka-rest:
image: confluentinc/cp-kafka-rest:${CP_VERSION}
image: confluentinc/cp-kafka-rest:${CONFLUENT_VERSION}
profiles:
- proxies
environment:
Expand All @@ -197,15 +162,9 @@ services:
ports:
- "8082:8082"
restart: on-failure
healthcheck:
test: curl http://localhost:8082
interval: 30s
timeout: 30s
retries: 5
start_period: 30s

kafka-mqtt:
image: confluentinc/cp-kafka-mqtt:${CP_VERSION}
image: confluentinc/cp-kafka-mqtt:${CONFLUENT_VERSION}
profiles:
- proxies
environment:
Expand All @@ -217,7 +176,7 @@ services:
restart: on-failure

ksqldb:
image: confluentinc/cp-ksqldb-server:${CP_VERSION}
image: confluentinc/cp-ksqldb-server:${CONFLUENT_VERSION}
profiles:
- ksqldb
environment:
Expand All @@ -234,21 +193,18 @@ services:
restart: on-failure
volumes:
- ./kafka-ksqldb-extensions/extensions:/ksqldb/extensions
healthcheck:
test: curl http://localhost:8088
interval: 30s
timeout: 30s
retries: 5
start_period: 30s

ksqldb-cli:
image: confluentinc/ksqldb-cli:latest
profiles:
- ksqldb
cli:
build:
context: .
args:
CONFLUENT_VERSION: ${CONFLUENT_VERSION}
environment:
PGPASSWORD: notasecret
CLUSTER_ID: ${CLUSTER_ID}
volumes:
- ./kafka-ksqldb:/sandbox
- ./kafka-ksqldb-extensions/extensions:/extensions
entrypoint: /bin/sh
- .:/kafka-sandbox
entrypoint: /bin/bash
tty: true

volumes:
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
confluentVersion=7.6.1
kafkaVersion=3.6.1
kafkaVersion=3.6.1
lombokVersion=1.18.26
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
41 changes: 28 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +198,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading

0 comments on commit 754357e

Please sign in to comment.