the famous deploy webhook at work

So from our last article, we needed to move from Travis CI as our deployment mechanism to something faster and more efficient and Github Web-hooks came to mind. What are webhooks?

Webhooks allow you to build or set up GitHub Apps which subscribe to certain events on GitHub.com. When one of those events is triggered, we’ll send a HTTP POST payload to the webhook’s configured URL.

So when we make a commit or merge anything a payload is instantly sent out to the webhook configured URL. No delays, Nothing.

Install git…

After you’ve installed git, make sure it’s a relatively new version

Setup git (optionally if you haven’t do so)

Create an ssh directory for the apache user

Generate a deploy key for apache user

Add the SSH key to your user

  1. https://github.com/settings/ssh
  2. Create a new key
  3. Paste the deploy key you generated on the server

Grab a deployment script for your site

Add, commit and push this to github

Set up service hook

  1. https://github.com/YOUR_USERNAME/REPO/admin/hooks
  2. Select the Post-Receive URL service hook
  3. Enter the URL to your deployment script — http://localhost/deploy.php
  4. Click Update Settings

Sources


Thanks to Gabriel Umoh for the assists

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Want to Get in Touch?

Spelling error report

The following text will be sent to our editors: