HUB
Sign inSign up

microservicedockerfiles/nginxconsul

By microservicedockerfiles

•Updated over 10 years ago

Artifact
1

241

microservicedockerfiles/nginxconsul repository overview

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

Tag summary

Content type

Unrecognized

Digest

Size

88 MB

Last updated

over 10 years ago

docker pull microservicedockerfiles/nginxconsul