From e85a67d6f1ed7dcd5284aaacc7dbfe81273eb928 Mon Sep 17 00:00:00 2001 From: "Arnaud G. GIBERT" Date: Mon, 18 Nov 2024 18:55:40 +0100 Subject: [PATCH] - Initial release, - Based on rx3-docker/java:1.1.0-mga9 image, - Kafka V3.9.0. --- .gitignore | 2 ++ Dockerfile | 58 +++++++++++++++++++++++++++++++++++ ReadMe.txt | 18 +++++++++++ ReleaseNotes.txt | 7 +++++ compose.yaml | 48 +++++++++++++++++++++++++++++ env.dist | 39 +++++++++++++++++++++++ var/lib/kafka/.gitignore | 4 +++ var/log/init/.gitignore | 4 +++ var/log/kafka/.gitignore | 4 +++ var/log/supervisor/.gitignore | 4 +++ 10 files changed, 188 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 ReadMe.txt create mode 100644 ReleaseNotes.txt create mode 100644 compose.yaml create mode 100644 env.dist create mode 100644 var/lib/kafka/.gitignore create mode 100644 var/log/init/.gitignore create mode 100644 var/log/kafka/.gitignore create mode 100644 var/log/supervisor/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..556bc65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +*.old diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c7412b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,58 @@ +# RX3-Docker/Kafka Dockerfile +#------------------------------------------------------------------------------- + +ARG IMG_FROM_URL="rx3-docker/java:latest" + +FROM ${IMG_FROM_URL} + +ARG IMG_NAME +ARG IMG_NAME_FULL +ARG IMG_VERSION +ARG IMG_MAINTAINER + +LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL} +LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION} +LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER} +LABEL maintainer=${IMG_MAINTAINER} + +ARG KAFKA_PORT + +ARG KAFKA_HOME="/opt/appl/kafka" + + + +#--------------------------------------------------------------------------------------------------- +ARG KAFKAD='#!/bin/bash \n\ + \n\ +usermod -u ${KAFKA_UID} kafka \n\ +groupmod -g ${KAFKA_GID} kafka \n\ + \n\ +chown -R kafka:kafka '${KAFKA_LIB}' '${KAFKA_LOG}' \n\ + \n\ +cd '${KAFKA_HOME}' \n\ + \n\ +KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)" \n\ +bin/kafka-storage.sh format --standalone -t \$KAFKA_CLUSTER_ID -c config/kraft/reconfig-server.properties' +#--------------------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------------------- +ARG KAFKAD_INI='[program:kafkad] \n\ +directory='${KAFKA_HOME}' \n\ +command='${KAFKA_HOME}'/bin/kafka-server-start.sh config/kraft/reconfig-server.properties' +#--------------------------------------------------------------------------------------------------- + + + +RUN urpmi --force wget \ + && wget -q -O /tmp/kafka.tgz https://downloads.apache.org/kafka/3.9.0/kafka_2.13-3.9.0.tgz \ + && mkdir -p /opt/appl \ + && cd /opt/appl \ + && tar xf /tmp/kafka.tgz \ + && mv kafka* kafka \ + && rm /tmp/kafka.tgz \ + && echo -e "${KAFKAD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/kafkad \ + && chmod a+x /etc/init.d/kafkad \ + && ln -s /etc/init.d/kafkad /etc/rcD.d/S30kafkad \ + && echo -e "${KAFKAD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/kafkad.ini + +EXPOSE ${KAFKA_PORT} diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..9178c72 --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,18 @@ +Welcome to Rx3-Docker/Kafka docker image! + + + +This project aims to build a Kafka docker image used by other Rx3 packaging projects. + +Features: + - Curtently based on rx3-docker/server:1.1.0-mga9 image, + - . + + +Enjoy it! + +Your Rx3 Team. + +-- +arnaud@rx3.net +https://git.rx3.org/gitea/rx3-docker/kafka diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt new file mode 100644 index 0000000..5151a4e --- /dev/null +++ b/ReleaseNotes.txt @@ -0,0 +1,7 @@ +------------------------------------------------------------------------------------------------------------------------------------ +Rx3-Docker/Kafka V 1.0.0 - A. GIBERT - 2024/11/xx +------------------------------------------------------------------------------------------------------------------------------------ + +- Initial release, +- Based on rx3-docker/java:1.1.0-mga9 image, +- Kafka V3.9.0. diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..5efa73b --- /dev/null +++ b/compose.yaml @@ -0,0 +1,48 @@ +# Rx3 Proto Docker Image +#------------------------------------------------------------------------------- + +name: ${HOST_NAME_PREFIX} + +services: + +#------------------------------------------------------------------------------- + + kafka: + container_name: ${KAFKA_HOST_NAME} + hostname: ${KAFKA_HOST_NAME} + + image: ${KAFKA_IMG_URL} + + build: + args: + IMG_NAME: ${KAFKA_IMG_URL} + IMG_NAME_FULL: ${KAFKA_IMG_NAME_FULL} + IMG_VERSION: ${KAFKA_IMG_VERSION} + IMG_MAINTAINER: ${KAFKA_IMG_MAINTAINER} + IMG_FROM_URL: ${KAFKA_IMG_FROM_URL} + + KAFKA_PORT: ${KAFKA_PORT_MAIN_INT} + + restart: unless-stopped + + environment: + KAFKA_UID: ${KAFKA_USER_ID} + KAFKA_GID: ${KAFKA_GROUP_ID} + + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:${KAFKA_PORT_MAIN_INT}"] + interval: 30s + timeout: 10s + start_period: 60s + start_interval: 10s + retries: 30 + + volumes: + - ./${KAFKA_LIB_EXT}:${KAFKA_LIB_INT} + - ./${KAFKA_LOG_INIT_EXT}:${KAFKA_LOG_INIT_INT} + - ./${KAFKA_LOG_SV_EXT}:${KAFKA_LOG_SV_INT} + - ./${KAFKA_LOG_MAIN_EXT}:${KAFKA_LOG_MAIN_INT} + + ports: + - "127.0.0.1:${KAFKA_PORT_SV_EXT}:${KAFKA_PORT_SV_INT}" + - "127.0.0.1:${KAFKA_PORT_MAIN_EXT}:${KAFKA_PORT_MAIN_INT}" diff --git a/env.dist b/env.dist new file mode 100644 index 0000000..168045d --- /dev/null +++ b/env.dist @@ -0,0 +1,39 @@ +# Rx3-Docker/Kafka Docker Image +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Global Settings +#------------------------------------------------------------------------------- + +ORG_NAME="rx3-docker" +ORG_REGISTRY="docker.xor.rx3:5000" +ORG_MAINTAINER='"Arnaud G. GIBERT" ' + +ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}" + + + +#------------------------------------------------------------------------------- +# Image Settings +#------------------------------------------------------------------------------- + +HOST_NAME_PREFIX="" + +PORT_ENV_OFFSET=0 +PORT_SV_OFFSET=1000 + + +#------------------+----------+--------------------+--------------------------+------------------------------------------+------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+ +# | Variable | Target Image | From Image | Module | Main Port | Admin Port | User | Group | +# | Prefix | URL Prefix | Name | Name Full + Version | URL Prefix | Name + Version | Name | Version | Ext | Int | Ext | Int | Name / Id | Name / Id | +#------------------+----------+--------------------+--------------------------+------------------------------------------+------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+ + +docker_service_add KAFKA ${ORG_URL_PREFIX} kafka "Rx3-Docker/Kafka Docker Image" 1.0.0-mga9 ${ORG_URL_PREFIX} java 1.1.0-mga9 - - 9092 9092 - - apache apache + + + +#------------------------------------------------------------------------------- +# User Settings +#------------------------------------------------------------------------------- + +SERVER_CROND_ENABLED="FALSE" diff --git a/var/lib/kafka/.gitignore b/var/lib/kafka/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/var/lib/kafka/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/var/log/init/.gitignore b/var/log/init/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/var/log/init/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/var/log/kafka/.gitignore b/var/log/kafka/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/var/log/kafka/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/var/log/supervisor/.gitignore b/var/log/supervisor/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/var/log/supervisor/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore