- Add RedPanda Console tool,

- Now support docker-tools V 1.3.x.
This commit is contained in:
Arnaud G. GIBERT 2024-11-24 23:47:07 +01:00
parent e64e8eb257
commit 607eb5eee3
5 changed files with 116 additions and 69 deletions

View File

@ -10,35 +10,71 @@ ARG IMG_NAME_FULL
ARG IMG_VERSION ARG IMG_VERSION
ARG IMG_MAINTAINER ARG IMG_MAINTAINER
ARG APACHE_DOC_ROOT
LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL} LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION} LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER} LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER} LABEL maintainer=${IMG_MAINTAINER}
ARG APACHE_DOC_ROOT
ARG REDPANDA_CONSOLE_PORT
ARG PHPPGADMIN_OWNER="mentax" ARG PHPPGADMIN_OWNER="mentax"
ARG PHPPGADMIN_COMMIT="d0d35701af8644788f84b808d21e7fd04213baa0" ARG PHPPGADMIN_COMMIT="d0d35701af8644788f84b808d21e7fd04213baa0"
ARG PHPPGADMIN_HOME="${APACHE_DOC_ROOT}/phppgadmin"
ARG PHPPGADMIN_CONFIG="${PHPPGADMIN_HOME}/conf/config.inc.php"
ARG REDPANDA_CONSOLE_HOME="/opt/appl/redpanda_console"
ARG REDPANDA_CONSOLE_CONFIG="${REDPANDA_CONSOLE_HOME}/etc/redpanda-console-config.yaml"
#---------------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ARG TOOLSD='#!/bin/bash \n\ ARG TOOLSD='#!/bin/bash \n\
\n\ \n\
sed -i "s/$conf\[`servers`\]\[0\]\[`desc`\] = `PostgreSQL`;/$conf\[`servers`\]\[0\]\[`desc`\] = `${POSTGRESQL_SERVER_NAME}`;/" '${APACHE_DOC_ROOT}'/phppgadmin/conf/config.inc.php \n\ sed -i "s/$conf\[`servers`\]\[0\]\[`desc`\] = `PostgreSQL`;/$conf\[`servers`\]\[0\]\[`desc`\] = `${POSTGRESQL_SERVER_NAME}`;/" '${PHPPGADMIN_CONFIG}' \n\
sed -i "s/$conf\[`servers`\]\[0\]\[`host`\] = ``;/$conf\[`servers`\]\[0\]\[`host`\] = `${POSTGRESQL_HOST}`;/" '${APACHE_DOC_ROOT}'/phppgadmin/conf/config.inc.php \n\ sed -i "s/$conf\[`servers`\]\[0\]\[`host`\] = ``;/$conf\[`servers`\]\[0\]\[`host`\] = `${POSTGRESQL_HOST}`;/" '${PHPPGADMIN_CONFIG}' \n\
sed -i "s/$conf\[`servers`\]\[0\]\[`port`\] = 5432;/$conf\[`servers`\]\[0\]\[`port`\] = ${POSTGRESQL_PORT};/" '${APACHE_DOC_ROOT}'/phppgadmin/conf/config.inc.php \n\ sed -i "s/$conf\[`servers`\]\[0\]\[`port`\] = 5432;/$conf\[`servers`\]\[0\]\[`port`\] = ${POSTGRESQL_PORT};/" '${PHPPGADMIN_CONFIG}' \n\
sed -i "s/$conf\[`extra_login_security`\] = true;/$conf\[`extra_login_security`\] = false;/" '${APACHE_DOC_ROOT}'/phppgadmin/conf/config.inc.php' sed -i "s/$conf\[`extra_login_security`\] = true;/$conf\[`extra_login_security`\] = false;/" '${PHPPGADMIN_CONFIG}''
#--------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ARG REDPANDA_CONSOLED='#!/bin/bash \n\
\n\
sed -i "s/^ - broker-/ #- broker-/" '${REDPANDA_CONSOLE_CONFIG}' \n\
\n\
for broker in ${KAFKA_BROKERS} \n\
do \n\
sed -i "s/^ brokers:/ brokers:\\n - ${broker}/" '${REDPANDA_CONSOLE_CONFIG}' \n\
done \n\
\n\
sed -i "s/^#server:/server:/" '${REDPANDA_CONSOLE_CONFIG}' \n\
sed -i "s/^ #listenPort: 8080/ listenPort: '${REDPANDA_CONSOLE_PORT}'/" '${REDPANDA_CONSOLE_CONFIG}''
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ARG REDPANDA_CONSOLED_INI='[program:redpanda_consoled] \n\
directory='${REDPANDA_CONSOLE_HOME}' \n\
command='${REDPANDA_CONSOLE_HOME}'/bin/redpanda-console -config.filepath '${REDPANDA_CONSOLE_CONFIG}''
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
RUN urpmi --force wget \ #RUN urpmi --force wget phpmyadmin \
&& mkdir -p /var/www/appl \ RUN urpmi --force wget \
&& wget -q -O- "https://github.com/${PHPPGADMIN_OWNER}/phppgadmin/archive/${PHPPGADMIN_COMMIT}.tar.gz" | tar xzf - -C ${APACHE_DOC_ROOT} \ && mkdir -p /var/www/appl \
&& mv ${APACHE_DOC_ROOT}/phppgadmin-${PHPPGADMIN_COMMIT} ${APACHE_DOC_ROOT}/phppgadmin \ && wget -q -O- "https://github.com/${PHPPGADMIN_OWNER}/phppgadmin/archive/${PHPPGADMIN_COMMIT}.tar.gz" | tar xzf - -C ${APACHE_DOC_ROOT} \
&& sed -i 's/$_SERVER\['\''REQUEST_URI'\''\]/preg_replace(\"\/^\\\/phppgadmin\\\/\/", "", $_SERVER['\''REQUEST_URI'\''])/g' ${APACHE_DOC_ROOT}/phppgadmin/display.php \ && mv ${APACHE_DOC_ROOT}/phppgadmin-${PHPPGADMIN_COMMIT} ${APACHE_DOC_ROOT}/phppgadmin \
&& cp ${APACHE_DOC_ROOT}/phppgadmin/conf/config.inc.php-dist ${APACHE_DOC_ROOT}/phppgadmin/conf/config.inc.php \ && sed -i 's/$_SERVER\['\''REQUEST_URI'\''\]/preg_replace(\"\/^\\\/phppgadmin\\\/\/", "", $_SERVER['\''REQUEST_URI'\''])/g' ${APACHE_DOC_ROOT}/phppgadmin/display.php \
&& echo -e "${TOOLSD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/toolsd \ && cp ${APACHE_DOC_ROOT}/phppgadmin/conf/config.inc.php-dist ${APACHE_DOC_ROOT}/phppgadmin/conf/config.inc.php \
&& chmod a+x /etc/init.d/toolsd \ && echo -e "${TOOLSD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/toolsd \
&& ln -s /etc/init.d/toolsd /etc/rcD.d/S40toolsd && chmod a+x /etc/init.d/toolsd \
&& ln -s /etc/init.d/toolsd /etc/rcD.d/S40toolsd \
&& mkdir -p ${REDPANDA_CONSOLE_HOME}/bin ${REDPANDA_CONSOLE_HOME}/etc \
&& wget -q -O- "https://github.com/redpanda-data/console/releases/download/v2.7.2/redpanda_console_2.7.2_linux_amd64.tar.gz" | tar xzf - -C ${REDPANDA_CONSOLE_HOME}/bin \
&& wget -q -O- "https://docs.redpanda.com/current/shared/_attachments/redpanda-console-config.yaml" > ${REDPANDA_CONSOLE_CONFIG} \
&& echo -e "${REDPANDA_CONSOLED}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/redpanda_consoled \
&& chmod a+x /etc/init.d/redpanda_consoled \
&& ln -s /etc/init.d/redpanda_consoled /etc/rcD.d/S45redpanda_consoled \
&& echo -e "${REDPANDA_CONSOLED_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/redpanda_consoled.ini

View File

@ -7,7 +7,8 @@ This project aims to build a docker image embeding some usefull tools to tests o
Features: Features:
- Curtently based on rx3-docker/php-apache:1.4.0-mga9 image, - Curtently based on rx3-docker/php-apache:1.4.0-mga9 image,
- PHPPGAdmin (Mentax GitHub 2024/07 commit) installed (URL: http://localhost:xxxx/phppgadmin/), - PHPPGAdmin (Mentax GitHub 2024/07 commit) installed (URL: http://localhost:xxxx/phppgadmin/),
- PostgreSQL server name, host & port configurable. - PostgreSQL server name, host & port configurable,
- RedPenda Console tool (V2.7.2).
Enjoy it! Enjoy it!

View File

@ -1,3 +1,12 @@
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Tools V 1.2.0 - A. GIBERT - 2024/11/24
------------------------------------------------------------------------------------------------------------------------------------
- Add RedPanda Console tool,
- Now support docker-tools V 1.3.x.
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Tools V 1.1.0 - A. GIBERT - 2024/11/11 Rx3-Docker/Tools V 1.1.0 - A. GIBERT - 2024/11/11
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------

View File

@ -1,50 +1,56 @@
# Rx3-Docker/Tools Docker Image # Rx3-Docker/Tools Docker Image
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
name: ${IMG_NAME} name: ${HOST_NAME_PREFIX}
services: services:
webtools: webtools:
container_name: ${IMG_NAME} container_name: ${TOOLS_HOST_NAME}
hostname: ${IMG_NAME} hostname: ${TOOLS_HOST_NAME}
image: ${IMG_URL} image: ${TOOLS_IMG_URL}
build: build:
context: . context: .
args: args:
IMG_NAME: ${IMG_NAME} IMG_NAME: ${TOOLS_IMG_NAME}
IMG_NAME_FULL: ${IMG_NAME_FULL} IMG_NAME_FULL: ${TOOLS_IMG_NAME_FULL}
IMG_VERSION: ${IMG_VERSION} IMG_VERSION: ${TOOLS_IMG_VERSION}
IMG_MAINTAINER: ${IMG_MAINTAINER} IMG_MAINTAINER: ${TOOLS_IMG_MAINTAINER}
IMG_FROM_URL: ${IMG_FROM_URL} IMG_FROM_URL: ${TOOLS_IMG_FROM_URL}
APACHE_DOC_ROOT: ${WEBTOOLS_DOC_ROOT} APACHE_DOC_ROOT: ${TOOLS_DOC_ROOT}
REDPANDA_CONSOLE_PORT: ${TOOLS_PORT_ADMIN_INT}
restart: unless-stopped restart: unless-stopped
environment: environment:
APACHE_DOC_ROOT: ${WEBTOOLS_DOC_ROOT} APACHE_DOC_ROOT: ${TOOLS_DOC_ROOT}
POSTGRESQL_SERVER_NAME: ${POSTGRESQL_SERVER_NAME}
POSTGRESQL_HOST: ${POSTGRESQL_HOST} POSTGRESQL_SERVER_NAME: ${POSTGRESQL_SERVER_NAME}
POSTGRESQL_PORT: ${POSTGRESQL_PORT} POSTGRESQL_HOST: ${POSTGRESQL_HOST}
MARIADB_SERVER_NAME: ${MARIADB_SERVER_NAME} POSTGRESQL_PORT: ${POSTGRESQL_PORT}
MARIADB_HOST: ${MARIADB_HOST}
MARIADB_PORT: ${MARIADB_PORT} MARIADB_SERVER_NAME: ${MARIADB_SERVER_NAME}
MARIADB_HOST: ${MARIADB_HOST}
MARIADB_PORT: ${MARIADB_PORT}
KAFKA_BROKERS: ${KAFKA_HOST}:${KAFKA_PORT}
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${WEBTOOLS_PORT_MAIN_INT}"] test: ["CMD", "curl", "-f", "http://localhost:${TOOLS_PORT_MAIN_INT}"]
interval: 10s interval: 10s
timeout: 3s timeout: 3s
retries: 3 retries: 3
volumes: volumes:
# - ./var/www/html:${WEBTOOLS_DOC_ROOT} # - ./var/www/html:${TOOLS_DOC_ROOT}
- ./var/log/init:${WEBTOOLS_LOG_INIT_DIR} - .${TOOLS_LOG_INIT_EXT}:${TOOLS_LOG_INIT_INT}
- ./var/log/supervisor:${WEBTOOLS_LOG_SV_DIR} - .${TOOLS_LOG_SV_EXT}:${TOOLS_LOG_SV_INT}
- ./var/log/httpd:${WEBTOOLS_LOG_HTTPD_DIR} - .${TOOLS_LOG_HTTPD_EXT}:${TOOLS_LOG_HTTPD_INT}
ports: ports:
- "127.0.0.1:${WEBTOOLS_PORT_SV_EXT}:${WEBTOOLS_PORT_SV_INT}" - "127.0.0.1:${TOOLS_PORT_SV_EXT}:${TOOLS_PORT_SV_INT}"
- "127.0.0.1:${WEBTOOLS_PORT_MAIN_EXT}:${WEBTOOLS_PORT_MAIN_INT}" - "127.0.0.1:${TOOLS_PORT_MAIN_EXT}:${TOOLS_PORT_MAIN_INT}"
- "127.0.0.1:${TOOLS_PORT_ADMIN_EXT}:${TOOLS_PORT_ADMIN_INT}"

View File

@ -16,16 +16,21 @@ ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}"
# Image Settings # Image Settings
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
HOST_NAME_PREFIX=""
IMG_NAME="tools" PORT_ENV_OFFSET=0
IMG_NAME_FULL="Rx3-Docker/Tools Docker Image"
IMG_VERSION="1.1.0-mga9"
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
IMG_URL_PREFIX="${ORG_URL_PREFIX}" PORT_SV_INT=9001
IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}" PORT_SV_OFFSET=1000
IMG_FROM_URL="${ORG_URL_PREFIX}/php-apache:1.4.0-mga9"
#------------------+----------+--------------------------+--------------------+------------------+-------------------------------+-----------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
# | Variable | Service | Target Image | From Image | Module | Main Port | Admin Port | User | Group |
# | Prefix | Name | URL Prefix | Name | Name Full | Version | URL Prefix | Name | Version | Name | Version | Ext | Int | Ext | Int | Name / Id | Name / Id |
#------------------+----------+--------------------------+--------------------+------------------+-------------------------------+-----------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
docker_service_add TOOLS tools ${ORG_URL_PREFIX} - "Rx3-Docker/Tools" 1.2.0-mga9 ${ORG_URL_PREFIX} php-apache 1.4.0-mga9 - - 8070 80 8092 8080 apache apache
@ -33,23 +38,10 @@ IMG_FROM_URL="${ORG_URL_PREFIX}/php-apache:1.4.0-mga9"
# User Settings # User Settings
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ENV_PORT_OFFSET=0 TOOLS_LOG_HTTPD_INT="/var/log/httpd"
SV_PORT_OFFSET=1000 TOOLS_LOG_HTTPD_EXT="./var/log/httpd"
WEBTOOLS_PORT_MAIN_EXT=$(( 8070 + ${ENV_PORT_OFFSET})) TOOLS_DOC_ROOT="/var/www/html"
WEBTOOLS_PORT_MAIN_INT=80
WEBTOOLS_PORT_SV_EXT=$(( ${WEBTOOLS_PORT_MAIN_EXT} + ${SV_PORT_OFFSET}))
WEBTOOLS_PORT_SV_INT=9001
WEBTOOLS_LOG_INIT_DIR="/var/log/init"
WEBTOOLS_LOG_SV_DIR="/var/log/supervisor"
WEBTOOLS_LOG_HTTPD_DIR="/var/log/httpd"
WEBTOOLS_DOC_ROOT="/var/www/html"
APACHE_UID=980
APACHE_GID=977
POSTGRESQL_SERVER_NAME="Default" POSTGRESQL_SERVER_NAME="Default"
POSTGRESQL_HOST="127.0.0.1" POSTGRESQL_HOST="127.0.0.1"
@ -58,3 +50,6 @@ POSTGRESQL_PORT="5342"
MARIADB_SERVER_NAME="Default" MARIADB_SERVER_NAME="Default"
MARIADB_HOST="127.0.0.1" MARIADB_HOST="127.0.0.1"
MARIADB_PORT="3306" MARIADB_PORT="3306"
KAFKA_HOST="127.0.0.1"
KAFKA_PORT="9092"