GithubHelp home page GithubHelp logo

pitpit / dflydev-git-subsplit-github-webhook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dflydev/dflydev-git-subsplit-github-webhook

0.0 0.0 0.0 125 KB

GitHub WebHook for Git subsplits managed by dflydev-git-subsplit.

License: MIT License

dflydev-git-subsplit-github-webhook's Introduction

Git Subsplit GitHub WebHook

GitHub WebHook for Git subsplits managed by git-subsplit.

Automates the process of keeping one-way read-only subtree splits up to date with the source repository.

The WebHook works in two parts, a web listener and a worker. The web listener adds requests to Redis and the worker processes the requests.

The worker will interact with the system's git as the user running the worker. This means that the user running the worker should have its key added to the appropriate GitHub accounts.

During testing it would make sense to run the worker manually. For production deployments it would probably make more sense to runt he worker using something along the lines of upstart or supervisor.

Usage

git-subsplit

Ensure that git-subsplit is installed correctly. If is not available in your version of git (likely true for versions older than 1.7.11) please install it manually from here.

Installation

If You Already Have Composer

composer create-project dflydev/git-subsplit-github-webhook:1.0.x-dev -n webhook
cd webhook

If You Need Composer

curl -s https://getcomposer.org/installer | php
php composer.phar create-project dflydev/git-subsplit-github-webhook:1.0.x-dev -n webhook
cd webhook

Redis

Ensure that the Redis server is running.

Configure

Copy config.json.dist to config.json and edit it accordingly. Please make sure to pay special attention to setting working-directory correctly.

Web Server

Setup a virtual host pointing to web/ as its docroot. Assuming the virtual host is webhook.example.com, test the WebHook by visiting the following URL: http://webhook.example.com/subsplit-webhook.php

Worker

Start the worker by running php bin/subsplit-worker.php.

GitHub

From your repository go to Settings / Service Hooks / WebHook URLs. Enter the URL to your WebHook and click Update Settings.

Click WebHook URLs again and click Test Hook.

If everything is setup correctly the Worker should give you some sort of feedback.

Configuration

Example

{
    "working-directory": "/home/myuser/.git-subsplit-working",
    "allowed-ips": ["127.0.0.1"],
    "projects": {
        "sculpin": {
            "url": "https://github.com/sculpin/sculpin",
            "repository-url": "[email protected]:sculpin/sculpin.git",
            "splits": [
                "src/Sculpin/Core:[email protected]:sculpin/core.git"
            ]
        },
        "react": {
            "url": "https://github.com/reactphp/react",
            "splits": [
                "src/React/EventLoop:[email protected]:reactphp/event-loop.git",
                "src/React/Stream:[email protected]:reactphp/stream.git",
                "src/React/Cache:[email protected]:reactphp/cache.git",
                "src/React/Socket:[email protected]:reactphp/socket.git",
                "src/React/Http:[email protected]:reactphp/http.git",
                "src/React/HttpClient:[email protected]:reactphp/http-client.git",
                "src/React/Dns:[email protected]:reactphp/dns.git"
            ]
        }
    }
}

Schema

working-directory

String. Default: None. Required.

The directory in which the subsplits will be processed. This is more or less a temporary directory in which all projects will have their subsplit initialized.

allowed-ips

Array. Default: ['207.97.227.253', '50.57.128.197', '108.171.174.178']

The IP addresses that are allowed to call the WebHook. The default values are GitHub's IP addresses published here.

projects

Object. Required.

An object whose keys are project names and values are a project description object.

Project names should only contain a-z, A-Z, 0-9, ., _, and -.

Each project description object can have the following properties:

  • url: The URL for the project. The WebHook will check each incoming request's url property against each project's listed url property to determine which project the request is for.

    This URL will look like: https://github.com/sculpin/sculpin

    Note: The URL is secure (https) and does not contain .git extension.

  • repository-url: The URL that git will use to check out the project. This setting is optional. If it is not defined the repository URL will be read from the incoming request.

  • splits: An array of subsplit definitions as defined by git-subsplit. The pattern for the splits is ${subPath}:${url}.

License

MIT, see LICENSE.

Community

If you have questions or want to help out, join us in the #dflydev channel on irc.freenode.net.

Not Invented Here

This project is based heavily on work originally done by igorw. Thanks Igor. :)

dflydev-git-subsplit-github-webhook's People

Contributors

simensen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.