githook

command module
v0.0.0-...-6e51cac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2015 License: MIT Imports: 11 Imported by: 0

README

githook

Githook is a simple "Continuous Integration"-like self-hosted service that can receive GitHub webhooks and update local repositories accordingly. Githook is currently best for static sites, like my own austindizzy.me, that have their entire static source hosted on GitHub.

GitHook currently supports the following:

  • HMAC - SHA1 Secrets
  • Monitoring multiple repositories (theoretically, an unlimited amount)
  • Easy configuration
  • Easy service monitoring
  • Easy deployment (with and without Go)
  • More features to come.

Currently, githook is as simple as can be and was done in a few hours as a proof of concept and time consumer.

##Installation

Installing and setting up githook is simple (hopefully).

With Go:

$ go get github.com/austindizzy/githook
$ cd $GOPATH/src/github.com/austindizzy/githook
$ make install

Then, follow instructions detailed in Configuration.

Without Go:

  • Find your appropriate binary at GoBuild
  • Copy /init.d/githook to /etc/init.d/githook on your system as root.
  • As root, chmod /etc/init.d/githook to global execute (e.g. sudo chmod +X /etc/init.d/githook)
  • Edit githook.json to your needs and copy it to the binary's working directory or to /usr/local/etc/ as githook.json
  • Move below to "Starting githook"

####Starting githook

Once githook is installed, it can be managed as an upstart service with the following commands:

sudo service githook start #starts githook
sudo service githook stop # stops githook
sudo service githook restart # restarts githook
sudo service githook status # prints running status and PID of githook
--
sudo update-rc.d githook defaults # sets githook as a default service, runs on system boot

####Configuration

An example configuration file can be found as githook.json. For githook to load its configuration details properly, the file must be named "githook.json" as must be stored in one of the two following locations:

  1. /usr/local/etc/
  2. The working directory of the binary (e.g. if the binary is running from /var/githook, the githook.json file must be stored there as well in the top directory).

Note: If you really must house the githook.json file elsewhere on the system, the path to it can be edited in main.go#L41.

To get your GitHub repository set up to work with githook, go to Repository Settings > Webhooks & Services > Add Webhook. Then fill in the following accordingly:

Payload URL: the hostname:port/path which githook is running on. Ex: https://hostname.tld:12345/githook
             This information is configured in githook.json
             
Content/type: application/json
Secret: An optional (read as: "recommended") security key to validate each payload is legitimate traffic.
             Payload is signed using HMAC-SHA1.

##License

git​hook is made available under the MIT license.

Copyright 2014 (c) Austin Dizzy

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL