Giter VIP home page Giter VIP logo

code-distro's Introduction

code-distro - send code over 0mq

What?

Distribute code patches over 0mq.

Why?

Got a central git repository? Got AWS servers you don't want to give access to said repository? Got hooks? This will help.

How ?

Most code hosting services (for Git, anyway) can send hooks based on pushes. Set up a repository hook on a machine that can communicate with (for example) Github, using src/ReceiveHook.php as a starting point.

GithubHook should run on the machine with repository access ('public'). It will receive the hook, fetch the repo, and do the diff between the commits to generate the patch

GitPatch should run on the machine without repo access ('private'). It will receive the patch, check that the working copy matches in branch and revision, and apply the patch.

Quickstart

You will need:

  • PHP zmq extension
  • Composer
  • Patience
  • (at least) a pair of servers, one public and 1-n private.
  • A complete unwillingness to allow your private machine to talk to your code hosting service, even with SSL and public keys and other security mod cons. Hey, maybe it's dynamic IP or something.

On public:

  1. Set up a webserver

  2. Put ReceiveHook.php in it

  3. Point Github's receive hook at ReceiveHook.php

  4. Run the main server :

    bin/server.php config.php

  5. Probably you want to run the hook processor here, too :

    bin/server.php config.github_hook.php

On private:

  1. Make sure the public machine is accessible via tcp broker ports (0MQ defaults : 5555 and 5557)

  2. Get a copy of your repo checked out to a directory, and specify that in config.github_patch.php. Probably scping an archive will do that.

  3. Run the patch processor :

    bin/server.php config.github_patch.php

Then push some code to your centralised repository. You should see activity in /var/log/code_distro/ on both servers.

Todo

  • All messages passed through Message
  • Safety checks (empty patches; remotes match; SSL; encrypted/signed patches)
  • Other broker support (ActiveMQ / RabbitMQ / IronMQ? I've only used one of them).
  • Other codehaus support (BitBucket / Gitlab)
  • Branch support ? (deletion too) Probably an interesting one to solve. Can only really track the branch that the private server has.
  • Better Processor definitions. They're sort of clients?

Done

  • Better process execution (exec() is not great)
  • Script to re/start all three servers in one

code-distro's People

Contributors

bmcgavin avatar

Stargazers

 avatar

Watchers

 avatar

code-distro's Issues

Separate!

So server and processors can be composer modules.

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.