Sign inSign up

cloudhero/nginx-consul-loadbalancer

By cloudhero

•Updated over 10 years ago

This container is a Nginx load balancer with upstream automatic update using Consul Template.

Image
1

677

cloudhero/nginx-consul-loadbalancer repository overview

#Nginx Load Balancer With Consul Template

Dockerfile for Nginx load balancer with upstream automatic update using Consul Template

⁠Use Docker HUB images

You can pull laatest built image from DockerHub:

docker pull cloudhero/nginx-consul-loadbalancer

Run image:

docker run -it -e "CONSUL=$DOCKER_IP:8500" -e "SERVICE=queryname" -p 80:80 cloudhero/nginx-consul-loadbalancer

CONSUL is the IP address of your Consul service, SERVICE is the query sent to consul which will be distributed across.

⁠Build your own image

Build with:

docker build -t nginx-consul-loadbalancer .

Run with:

docker run -it -e "CONSUL=$DOCKER_IP:8500" -e "SERVICE=queryname" -p 80:80 nginx-consul-loadbalancer

CONSUL is the IP address of your Consul service, SERVICE is the query sent to consul which will be distributed across.

##Customize nginx template

You can update nginx-vhost.conf.ctmpl based on your needs as loong as you keep the same query parameters.

⁠Known Issues

Currently this image has been tested and works well with Consul Template version 0.5.1 Latest version of Consul Template returs {{.Address}} query from {{.ServiceAddress}} which provides wrong upstream IP address.

⁠Read more here⁠

References: here⁠

Tag summary

Content type

Image

Digest

Size

98.3 MB

Last updated

over 10 years ago

docker pull cloudhero/nginx-consul-loadbalancer