github-webhook

by Coppertino

Coppertino /github-webhook

Github php webhook to sync repository data into multiple servers (via ftp and ssh protocols)

129 Stars 23 Forks Last release: Not found 14 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

h2. What is this?

This project was created to make easier the procedure of updating production servers with new versions of other projects (generally it was designed for web applications, but there is no limitation of use).

Overall effect is an upgraded git cloning, which gives you the opportunity to merge new changes straight to the testing and production servers with appropriate real configurations, while hiding these configurations from public repositories.

For example, you have some project 'A', which is already in production stage and a copy of it with changed production settings is hosted somewhere. All is fine for some time, but then you want to add a new feature or fix some bugs / security issues. With webhook you can make and commit changes to test branch, immediately test it and commit to master branch, which will be automatically synced to production server with saved production settings.

h2. How it works

Synchronization goes in 4 steps: 1. Permission checks (IP filtering) 2. Validation and processing of incoming parameters 3. Forming the list of tasks to synchronize 4. Repository cloning (or pulling if already cached), replacing configuration files and uploading to the server(s)

h2. How to install

What will you need to use webhook: * Installed Git and webhook * Hosting place (with (s)ftp or ssh+rsync access) * Project you want to sync

How to setup GitHub: You will need admin rights for your project on GitHub. Go to admin panel and set notification URL to the webhook 'post-commit.php' file on your server as "shown here":http://help.github.com/post-receive-hooks/

How to setup webhook config: Make a copy of 'sample.config.user.php' and name it 'config.user.php'. This file contains all settings (with examples) users should change in order to use webhook.

h2. How to override project configuration files with real ones

At the moment, to save and not share user configuration files for different projects, webhook uses special folder ('sync-configs/'), which 'overrides' project configurations. In this folder you should create a subfolder associated with your project, which will contain the structure of the original project, but will have only configuration files. The name of this subfolder you should enter in '$repoconf' variable as 'configfolder' parameter. Example: You have project 'Abc' with such folder structure:

bc. -| |- configs |- common.config.php |- someother.config.php |- otherfolder |- otherimportantfile.php |- ... |- index.php

Structure you will have in 'sync-configs/' folder:

bc. -| |- Abc |- configs |- common.config.php |- some_other.config.php

What you will have in '$repo_conf' variable:

bc. $repoconf = array( 'http://github.com/companyname/Abc' => array( 'branch' => 'master', 'hosts' => 'production', 'repopath' => '', 'serverpath' => 'Abc', 'config_folder' => 'Abc' ) );

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.