5 Elements: Docker, Registrator, Consul, Consul Template, Nginx
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
trex-service
.gitignore
Dockerfile
LICENSE
README.md
app.conf
nginx.conf
nginx.ctmpl

README.md

confroxy

5 Elements: Docker, Registrator, Consul, Consul Template, Nginx

Create Dockerfile for your service

Tools

Other Alternative
Another way to do that listen docker events manually (for example: node-docker-monitor) and register or deregister services from consul then update your proxy tool (for example: node-http-proxy)

run consul

docker run -it -h node \
 -p 8500:8500 \
 -p 8600:53/udp \
 gliderlabs/consul-server \
 -server \
 -bootstrap \
 -advertise localhost \
 -log-level debug

run registrator

docker run -d \
    --name=registrator \
    --net=host \
    --volume=/var/run/docker.sock:/tmp/docker.sock \
    gliderlabs/registrator:latest \
      consul://localhost:8500

run confroxy (preconfigured consul template and nginx service)

docker run -it  --net=host -e "CONSUL=127.0.0.1:8500" -e "SERVICE=trex-svc" -p 80:80 confroxy

build your service image

docker build -t trex/server .

run your service instances

docker service scale trex=3 will do that if you like to try new stuff (:

stating services manually

docker run -it -e "SERVICE=trex-svc" -p 8000:80 trex/server
docker run -it -e "SERVICE=trex-svc" -p 8001:80 trex/server
docker run -it -e "SERVICE=trex-svc" -p 8002:80 trex/server