Public Repository

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

Nginx Consul Template


1) Alpine Linux
2) Nginx
3) Consul Template

sudo docker run -p 80:80 -d --name nginx microservicedockerfiles/nginxconsul "$IP"

$IP : yout consul agent's ip. If you do not specify any ip

Service registration:


We are using Registrator to sync services on our consul cluster.
To add services from consul to nginx run contains provided with service tag:

##sudo docker run -p 80:80 -d -e "SERVICE_TAGS=service" --name nginx microservicedockerfiles/nginxconsul "$IP"

Have to add -e "SERVICE_TAGS=service" to every container your nginx should keep track of.

Consul Raw

If you run on raw consul and register over rest api, you can provide the service tag in the consul Tags array.

How does it work

Consul template registers on the consul agent passed with $IP. Every change triggers an refresh over nginx, updating the nginx index page, and the proxy options.
serverip:port shows the ingex pages, if one or more services are registert with the service tag.
serverip:port/server/$servicename provides one $servicename service with round robin.

Docker Pull Command