teslaworksumn/teslaworks.net — pull request #136 by tylrtrmbl (2013-09-15 04:20:11+00:00)
Title: Doctor for docker

This containerizes our actual app, devoid of any configuration and data.

The idea is that __GitHub holds a version history of the empty website__, and __Docker holds a version history of the running image__ (with commit history of source, data, databases, and configuration).

For an imaginary third party *only using* our website, they can do this:

1. `docker pull` to get our blank website, auto-built from the commit hook we'll set up
2. Run the site with `docker run -d -p 80:80 teslaworksumn/teslaworks.net /root/run.sh`
* This hopefully generates a lot of data we don't want to lose!
3. Update the site by:
1. Committing the current version of the app `docker commit $RUNNING_CONTAINER_ID teslaworksumn/teslaworks.net:staging`
2. Updating the resulting image, which provides a new container for testing: `docker run teslaworksumn/teslaworks.net:staging /root/update.sh`
3. After testing, commit the container to become the new latest version of the site: `docker commit $TESTING_CONTAINER_ID teslaworksumn/teslaworks.net`

If anything goes wrong later, we can revert to a prior image by inspecting `docker history teslaworksumn/teslaworks.net` and picking a good prior working image. We can also push to remote Docker image repository for backing up the full image of our site, ready to run, with real production data and everything!