18F/18f.gsa.gov — pull request #145 by konklone (2014-09-12 20:52:49+00:00)
Title: Working deploy/hook system

This uses [`hookshot`](https://github.com/coreh/hookshot) (though specifically, a [fork of it](https://github.com/VesQ/hookshot) that has a bugfix) to listen on port 3000 and await GitHub post-receive hooks. These events fire on commits, and merged pull requests.

The service has our deploy configuration more or less hardcoded: it watches for changes to `production` and `staging` branches, and runs a `git pull` command in the appropriate directory for either of them. It will do nothing (except a bit of logging) for pushes relating to other branches.

This will **make the production site update automatically** when the `production` branch is changed. Same for staging, though less need for boldface.

There is no rollback facility built in, this is a real simple script. Rollback could be achieved by visiting the server and running the appropriate `git checkout` command, or making subsequent changes, or using some other form of merge/revert git work that would cause a `git pull` on the server to update to the desired state.

This hook will depend on nginx forwarding requests for a certain path to port 3000. I think I'll choose `/deploy` as the path prefix, which means the actual Jekyll site can't use that directory. This is relatively easy to pull off, since this adds a `/deploy` directory to the project that will naturally keep stuff out of there.