Skip to content
Permalink
Browse files

Proposed wrapper container for review

  • Loading branch information
ethan committed Sep 6, 2018
1 parent 6ae5c03 commit b5f1da16ed244e1888d0a7a627b4f30352951bfd
Showing with 39 additions and 40 deletions.
  1. +5 −31 Dockerfile
  2. +5 −9 README.md
  3. +5 −0 container_files/usr-local-bin/entrypoint.sh
  4. +24 −0 container_files/usr-local-bin/library.sh
@@ -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"]
@@ -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

@@ -0,0 +1,5 @@
#!/bin/sh

. /usr/local/bin/library.sh
prepConf
exec "$@"
@@ -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.
You can’t perform that action at this time.