Skip to content

Instantly share code, notes, and snippets.

@gerhard
Last active March 6, 2019 18:03
Show Gist options
  • Save gerhard/cb49649bda01da2a61496ab82510fcbd to your computer and use it in GitHub Desktop.
Save gerhard/cb49649bda01da2a61496ab82510fcbd to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
docker-compose up --remove-orphans --detach
while ! docker-compose exec rmq1 rabbitmqctl await_online_nodes 1
do
sleep 1
done
echo "SYSTEM HOSTNAME"
docker-compose exec rmq1 hostname
echo "INET_DB HOSTNAME"
docker-compose exec rmq1 rabbitmqctl eval 'inet_db:gethostname().'
echo "NODE"
docker-compose exec rmq1 rabbitmqctl eval 'node().'
if docker-compose exec rmq1 rabbitmqctl -n rabbit@rmq2 shutdown --wait
then
echo "ERROR: expecting rabbitmqctl shutdown --wait against remote node to fail, but it didn't"
exit 1
fi
docker-compose kill && docker system prune
version: "3.7"
services:
rmq1:
image: rabbitmq:3.7
hostname: localhost
environment:
RABBITMQ_ERLANG_COOKIE: &cookie shutdown
RABBITMQ_NODENAME: rabbit@rmq1
volumes:
- ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
- /Users/gerhard/github.com/rabbitmq/3.7/deps/rabbitmq_server_release/PACKAGES/rabbitmq_server-3.7.8+rc.3.6.g3d679fa/escript:/opt/rabbitmq/escript:ro
rmq2:
image: rabbitmq:3.7
hostname: localhost
environment:
RABBITMQ_ERLANG_COOKIE: *cookie
RABBITMQ_NODENAME: rabbit@rmq2
volumes:
- ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
- /Users/gerhard/github.com/rabbitmq/3.7/deps/rabbitmq_server_release/PACKAGES/rabbitmq_server-3.7.8+rc.3.6.g3d679fa/escript:/opt/rabbitmq/escript:ro
cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
cluster_formation.classic_config.nodes.1 = rabbit@rmq1
cluster_formation.classic_config.nodes.2 = rabbit@rmq2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment