R
Railway5mo ago
Jaymart

deploying rabbitMQ clusters

Im following this guide https://github.com/serkodev/rabbitmq-cluster-docker/blob/master/docker-compose.yml I have the first instance up and running but when I try to run the second instance it just hangs here
Starting RabbitMQ Server for host: railway

Waiting for pid file '/usr/var/lib/rabbitmq/mnesia/[email protected]' to appear
Starting RabbitMQ Server for host: railway

Waiting for pid file '/usr/var/lib/rabbitmq/mnesia/[email protected]' to appear
and never starts.
GitHub
rabbitmq-cluster-docker/docker-compose.yml at master · serkodev/rab...
1-click setup RabbitMQ Cluster with Docker Compose - serkodev/rabbitmq-cluster-docker
2 Replies
Percy
Percy5mo ago
Project ID: 148eb60b-cb64-411a-8789-fbfd534512b7
Jaymart
JaymartOP5mo ago
148eb60b-cb64-411a-8789-fbfd534512b7 my dockerfile for the second instance
FROM rabbitmq:management-alpine

COPY .erlang.cookie /usr/var/lib/rabbitmq/.erlang.cookie
COPY cluster-entrypoint.sh /usr/local/bin/cluster-entrypoint.sh
COPY src/rabbitmq/plugins /plugins/

RUN set -eux; \
rabbitmq-plugins enable --offline rabbitmq_management rabbitmq_message_deduplication; \
rm -f /etc/rabbitmq/conf.d/20-management_agent.disable_metrics_collector.conf; \
cp /plugins/rabbitmq_management-*/priv/www/cli/rabbitmqadmin /usr/local/bin/rabbitmqadmin; \
[ -s /usr/local/bin/rabbitmqadmin ]; \
chmod +x /usr/local/bin/rabbitmqadmin; \
apk add --no-cache python3; \
rabbitmqadmin --version

ENV JOIN_CLUSTER_HOST=rabbitmq-cluster1@railway
ENV RABBITMQ_NODENAME=rabbitmq-cluster2

RUN chmod 755 /usr/local/bin/cluster-entrypoint.sh

ENTRYPOINT ["/usr/local/bin/cluster-entrypoint.sh"]
CMD ["rabbitmq-server"]
FROM rabbitmq:management-alpine

COPY .erlang.cookie /usr/var/lib/rabbitmq/.erlang.cookie
COPY cluster-entrypoint.sh /usr/local/bin/cluster-entrypoint.sh
COPY src/rabbitmq/plugins /plugins/

RUN set -eux; \
rabbitmq-plugins enable --offline rabbitmq_management rabbitmq_message_deduplication; \
rm -f /etc/rabbitmq/conf.d/20-management_agent.disable_metrics_collector.conf; \
cp /plugins/rabbitmq_management-*/priv/www/cli/rabbitmqadmin /usr/local/bin/rabbitmqadmin; \
[ -s /usr/local/bin/rabbitmqadmin ]; \
chmod +x /usr/local/bin/rabbitmqadmin; \
apk add --no-cache python3; \
rabbitmqadmin --version

ENV JOIN_CLUSTER_HOST=rabbitmq-cluster1@railway
ENV RABBITMQ_NODENAME=rabbitmq-cluster2

RUN chmod 755 /usr/local/bin/cluster-entrypoint.sh

ENTRYPOINT ["/usr/local/bin/cluster-entrypoint.sh"]
CMD ["rabbitmq-server"]
#!/bin/bash

set -e

# Change .erlang.cookie permission
chmod 400 /usr/var/lib/rabbitmq/.erlang.cookie

# Use the FQDN provided by Railway
HOSTNAME=$(hostname -f)
echo "Starting RabbitMQ Server for host: $HOSTNAME"

if [ -z "$JOIN_CLUSTER_HOST" ]; then
/usr/local/bin/docker-entrypoint.sh rabbitmq-server &
sleep 30
rabbitmqctl wait --timeout 60000 /usr/var/lib/rabbitmq/mnesia/rabbit@$HOSTNAME.pid
else
/usr/local/bin/docker-entrypoint.sh rabbitmq-server -detached
sleep 30
rabbitmqctl wait --timeout 60000 /usr/var/lib/rabbitmq/mnesia/rabbit@$HOSTNAME.pid
echo "Stopping RabbitMQ application on node $HOSTNAME..."
rabbitmqctl stop_app
echo "Joining node $HOSTNAME to cluster $JOIN_CLUSTER_HOST..."
rabbitmqctl join_cluster $JOIN_CLUSTER_HOST
if [ $? -ne 0 ]; then
echo "Error joining cluster. Exiting."
exit 1
fi
echo "Starting RabbitMQ application on node $HOSTNAME..."
rabbitmqctl start_app
fi

# Keep foreground process active ...
tail -f /dev/null
#!/bin/bash

set -e

# Change .erlang.cookie permission
chmod 400 /usr/var/lib/rabbitmq/.erlang.cookie

# Use the FQDN provided by Railway
HOSTNAME=$(hostname -f)
echo "Starting RabbitMQ Server for host: $HOSTNAME"

if [ -z "$JOIN_CLUSTER_HOST" ]; then
/usr/local/bin/docker-entrypoint.sh rabbitmq-server &
sleep 30
rabbitmqctl wait --timeout 60000 /usr/var/lib/rabbitmq/mnesia/rabbit@$HOSTNAME.pid
else
/usr/local/bin/docker-entrypoint.sh rabbitmq-server -detached
sleep 30
rabbitmqctl wait --timeout 60000 /usr/var/lib/rabbitmq/mnesia/rabbit@$HOSTNAME.pid
echo "Stopping RabbitMQ application on node $HOSTNAME..."
rabbitmqctl stop_app
echo "Joining node $HOSTNAME to cluster $JOIN_CLUSTER_HOST..."
rabbitmqctl join_cluster $JOIN_CLUSTER_HOST
if [ $? -ne 0 ]; then
echo "Error joining cluster. Exiting."
exit 1
fi
echo "Starting RabbitMQ application on node $HOSTNAME..."
rabbitmqctl start_app
fi

# Keep foreground process active ...
tail -f /dev/null
and the entrypoint
Want results from more Discord servers?
Add your server