Skip to content

Instantly share code, notes, and snippets.

@burtlo
Last active September 12, 2017 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burtlo/e44370e3ce43e6e4076d20a93e88ba28 to your computer and use it in GitHub Desktop.
Save burtlo/e44370e3ce43e6e4076d20a93e88ba28 to your computer and use it in GitHub Desktop.
Web Application with a Load Balancer
{
"changed": true,
"census_groups": {
"haproxy.default": {
"service_group": "haproxy.default",
"election_status": "None",
"update_election_status": "None",
"leader_id": null,
"service_config": null,
"local_member_id": "67e892170b80482d98bb259389ce951d",
"population": {
"67e892170b80482d98bb259389ce951d": {
"member_id": "67e892170b80482d98bb259389ce951d",
"pkg": {
"origin": "franklinwebber",
"name": "haproxy",
"version": "1.6.11",
"release": "20170912154724"
},
"application": null,
"environment": null,
"service": "haproxy",
"group": "default",
"org": null,
"persistent": true,
"leader": false,
"follower": false,
"update_leader": false,
"update_follower": false,
"election_is_running": false,
"election_is_no_quorum": false,
"election_is_finished": false,
"update_election_is_running": false,
"update_election_is_no_quorum": false,
"update_election_is_finished": false,
"sys": {
"ip": "172.22.0.4",
"hostname": "e85809a68a78",
"gossip_ip": "172.22.0.4",
"gossip_port": 9638,
"http_gateway_ip": "0.0.0.0",
"http_gateway_port": 9631
},
"alive": true,
"suspect": false,
"confirmed": false,
"departed": false,
"cfg": {
"port": 80,
"status-port": 9000
}
}
},
"update_leader_id": null,
"changed_service_files": [],
"service_files": {}
},
"webapp.default": {
"service_group": "webapp.default",
"election_status": "None",
"update_election_status": "None",
"leader_id": null,
"service_config": null,
"local_member_id": "67e892170b80482d98bb259389ce951d",
"population": {
"e7777178fda14b78a959f4906c2d8969": {
"member_id": "e7777178fda14b78a959f4906c2d8969",
"pkg": {
"origin": "franklinwebber",
"name": "webapp",
"version": "0.1.0",
"release": "20170912153057"
},
"application": null,
"environment": null,
"service": "webapp",
"group": "default",
"org": null,
"persistent": true,
"leader": false,
"follower": false,
"update_leader": false,
"update_follower": false,
"election_is_running": false,
"election_is_no_quorum": false,
"election_is_finished": false,
"update_election_is_running": false,
"update_election_is_no_quorum": false,
"update_election_is_finished": false,
"sys": {
"ip": "172.22.0.2",
"hostname": "a4a69714b4b7",
"gossip_ip": "172.22.0.2",
"gossip_port": 9638,
"http_gateway_ip": "0.0.0.0",
"http_gateway_port": 9631
},
"alive": true,
"suspect": false,
"confirmed": false,
"departed": false,
"cfg": {}
},
"f45278bf260a4d228421a9ab182d0290": {
"member_id": "f45278bf260a4d228421a9ab182d0290",
"pkg": {
"origin": "franklinwebber",
"name": "webapp",
"version": "0.1.0",
"release": "20170912153057"
},
"application": null,
"environment": null,
"service": "webapp",
"group": "default",
"org": null,
"persistent": true,
"leader": false,
"follower": false,
"update_leader": false,
"update_follower": false,
"election_is_running": false,
"election_is_no_quorum": false,
"election_is_finished": false,
"update_election_is_running": false,
"update_election_is_no_quorum": false,
"update_election_is_finished": false,
"sys": {
"ip": "172.22.0.3",
"hostname": "da492836b513",
"gossip_ip": "172.22.0.3",
"gossip_port": 9638,
"http_gateway_ip": "0.0.0.0",
"http_gateway_port": 9631
},
"alive": true,
"suspect": false,
"confirmed": false,
"departed": false,
"cfg": {}
}
},
"update_leader_id": null,
"changed_service_files": [],
"service_files": {}
}
},
"local_member_id": "67e892170b80482d98bb259389ce951d",
"last_service_counter": 3,
"last_election_counter": 0,
"last_election_update_counter": 0,
"last_membership_counter": 3,
"last_service_config_counter": 0,
"last_service_file_counter": 0
}
version: '3'
services:
webapp-1:
image: franklinwebber/webapp
ports:
- "8000:80"
- "9631:9631"
webapp-2:
image: franklinwebber/webapp
command: --peer webapp-1
links:
- webapp-1
ports:
- "8001:80"
- "9632:9631"
lb-1:
image: franklinwebber/haproxy
command: --peer webapp-2 --bind backend:webapp.default
links:
- webapp-2
ports:
- "8002:80"
- "9633:9631"
global
maxconn 32
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:80
default_backend default
backend default
option httpchk GET /
server first 172.17.0.3:8000
server second 172.17.0.4:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment