Skip to content

rrva/docker-nginx-dynamic

Repository files navigation

Docker nginx+webapp with dynamic nginx reconfig

Based on http://brianketelsen.com/2014/02/25/using-nginx-confd-and-docker-for-zero-downtime-web-updates/

Uses https://github.com/BlueDragonX/sentinel

Publishes all docker containers exposing 8080 to etcd key /myapp/upstream

Sentinel watches etcd key /myapp/upstream and updates nginx config on change

      +---+sentinel                  
      |       +                      
      |       |        +------+webapp
      +       +        |             
    etcd+--+nginx+-----+             
                       |             
                       +------+webapp

build_all_docker_containers.sh

builds all containers, needs maven since we use a java webapp in this example

run_all_docker_containers.sh

runs an etcd container, two webapp containers and a nginx container

publish_nginx_containers.py

publishes all containers exposing :8080 to etcd:/myapp/upstream

republish webapp containers to nginx

you can start/stop further webapp container and run

publish_nginx_containers.py

to see changes in nginx config

curl -I nginx-public-ip:80

Look for X-Upstream HTTP header

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published