progrium/dokku — pull request #88 by eugeneware (2013-07-08 14:41:27+00:00)
Title: Rewrite nginx.conf files based on latest Docker dynamic port mappings on server reboot

When a server reboots all the dynamic port mappings from Docker get reset leading to `502 bad gateway` errors in Nginx, or even worse: the wrong servers displaying for different host names.

This PR addresses the issue in https://github.com/progrium/dokku/issues/82

It creates a new upstart service called `dokku.conf` which is run after `docker` that will iterate through the dokku apps, find the `CONTAINER` IDs, find the port mapping, rewrite the nginx.conf files and then reload nginx.