Use clustered sensu in docker-compose.yaml
This commit adds two additional backend nodes to the docker compose
as well as two additional agents. Each agent connects to one
backend.
version: '3'
services:
- sensu-backend1:
+ backend1:
image: sensu/sensu:master
- command: sensu-backend start --listen-client-urls http://0.0.0.0:2379
+ command: sensu-backend start --listen-client-urls http://0.0.0.0:2379 --name backend1 --initial-cluster backend1=http://backend1:2380,backend2=http://backend2:2380,backend3=http://backend3:2380 --initial-cluster-state new --initial-advertise-peer-urls http://backend1:2380 --state-dir /var/lib/sensu/etcd1 --listen-peer-urls http://0.0.0.0:2380
hostname: backend1
restart: always
ports:
@@ -10,10 +10,38 @@ services:
- "2380:2380"
- "8080:8080"
- "8081:8081"
+ backend2:
+ image: sensu/sensu:master
+ command: sensu-backend start --listen-client-urls http://0.0.0.0:2379 --name backend2 --initial-cluster backend1=http://backend1:2380,backend2=http://backend2:2380,backend3=http://backend3:2380 --initial-cluster-state new --initial-advertise-peer-urls http://backend2:2380 --state-dir /var/lib/sensu/etcd2 --listen-peer-urls http://0.0.0.0:2380
+ hostname: backend2
+ restart: always
+ ports:
+ - "12379:2379"
+ - "12380:2380"
+ - "18080:8080"
+ - "18081:8081"
+ backend3:
+ image: sensu/sensu:master
+ command: sensu-backend start --listen-client-urls http://0.0.0.0:2379 --name backend3 --initial-cluster backend1=http://backend1:2380,backend2=http://backend2:2380,backend3=http://backend3:2380 --initial-cluster-state new --initial-advertise-peer-urls http://backend3:2380 --state-dir /var/lib/sensu/etcd3 --listen-peer-urls http://0.0.0.0:2380
+ hostname: backend3
+ restart: always
+ ports:
+ - "22379:2379"
+ - "22380:2380"
+ - "28080:8080"
+ - "28081:8081"
sensu-agent1:
image: sensu/sensu:master
- command: sensu-agent start --backend-url ws://sensu-backend1:8081 --subscriptions test
+ command: sensu-agent start --backend-url ws://backend1:8081 --subscriptions test
hostname: agent1
restart: always
- links:
- - sensu-backend1:backend1
+ sensu-agent2:
+ image: sensu/sensu:master
+ command: sensu-agent start --backend-url ws://backend2:8081 --subscriptions test
+ hostname: agent2
+ restart: always
+ sensu-agent3:
+ image: sensu/sensu:master
+ command: sensu-agent start --backend-url ws://backend3:8081 --subscriptions test
+ hostname: agent3
+ restart: always
