Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Add Consul example #5

Merged
merged 1 commit into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions examples/compose_consul_haproxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
RabbitMQ-Autoclsuter Consul example
--
Dynamic RabbitMQ cluster using:

1. [Docker compose](https://docs.docker.com/compose/)

2. [Consul](https://www.consul.io)

3. [HA proxy](https://github.com/docker/dockercloud-haproxy)


Execute
--
```
git clone https://github.com/rabbitmq/rabbitmq-autocluster.git .
make dist
docker build -t rabbitmq/rabbitmq-autocluster .
cd examples/compose_consul_haproxy
docker-compose up
docker-compose scale rabbit=3
```

Check
--

Consul Management: http://localhost:8500/ui/
RabbitMQ Management: http://localhost:15672/#/
49 changes: 49 additions & 0 deletions examples/compose_consul_haproxy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: "2"
services:
rabbit:
environment:
- RABBITMQ_ERLANG_COOKIE='secret_cookie'
- TCP_PORTS=15672, 5672
- AUTOCLUSTER_TYPE=consul
- AUTOCLUSTER_DELAY=60
- CONSUL_HOST=consul
- CONSUL_SVC_ADDR_AUTO=true
- AUTOCLUSTER_CLEANUP=true
- CLEANUP_WARN_ONLY=false
- CONSUL_DEREGISTER_AFTER=60
networks:
- back
image: rabbitmq/rabbitmq-autocluster
expose:
- 15672
- 5672
- 5671
- 15671
tty: true
command: sh -c "sleep 10; rabbitmq-server;"
lb:
image: dockercloud/haproxy
environment:
- MODE=tcp
links:
- rabbit
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- 15672:15672
- 5672:5672
networks:
- back
consul1:
image: "consul"
container_name: "consul"
hostname: "consul"
ports:
- "8400:8400"
- "8500:8500"
- "8600:53"
networks:
- back

networks:
back: