I am trying to run a cluster of rabbitmq servers but only one node keeps showing up in the ui and using the http api. The nodes are all available as I see that they switch out on each other but the 3 of them don’t recognise each other.
My Dockerfile
FROM rabbitmq:4.1.7-management-alpine
RUN rabbitmq-plugins enable rabbitmq_management
COPY erl_inetrc /etc/rabbitmq/erl_inetrc
COPY ./prod.conf /etc/rabbitmq/rabbitmq.conf
ENV RABBITMQ_CONFIG_FILE=/etc/rabbitmq/rabbitmq.conf
ENV RABBITMQ_USE_LONGNAME=true
ENV RABBITMQ_ERLANG_COOKIE=“5CkZdm5nCO4dqxuQy5H0AJZYGy2pKQUZ”
COPY entrypoint.sh /usr/local/bin/custom-entrypoint.sh
RUN chmod +x /usr/local/bin/custom-entrypoint.sh
USER root
ENTRYPOINT [“/usr/local/bin/custom-entrypoint.sh”]
CMD [“rabbitmq-server”]
My entrypoint.sh
#!/bin/sh
set -e
echo “=== RabbitMQ Fly.io IPv6 Setup ===”
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq /etc/rabbitmq
FQDN=“${FLY_MACHINE_ID}.vm.${FLY_APP_NAME}.internal”
export RABBITMQ_NODENAME=“rabbit@${FQDN}”
export RABBITMQ_USE_LONGNAME=true
if [ -z “$RABBITMQ_ERLANG_COOKIE” ]; then
echo “ERROR: RABBITMQ_ERLANG_COOKIE is missing”
exit 1
fi
echo “${RABBITMQ_ERLANG_COOKIE}” > /var/lib/rabbitmq/.erlang.cookie
chmod 600 /var/lib/rabbitmq/.erlang.cookie
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
export RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=“-kernel inetrc ‘/etc/rabbitmq/erl_inetrc’ -proto_dist inet6_tcp -setcookie ${RABBITMQ_ERLANG_COOKIE}”
export RABBITMQ_CTL_ERL_ARGS=“-proto_dist inet6_tcp --longnames”
RANDOM_DELAY=$((5 + RANDOM % 70))
echo “Sleeping ${RANDOM_DELAY}s for DNS propagation…”
sleep $RANDOM_DELAY
exec /usr/local/bin/docker-entrypoint.sh “$@”
erl_inetrc
{inet6, true}.
fly.toml
app = ‘rabbits-messing-with-me’
primary_region = ‘lhr’
[build]
[deploy]
strategy = ‘rolling’
[env]
RABBITMQ_MNESIA_DIR = ‘/var/lib/rabbitmq’
[[mounts]]
source = ‘rabbitmq_data’
destination = ‘/var/lib/rabbitmq’
initial_size = ‘20’
[[services]]
protocol = ‘tcp’
internal_port = 15672
auto_stop_machines = ‘off’
auto_start_machines = true
min_machines_running = 2
[[services.ports]]
port = 15672
[[services.tcp_checks]]
interval = ‘15s’
timeout = ‘1m0s’
grace_period = ‘1m0s’
[[vm]]
memory = ‘2gb’
cpus = 2
memory_mb = 2048
and then prod.conf
listeners.tcp.default = 5672
management.tcp.ip = ::
management.tcp.port = 15672
distribution.listener.interface = ::
default_user = user
default_pass = password
anonymous_login_user = none
vm_memory_high_watermark.relative = 0.7
disk_free_limit.absolute = 500MB
cluster_formation.peer_discovery_backend = dns
cluster_formation.dns.hostname = rabbits-messing-with-me.internal
cluster_name = rabbits-messaging-quacks
default_queue_type = quorum
distribution.listener.port_range.min = 25672
distribution.listener.port_range.max = 25672
log.console = true
log.console.level = info
I have tried other methods but currently I am using flycast with ipv6 only. I proxy into the management ui as I don’t need it exposed to the internet.
Any pointers would be great so these rabbits can stop messing with me. I have been running for a while
.
Thank you