Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Proposed wrapper container for review
ethan committed Sep 6, 2018
1 parent 6ae5c03 commit b5f1da1
Showing 4 changed files with 39 additions and 40 deletions.
36 changes: 5 additions & 31 deletions Dockerfile
@@ -1,32 +1,6 @@
FROM centos:centos7
FROM rabbitmq:3.7-management
MAINTAINER ethan@unc.edu ekromhout@gmail.com
RUN yum -y install epel-release && yum -y update && yum -y install pwgen rabbitmq-server supervisor wget
ENV RABBITMQ_LOGS=- RABBITMQ_SASL_LOGS=-
RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_tracing
RUN sed -i s/'%% {load_definitions, .*"},'/'{load_definitions, "\/etc\/rabbitmq\/rabbitmq.json"}'/ /etc/rabbitmq/rabbitmq.config
# Installing Zulu Java
RUN rpm --import http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems \
&& curl -o /etc/yum.repos.d/zulu.repo http://repos.azulsystems.com/rhel/zulu.repo \
&& yum -y install zulu-8
#ENV JAVA_VERSION=8u171
#ENV BUILD_VERSION=b11
#ENV JAVA_BUNDLE_ID=512cd62ec5174c3487ac17c61aaa89e8
# ==> By uncommenting these next 6 lines, you agree to the Oracle Binary Code License Agreement for Java SE (http://www.oracle.com/technetwork/java/javase/terms/license/index.html)
#RUN wget -nv --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/$JAVA_VERSION-$BUILD_VERSION/$JAVA_BUNDLE_ID/jdk-$JAVA_VERSION-linux-x64.rpm" -O /tmp/jdk-$JAVA_VERSION-$BUILD_VERSION-linux-x64.rpm && \
# yum -y install /tmp/jdk-$JAVA_VERSION-$BUILD_VERSION-linux-x64.rpm && \
# rm -f /tmp/jdk-$JAVA_VERSION-$BUILD_VERSION-linux-x64.rpm && \
# alternatives --install /usr/bin/java jar $JAVA_HOME/bin/java 200000 && \
# alternatives --install /usr/bin/javaws javaws $JAVA_HOME/bin/javaws 200000 && \
# alternatives --install /usr/bin/javac javac $JAVA_HOME/bin/javac 200000

RUN sed -i s/'nodaemon=false'/'nodaemon=true'/ /etc/supervisord.conf
COPY rabbitmqctl.sh /root/
COPY rabbittrace-0.1-jar-with-dependencies.jar /root/
COPY trace.ini /etc/supervisord.d/
COPY rabbitmq.ini /etc/supervisord.d/
COPY rabbitmqctl.ini /etc/supervisord.d/
COPY rabbitmq.json /etc/rabbitmq/
COPY rabbittrace-0.1-jar-with-dependencies.jar /root/
EXPOSE 5672 15672 4369 25672
CMD ["supervisord","-c","/etc/supervisord.conf"]
ENV RABBITMQ_LOGS=/tmp/lograbbitmq RABBITMQ_SASL_LOGS=/tmp/lograbbitmq
COPY container_files/usr-local-bin/ /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["rabbitmq-server"]
14 changes: 5 additions & 9 deletions README.md
@@ -1,13 +1,9 @@
# rabbitmq-docker
# rabbitmq

This container has rabbitmq built on centos latest
and has a Java based trace class that uses rabbitmq
firehose tracing to write message traces to
/var/log/rabbitmq/trace.log as well as to stdout.

Supervisor is used to start rabbitmq-server and Java
for the trace class, as well as to turn on rabbitmq
tracing.
This is a wrapper container for the mainstream
rabbitmq-management container. It adds logging
in the TIER format including the ENV and USERTOKEN
environment variables.

Ethan Kromhout ethan@kromhout.us ethan@unc.edu

5 changes: 5 additions & 0 deletions container_files/usr-local-bin/entrypoint.sh
@@ -0,0 +1,5 @@
#!/bin/sh

. /usr/local/bin/library.sh
prepConf
exec "$@"
24 changes: 24 additions & 0 deletions container_files/usr-local-bin/library.sh
@@ -0,0 +1,24 @@
#!/bin/sh

setupPipe() {
if [ -e $1 ]; then
rm $1
fi
mkfifo -m 666 $1
}

setupLoggingPipe() {
# Make a "console" logging pipe that anyone can write too regardless of who owns the process.
setupPipe /tmp/logpipe
cat <> /tmp/logpipe &
}

# Make a formatted stream to the logging pipe from rabbitmq
setupRabbitmqLog() {
(tail -F /tmp/lograbbitmq | sed -u -r "s/^/rabbitmq\;console\;$ENV\;$USERTOKEN\;/" > /tmp/logpipe) &
}

prepConf() {
setupLoggingPipe
setupRabbitmqLog
}

0 comments on commit b5f1da1

Please sign in to comment.