Mount .erlang.cookie file

Context: we want to move away from environment variables and use either
config files or env files (such as the rabbitmq-env.conf).

Since .erlang.cookie is neither, the official RabbitMQ Docker image
handles this by writing the value from the RABBITMQ_ERLANG_COOKIE env
var into the file if it does not exist. The problem is that if this file
exists, and the value is different from the RABBITMQ_ERLANG_COOKIE env
var, CLI tools will not be able to communicate with the rabbit node, as
described here: https://github.com/rabbitmq/rabbitmq-cli/issues/443

The only gotcha is that this file must be owned by the user, and
privileges should not be too open (git should have captured this). If
not, RabbitMQ will fail to boot. This is somewhat similar to how OpenSSH
reacts when private key permissions are too open.

re https://github.com/docker-library/rabbitmq/pull/422#issuecomment-650074731

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
This commit is contained in:
Gerhard Lazu 2020-07-01 17:07:16 +01:00
parent 2b66cd1228
commit 9452cf179b
4 changed files with 10 additions and 6 deletions

View File

@ -26,9 +26,10 @@ services:
cap_add:
- ALL
hostname: rmq0-dist-tls
environment:
RABBITMQ_ERLANG_COOKIE: rmq0-dist-tls
# environment:
# RABBITMQ_LOG: debug,+color
volumes:
- ./erlang.cookie:/var/lib/rabbitmq/.erlang.cookie
- ./rabbitmq-dist-tls.conf:/etc/rabbitmq/rabbitmq.conf:ro
- ./rabbitmq-env.conf:/etc/rabbitmq/rabbitmq-env.conf:ro
- ./rabbitmq-ssl_dist.config:/etc/rabbitmq/ssl_dist.config:ro

View File

@ -26,9 +26,10 @@ services:
cap_add:
- ALL
hostname: rmq0
environment:
RABBITMQ_ERLANG_COOKIE: rabbitmq-overview
# environment:
# RABBITMQ_LOG: debug,+color
volumes:
- ./erlang.cookie:/var/lib/rabbitmq/.erlang.cookie
- ./rabbitmq-overview.conf:/etc/rabbitmq/rabbitmq.conf:ro
- ./rabbitmq-overview-definitions.json:/etc/rabbitmq/rabbitmq-definitions.json:ro
# we want to simulate hitting thresholds

View File

@ -26,9 +26,10 @@ services:
cap_add:
- ALL
hostname: rmq0-qq
environment:
RABBITMQ_ERLANG_COOKIE: rabbitmq-qq
# environment:
# RABBITMQ_LOG: debug,+color
volumes:
- ./erlang.cookie:/var/lib/rabbitmq/.erlang.cookie
- ./rabbitmq-qq.conf:/etc/rabbitmq/rabbitmq.conf:ro
- ./rabbitmq-qq-env.conf:/etc/rabbitmq/rabbitmq-env.conf:ro
- ./rabbitmq-qq-definitions.json:/etc/rabbitmq/rabbitmq-definitions.json:ro

View File

@ -0,0 +1 @@
rabbitmq-prometheus