Skip to content

Commit

Permalink
Fixed RabbitMQ directory ownership issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dgil committed May 3, 2016
1 parent f1eecc8 commit 86bbd6b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM rabbitmq:3.5.3-management
MAINTAINER Dimitris Kapanidis [email protected]

COPY rabbitmq-cluster /usr/local/bin/
COPY pre-entrypoint.sh /

EXPOSE 5672 15672 25672 4369 9100 9101 9102 9103 9104 9105
USER rabbitmq
ENTRYPOINT ["/pre-entrypoint.sh"]
CMD ["rabbitmq-cluster"]
6 changes: 3 additions & 3 deletions captain.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build:
images:
Dockerfile: harbur/rabbitmq-cluster
rabbitmq-cluster:
build: Dockerfile
image: harbur/rabbitmq-cluster
22 changes: 22 additions & 0 deletions pre-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

mkdir -p /var/lib/rabbitmq

if [ "$ERLANG_COOKIE" ]; then
cookieFile='/var/lib/rabbitmq/.erlang.cookie'
if [ -e "$cookieFile" ]; then
if [ "$(cat "$cookieFile" 2>/dev/null)" != "$ERLANG_COOKIE" ]; then
echo >&2
echo >&2 "warning: $cookieFile contents do not match ERLANG_COOKIE"
echo >&2
fi
else
echo "$ERLANG_COOKIE" > "$cookieFile"
chmod 600 "$cookieFile"
chown rabbitmq "$cookieFile"
fi
fi

chown rabbitmq:rabbitmq /var/lib/rabbitmq
exec gosu rabbitmq ./docker-entrypoint.sh "$@"
3 changes: 0 additions & 3 deletions rabbitmq-cluster
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

echo $ERLANG_COOKIE > /var/lib/rabbitmq/.erlang.cookie
chmod 700 /var/lib/rabbitmq/.erlang.cookie

hostname=`hostname`
RABBITMQ_NODENAME=${RABBITMQ_NODENAME:-rabbit}

Expand Down

0 comments on commit 86bbd6b

Please sign in to comment.