Add consul discoverable architecture

pull/1/head
Baohua Yang 2015-08-18 10:47:49 +08:00
parent 734ea7ea3f
commit 39013928eb
2 changed files with 48 additions and 0 deletions

View File

@ -13,6 +13,9 @@ See [https://docs.docker.com/compose/](https://docs.docker.com/compose/).
# templates
## consul-discovery
Using consul to make a service-discoverable architecture.
## mongo_cluster
Start 3 mongo instance to make a replica set.

View File

@ -0,0 +1,45 @@
# This compose file will boot a typical scalable lb-backend topology.
# Registrator will listen on local docker socks to maintain all published containers. The information will be written to consulserver
# consul-template will listen on consulserver and update local lb configuration.
# http://yeasy.github.com
#backend web application, scale this with docker-compose scale web=3
web:
image: yeasy/simple-web:latest
environment:
SERVICE_80_NAME: http
SERVICE_NAME: web
SERVICE_TAGS: backend
ports:
- "80"
#load balancer will automatically update the config using consul-template
lb:
image: yeasy/nginx-consul-template:latest
hostname: lb
links:
- consulserver:consul
ports:
- "80:80"
consulserver:
image: gliderlabs/consul-server:latest
hostname: consulserver
ports:
- "8300"
- "8400"
- "8500:8500"
- "53"
command: -data-dir /tmp/consul -bootstrap -client 0.0.0.0
# listen on local docker sock to register the container with public ports to the consul service
registrator:
image: gliderlabs/registrator:master
hostname: registrator
links:
- consulserver:consul
volumes:
- "/var/run/docker.sock:/tmp/docker.sock"
command: -internal consul://consul:8500
#command: consul://consul:8500