Skip to content

Commit

Permalink
Added version 3.7 and dropped 2.1.
Browse files Browse the repository at this point in the history
Signed-off-by: Hermann Mayer <[email protected]>
  • Loading branch information
Jack12816 committed May 17, 2024
1 parent 7952ccf commit 4e3b233
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
version:
- latest
- 2.1
- '3.7'
steps:
- name: Prepare the virtual environment
uses: hausgold/actions/ci@master
Expand Down
9 changes: 0 additions & 9 deletions 2.1/config/kafka.sh

This file was deleted.

5 changes: 4 additions & 1 deletion 2.1/Dockerfile → 3.7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM wurstmeister/kafka:2.12-2.1.0
FROM apache/kafka:3.7.0
MAINTAINER Hermann Mayer "[email protected]"

# You can change this environment variable on run's with -e
ENV MDNS_HOSTNAME=kafka.local

# Switch to the root user
USER root

# Install system packages
RUN apk add --no-cache \
dbus avahi avahi-tools supervisor bash
Expand Down
2 changes: 1 addition & 1 deletion 2.1/Makefile → 3.7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SHELL := bash
REGISTRY ?=
CANONICAL_NAME ?= kafka
IMAGE_NAME ?= hausgold/$(CANONICAL_NAME)
IMAGE_REF ?= 2.1
IMAGE_REF ?= 3.7
IMAGE_URI := $(IMAGE_NAME):$(IMAGE_REF)
TEST_CONTAINER_NAME ?= $(CANONICAL_NAME)-test

Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions 3.7/config/kafka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# See: https://bit.ly/3UNWpq2
# See: https://bit.ly/3QLrxFC

# Configure application defaults
export KAFKA_NODE_ID=${KAFKA_NODE_ID:-'1'}
export KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP:-'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'}
export KAFKA_ADVERTISED_LISTENERS=${KAFKA_ADVERTISED_LISTENERS:-"PLAINTEXT_HOST://${MDNS_HOSTNAME}:9092,PLAINTEXT://${MDNS_HOSTNAME}:19092"}
export KAFKA_PROCESS_ROLES=${KAFKA_PROCESS_ROLES:-'broker,controller'}
export KAFKA_CONTROLLER_QUORUM_VOTERS=${KAFKA_CONTROLLER_QUORUM_VOTERS:-'1@localhost:29093'}
export KAFKA_LISTENERS=${KAFKA_LISTENERS:-'CONTROLLER://:29093,PLAINTEXT_HOST://:9092,PLAINTEXT://:19092'}
export KAFKA_INTER_BROKER_LISTENER_NAME=${KAFKA_INTER_BROKER_LISTENER_NAME:-'PLAINTEXT'}
export KAFKA_CONTROLLER_LISTENER_NAMES=${KAFKA_CONTROLLER_LISTENER_NAMES:-'CONTROLLER'}
export CLUSTER_ID=${CLUSTER_ID:-'4L6g3nShT-eMCtK--X86sw'}
export KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=${KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR:-'1'}
export KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=${KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS:-'0'}
export KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=${KAFKA_TRANSACTION_STATE_LOG_MIN_ISR:-'1'}
export KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=${KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR:-'1'}
export KAFKA_LOG_DIRS=${KAFKA_LOG_DIRS:-'/tmp/kraft-combined-logs'}

# Start the regular bootstrapping
exec /etc/kafka/docker/run
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ priority=20
directory=/tmp
environment=HOME="/tmp",LANG="en_US.UTF-8",LANGUAGE="en_US.UTF-8",LC_ALL="en_US.UTF-8"
command=/usr/local/bin/kafka.sh
user=root
user=appuser
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
![mDNS enabled wurstmeister/kafka-docker](https://raw.githubusercontent.com/hausgold/docker-kafka/master/docs/assets/project.png)
![mDNS enabled Kafka](https://raw.githubusercontent.com/hausgold/docker-kafka/master/docs/assets/project.png)

[![Continuous Integration](https://github.com/hausgold/docker-kafka/actions/workflows/package.yml/badge.svg?branch=master)](https://github.com/hausgold/docker-kafka/actions/workflows/package.yml)
[![Source Code](https://img.shields.io/badge/source-on%20github-blue.svg)](https://github.com/hausgold/docker-kafka)
[![Docker Image](https://img.shields.io/badge/image-on%20docker%20hub-blue.svg)](https://hub.docker.com/r/hausgold/kafka/)

This Docker images provides the [wurstmeister/kafka](https://hub.docker.com/r/wurstmeister/kafka/) image as base
with the mDNS/ZeroConf stack on top. So you can enjoy [Apache Kafka](https://kafka.apache.org)
while it is accessible by default as *kafka.local*. (Port 9092)
This Docker images provides the
[apache/kafka](https://hub.docker.com/r/apache/kafka/) image as base with the
mDNS/ZeroConf stack on top. (2.x tags used
[wurstmeister/kafka](https://hub.docker.com/r/wurstmeister/kafka/), which
required Zookeeper) So you can enjoy [Apache Kafka](https://kafka.apache.org)
while it is accessible by default as *kafka.local* (Port 9092) as a single-node
cluster using KRaft without Zookeeper.

- [Requirements](#requirements)
- [Getting starting](#getting-starting)
Expand All @@ -24,13 +28,9 @@ while it is accessible by default as *kafka.local*. (Port 9092)

To get a single broker Apache Kafka service up and running create a
`docker-compose.yml` and insert the following snippet (based on the [original
example](https://github.com/wurstmeister/kafka-docker/blob/master/docker-compose-single-broker.yml)):
example](https://github.com/apache/kafka/blob/trunk/docker/examples/jvm/single-node/plaintext/docker-compose.yml)):

```yaml
zookeeper:
image: hausgold/zookeeper
ports:
- "2181"
kafka:
image: hausgold/kafka
environment:
Expand All @@ -40,9 +40,6 @@ kafka:
# The ports are just for you to know when configure your
# container links, on depended containers
- "9092"
links:
# Link to the ZooKeeper instance for advertising
- zookeeper
```
Afterwards start the service with the following command:
Expand Down
26 changes: 20 additions & 6 deletions config/kafka.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
#!/bin/bash
#!/usr/bin/env bash

# See: https://bit.ly/3UNWpq2
# See: https://bit.ly/3QLrxFC

# Configure application defaults
export KAFKA_ZOOKEEPER_CONNECT=${KAFKA_ZOOKEEPER_CONNECT:-'zookeeper:2181'}
export KAFKA_ADVERTISED_HOST_NAME=${KAFKA_ADVERTISED_HOST_NAME:-${MDNS_HOSTNAME}}
export KAFKA_LOG_DIRS=${KAFKA_LOG_DIRS:-'/kafka/logs'}
export KAFKA_NODE_ID=${KAFKA_NODE_ID:-'1'}
export KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP:-'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'}
export KAFKA_ADVERTISED_LISTENERS=${KAFKA_ADVERTISED_LISTENERS:-"PLAINTEXT_HOST://${MDNS_HOSTNAME}:9092,PLAINTEXT://${MDNS_HOSTNAME}:19092"}
export KAFKA_PROCESS_ROLES=${KAFKA_PROCESS_ROLES:-'broker,controller'}
export KAFKA_CONTROLLER_QUORUM_VOTERS=${KAFKA_CONTROLLER_QUORUM_VOTERS:-'1@localhost:29093'}
export KAFKA_LISTENERS=${KAFKA_LISTENERS:-'CONTROLLER://:29093,PLAINTEXT_HOST://:9092,PLAINTEXT://:19092'}
export KAFKA_INTER_BROKER_LISTENER_NAME=${KAFKA_INTER_BROKER_LISTENER_NAME:-'PLAINTEXT'}
export KAFKA_CONTROLLER_LISTENER_NAMES=${KAFKA_CONTROLLER_LISTENER_NAMES:-'CONTROLLER'}
export CLUSTER_ID=${CLUSTER_ID:-'4L6g3nShT-eMCtK--X86sw'}
export KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=${KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR:-'1'}
export KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=${KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS:-'0'}
export KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=${KAFKA_TRANSACTION_STATE_LOG_MIN_ISR:-'1'}
export KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=${KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR:-'1'}
export KAFKA_LOG_DIRS=${KAFKA_LOG_DIRS:-'/tmp/kraft-combined-logs'}

# Start the wurstmeister/kafka bootstrapping
source /usr/bin/start-kafka.sh
# Start the regular bootstrapping
exec /etc/kafka/docker/run
2 changes: 1 addition & 1 deletion config/supervisor/kafka.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ priority=20
directory=/tmp
environment=HOME="/tmp",LANG="en_US.UTF-8",LANGUAGE="en_US.UTF-8",LC_ALL="en_US.UTF-8"
command=/usr/local/bin/kafka.sh
user=root
user=appuser
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
Expand Down
2 changes: 1 addition & 1 deletion latest

0 comments on commit 4e3b233

Please sign in to comment.