hledger, ops, haskell
June 8, 2013

git pull hook, github service hook for quick site updates

Finished the hledger.org updating task begun yesterday. There were a few parts to this.

I added an executable `.git/hooks/post-merge’ script in the website repo:

#!/bin/sh
#
# Rebuild the website after a pull.

exec make site

Now it runs make site (rebuilding the hakyll script and any changed site content as necessary) after a successful git pull to this repo.

Then I configured a github service hook, using my setup for ledger-cli.org as a guide. Added another github listener daemon to /etc/supervisord.conf:

[program:hledger.org-webhook]
command=/src/github-listener/github-listener-yesod 10000 'sudo -u simon git pull'
directory=/src/hledger.org
priority=3
redirect_stderr=true
autostart=true
autorestart=true
environment=LANG="en_US.UTF-8"

activated it using supervisorctl:

supervisor> update
hledger.org-webhook: added process group
supervisor> status
...
hledger.org-webhook              RUNNING    pid 31379, uptime 0:00:02
...

and configure a webhook in the hledger repo on github, posting to http://hledger.org:10000/. Now any change landing in the github repo causes an immediate update of hledger.org.