Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Switch RabbitMQ to TIER version
And add the code to create sampleQueue on the first run.
mederly committed Oct 9, 2018
1 parent e2dc3c3 commit d5165da
Showing 5 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/complex/docker-compose.yml
@@ -197,7 +197,7 @@ services:
- 4443:4443

mq:
image: rabbitmq:management
build: ./mq/
environment:
- RABBITMQ_NODENAME=docker-rabbit
hostname: rabbitmq
13 changes: 13 additions & 0 deletions demo/complex/mq/Dockerfile
@@ -0,0 +1,13 @@
FROM tier/rabbitmq:latest

COPY container_files/etc-rabbitmq/* /etc/rabbitmq/
COPY container_files/usr-local-bin/* /usr/local/bin/

ENV RABBITMQ_PID_FILE=/var/run/rabbitmq/pid

# Must be on /var/lib/rabbitmq (this is the same place where queues are defined)
ENV RABBITMQ_INIT_DONE_FILE=/var/lib/rabbitmq/initialization.done

ENTRYPOINT ["/usr/local/bin/demo-entrypoint.sh"]

CMD ["rabbitmq-server"]
2 changes: 2 additions & 0 deletions demo/complex/mq/container_files/etc-rabbitmq/rabbitmq.conf
@@ -0,0 +1,2 @@
# Allow guest access from anywhere (change this in production!)
loopback_users = none
@@ -0,0 +1,8 @@
#!/bin/bash

if [ ! -e $RABBITMQ_INIT_DONE_FILE ]; then
/usr/local/bin/initialize-rabbitmq.sh &
else
echo "RabbitMQ was already initialized"
fi
/usr/local/bin/entrypoint.sh "$@"
@@ -0,0 +1,11 @@
#!/bin/bash

set -e

echo "Executing RabbitMQ initialization"
echo "Waiting for the server to start up..."
rabbitmqctl -t 30 wait $RABBITMQ_PID_FILE
echo "OK, creating sampleQueue..."
rabbitmqadmin declare queue name=sampleQueue
echo "Done"
touch $RABBITMQ_INIT_DONE_FILE

0 comments on commit d5165da

Please sign in to comment.