A Flask blueprint for recieving GitHub post-recieve webhooks, and a small Flask app for running shell scripts.
- Create a user on GitHub for doing backups.
- Add this user (read-only) to any repos/organizations.
- Setup an SSH key for the user under which this will run, and add it to the GitHub account.
- Install the code:
git clone git@github.com:mikeboers/Flask-GitHubHook.git
cd Flask-GitHubHook
. bin/bootstrap.sh
- Add the hook (
http://dev1.fluentimage.com:8010/
) to every you want to back up.
DEBUG=1 python -m githubhookapp
# or
honcho start
Send the example payload:
curl -L -d "payload=$(cat example-payload.json)" http://localhost:5000
honcho export --app githubhook --port 8010 --log var/log upstart var/etc/init
sudo cp var/etc/init/* /etc/init/
sudo initctl reload-configuration
sudo start githubhook