diff --git a/Dockerfile b/Dockerfile index 95ff451..9b6134f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,21 +17,58 @@ LABEL maintainer=${IMG_MAINTAINER} ARG RABBITMQ_LIB=/var/lib/rabbitmq +ARG RABBITMQ_PORT=5672 +ARG RABBITMQ_ADMIN_PORT=15672 -#--------------------------------------------------------------------------------------------------- -ARG RABBITMQD='#!/bin/bash \n\ - \n\ -usermod -u ${RABBITMQ_UID} -s /bin/bash rabbitmq \n\ -groupmod -g ${RABBITMQ_GID} rabbitmq \n\ - \n\ +#------------------------------------------------------------------------------------------------------------------- +ARG RABBITMQD='#!/bin/bash \n\ + \n\ +usermod -u ${RABBITMQ_UID} -s /bin/bash rabbitmq \n\ +groupmod -g ${RABBITMQ_GID} rabbitmq \n\ + \n\ chown -R rabbitmq:rabbitmq '${RABBITMQ_LIB}' /var/log/rabbitmq /var/run/rabbitmq' -#--------------------------------------------------------------------------------------------------- +#------------------------------------------------------------------------------------------------------------------- -#--------------------------------------------------------------------------------------------------- -ARG RABBITMQD_INI='[program:rabbitmqd] \n\ -command=su - rabbitmq -c /usr/lib/rabbitmq/bin/rabbitmq-server \n\ +#------------------------------------------------------------------------------------------------------------------- +ARG RABBITMQD_INI='[program:rabbitmqd] \n\ +command=su - rabbitmq -c /usr/lib/rabbitmq/bin/rabbitmq-server \n\ user=root' -#--------------------------------------------------------------------------------------------------- +#------------------------------------------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------------------------------------------- +ARG POSTRMQ='#!/bin/bash \n\ + \n\ +function log() { echo "$(date --rfc-3339=ns) PostRMQ: $*" | tee -a /var/log/postrmq.log; } \n\ + \n\ +log "Starting" \n\ + \n\ +for i in {30..0} \n\ +do \n\ + if curl http://127.0.0.1:'${RABBITMQ_ADMIN_PORT}'/cli/rabbitmqadmin &> /dev/null \n\ + then \n\ + break \n\ + fi \n\ + \n\ + sleep 1 \n\ +done \n\ + \n\ +if [ "$i" = 0 ] \n\ +then \n\ + log "Unable to connect to server" \n\ +else \n\ + log "Downloading rabbitmqadmin" \n\ + curl -o /usr/local/bin/rabbitmqadmin http://127.0.0.1:'${RABBITMQ_ADMIN_PORT}'/cli/rabbitmqadmin &>/dev/null \n\ + \n\ + chmod a+rx /usr/local/bin/rabbitmqadmin \n\ +fi \n\ + \n\ +log "Completed"' +#------------------------------------------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------------------------------------------- +ARG POSTRMQ_INI='[program:postrmq] \n\ +command=/usr/local/sbin/postrmq' +#------------------------------------------------------------------------------------------------------------------- @@ -41,11 +78,14 @@ RUN urpmi --force lksctp-tools \ && echo -e "${RABBITMQD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/rabbitmqd \ && chmod a+x /etc/init.d/rabbitmqd \ && ln -s /etc/init.d/rabbitmqd /etc/rcD.d/S40rabbitmqd \ - && echo -e "${RABBITMQD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/rabbitmqd.ini + && echo -e "${RABBITMQD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/rabbitmqd.ini \ + && echo -e "${POSTRMQ}" | sed -e "s/\`/'/g" -e 's/ *$//' > /usr/local/sbin/postrmq \ + && chmod a+x /usr/local/sbin/postrmq \ + && echo -e "${POSTRMQ_INI}" | sed -e 's/ *$//' > /etc/supervisord.d/postrmq.ini VOLUME ${RABBITMQ_LIB} -EXPOSE 5672 -EXPOSE 15672 +EXPOSE ${RABBITMQ_ADMIN_PORT} +EXPOSE ${RABBITMQ_ADMIN_PORT} diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 59508a0..44c3c5c 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,3 +1,12 @@ +------------------------------------------------------------------------------------------------------------------------------------ +Rx3/RabbitMQ-Mga9 V 1.0.2 - A. GIBERT - 2024/11/01 +------------------------------------------------------------------------------------------------------------------------------------ + +- Add a post init stage to download & install rabbitmqadmin utility, +- Add hostname in compose file to fix rabbitmq persistence. + + + ------------------------------------------------------------------------------------------------------------------------------------ Rx3/RabbitMQ-Mga9 V 1.0.1 - A. GIBERT - 2024/10/07 ------------------------------------------------------------------------------------------------------------------------------------ diff --git a/compose.yaml b/compose.yaml index 739bb57..0d99d51 100644 --- a/compose.yaml +++ b/compose.yaml @@ -7,6 +7,7 @@ services: mqserver: container_name: ${IMG_NAME} + hostname: ${IMG_NAME} image: ${IMG_URL} diff --git a/env b/env index 189b7e9..dd1edef 100644 --- a/env +++ b/env @@ -17,7 +17,7 @@ IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}" IMG_NAME="rabbitmq-mga9" IMG_FULL_NAME="Rx3 RabbitMQ Mageia-9 Docker Image" -IMG_VERSION="1.0.1" +IMG_VERSION="1.0.2" IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}" IMG_MAINTAINER='"Arnaud G. GIBERT" '