- Add a post init stage to download & install rabbitmqadmin utility,
- Add hostname in compose file to fix rabbitmq persistence.
This commit is contained in:
parent
d04d7ed47f
commit
5c02695762
54
Dockerfile
54
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\
|
||||
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\
|
||||
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}
|
||||
|
@ -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
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -7,6 +7,7 @@ services:
|
||||
|
||||
mqserver:
|
||||
container_name: ${IMG_NAME}
|
||||
hostname: ${IMG_NAME}
|
||||
|
||||
image: ${IMG_URL}
|
||||
|
||||
|
2
env
2
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" <arnaud@rx3.net>'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user