Forge Home

webhook

Installing simple sinatra webhook for git pushes.

16,828 downloads

15,562 latest version

3.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.0 (latest)
  • 0.0.3
  • 0.0.2
  • 0.0.1
released Apr 13th 2015
This version is compatible with:
  • Puppet 3.x
  • , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'wdijkerman-webhook', '0.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add wdijkerman-webhook
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install wdijkerman-webhook --version 0.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

wdijkerman/webhook — version 0.1.0 Apr 13th 2015

#puppet-webhook

####Table of Contents

  1. Description 1.Github 2.Gitlab
  2. How to use
  3. OS Support
  4. Todo

##Description

This module will install an simple but basic sinatra webapp which we be executing r10k commands when something is posted to this site. When something is pushed to an git repository, you can configure it by executing so-called webhooks.

###Github.com When using github for example, within the settings of the repository there is an setting called "Webhooks & Services". Fill in the webadress in the "Payload url" and make sure that "application/json" (Which is default) is selected. Also select "Just the push event." and click on "Add webhook".

Please be sure, that github.com needs to be able to access this webpage. So configure the firewall for your devices to make sure it is accessible from github.com

###gitlab When using the (standalone) gitlab, you'll need to go to the "settings" page of every repository. You'll find on the left side of the page the "Web Hooks". When page opens, you'll need to provide the correct url into "URL" field and select "Push events". After this, click on the "Add Web Hook" button.

Please be sure, that gitlab.org needs to be able to access this webpage. So configure the firewall for your devices to make sure it is accessible from gitlab.org

##How to use

Basic usage

class { 'webhook': }

This will install an basic webapp which will be running as user root on port 81. The sinatra app is only available when one "JSON" information is posted to "http://fqdn:81/payload". The port can be overriden using the "webhook_port" parameter.

You can override this module with the following parameters:

  • webhook_home: As default, this will be installed on '/opt/webhook'. You can override it by setting an different value
  • webhook_port: On which port it is listening for requests. Default it will run on port 81. You can use this to any other port. When changing the port higher than 1023, this app still runs as root. (See todo)
  • webhook_owner: The owner of this service/script. Default it has 'root' as owner.
  • webhook_group: The group of this service/script. Default it is set to 'root'.
  • repo_puppetfile: The name of the repository where the 'Puppetfile' is stored. Default is 'undef' but this one needs to be supplied when you want this to work correctly.
  • repo_hieradata: The name of the repository where the 'hieradata' is stored. Default is 'undef' as not everyone is using hiera.
  • ruby_dev: The ruby dev package. RH: ruby-devel, Debian: ruby-dev

##Support

The module is only supported on:

  • CentOS 6
  • Debian 7
  • OracleLinux 6

##Todo The following is an overview of todo actions:

  • When running on port >1023, it should not run as root, but as specified webhook_user
  • Create rspec tests
  • Better documentation
  • Probably a lot ;-)

Please send me suggestions!