Git Product home page Git Product logo

github-gitlab-auto-deploy's Introduction

How it works

What is it?

This is a small HTTP server written in python. It allows you to have a version of your project installed, that will be updated automatically on each Github or Gitlab push.

To set it up, do the following:

  • Install python
  • Copy the GitAutoDeploy.conf.json.example to GitAutoDeploy.conf.json. This file will be gitignored and can be environment specific.
  • Enter the matching for your project(s) in the GitAutoDeploy.conf.json file
  • Start the server by typing python GitAutoDeploy.py
  • To run it as a daemon add --daemon-mode
  • On the Github or Gitlab page go to a repository, then "Admin", "Service Hooks", "Post-Receive URLs" and add the url of your machine + port (e.g. http://example.com:8001).

You can even test the whole thing here, by clicking on the "Test Hook" button, whohoo!

Configure GitAutoDeploy to get executed at start up

Debian and Sys-V like init system.

  • Copy file initfiles/debianLSBInitScripts/gitautodeploy to /etc/init.d/
  • Make it executable: chmod 755 /etc/init.d/gitautodeploy
  • Also you need to make GitAutoDeploy.py executable (if it isn't already): chmod 755 GitAutoDeploy.py
  • This init script assumes that you have GitAutoDeploy.py in /opt/Gitlab_Auto_Deploy/GitAutoDeploy.py. If this is not the case, edit gitautodeploy init script and modify DAEMON and PWD.
  • Now you need to add the correct symbolic link to your specific runlevel dir to get the script executed on each start up. On Debian_Sys-V just do update.rc.d gitautodeploy defaults

Systemd

  • TODO

How this works

When someone pushes changes into Github or Gitlab, it sends a json file to the service hook url. It contains information about the repository that was updated.

All it really does is match the repository urls to your local repository paths in the config file, move there and run "git pull".

Additionally it runs a deploy bash command that you can add to the config file optionally, and it also allows you to add two global deploy commands, one that would run at the beginning and one that would run at the end of the deploy. Make sure that you start the server as the user that is allowed to pull from the github or gitlab repository.

github-gitlab-auto-deploy's People

Contributors

alexandernst avatar olipo186 avatar nache avatar alexanderkjeldaas avatar martinszy avatar markdorison avatar stuartcarnie avatar

Watchers

James Cloos avatar  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.