Sign inSign up

sabdhagiri/nginx

By sabdhagiri

Updated over 9 years ago

nginx service for dynamic load balancing using consul, registrator, consul-template

Image
0

1.1K

sabdhagiri/nginx repository overview

Custom nginx image for Dynamic service discovery and auto-reconfigure of the nginx config file of application proxied by nginx as a load balancer.

Pre-requisites:

consul running on the node, this will be linked to our nginx container. registrator running on the node for automatically register and deregister services.

Usage:

docker run --name nginx -d -p 80:80 -v /tmp/todo.ctmpl:/templates/service.ctmpl --link consul:consul [OPTIIONS] sabdhagiri/nginx:latest

Sample todo.ctmpl file:

upstream todo {
    least_conn;
    {{range service "todo"}}server {{.Address}}:{{.Port}};
    {{else}}server 127.0.0.1:80; # force a 502{{end}}
}

server {
    listen 80 default_server;

    location / {
        proxy_pass http://todo;
    }
}

Tag summary

Content type

Image

Digest

Size

70.6 MB

Last updated

over 9 years ago

docker pull sabdhagiri/nginx