Public Repository

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description

Nginx Consul Template

Contains:

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 192.168.33.10.

Service registration:

Registrator

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. https://www.consul.io/docs/agent/http/catalog.html#catalog_register

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
Owner
microservicedockerfiles

Comments (0)