GithubHelp home page GithubHelp logo

clementgarbay / git-auto-deploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from olipo186/git-auto-deploy

0.0 2.0 0.0 515 KB

Deploy your GitHub, GitLab or Bitbucket projects automatically on Git push events or webhooks using this small HTTP server written in Python. Continuous deployment in it's most simple form.

Home Page: http://olipo186.github.io/Git-Auto-Deploy/

License: Other

Python 83.73% Makefile 3.61% Shell 12.66%

git-auto-deploy's Introduction

What is it?

GitAutoDeploy.py consists of a small HTTP server that listens for Web hook requests sent from GitHub, GitLab or Bitbucket servers. This application allows you to continuously and automatically deploy you projects each time you push new commits to your repository.

workflow

How does it work?

When commits are pushed to your Git repository, the Git server will notify GitAutoDeploy.py by sending a HTTP POST request with a JSON body to a pre configured URL (your-host:8001). The JSON body contains detailed information about the repository and what event that triggered the request. GitAutoDeploy.py parses and validates the request, and if all goes well it issues a git pull.

Additionally, GitAutoDeploy.py can be configured to execute a shell command upon each successful git pull, which can be used to trigger custom build actions or test scripts.

Getting started

Dependencies

  • Git (tested on version 2.5.0)
  • Python (tested on version 2.7)

Configuration

  • Copy GitAutoDeploy.conf.json.example to GitAutoDeploy.conf.json
  • Modify GitAutoDeploy.conf.json to match your project setup
  • Make sure that the pidfilepath path is writable for the user running the script, as well as any other path configured for your repositories.

Running the application

python GitAutoDeploy.py

Command line options

--daemon-mode (-d) Run in background (daemon mode) --quiet (-q) Suppress all output --ssh-keygen --force --config Specify custom configuration file

Start automatically on boot

Crontab

The easiest way to configure your system to automatically start GitAutoDeploy.py after a reboot is through crontab. Open crontab in edit mode using crontab -e and add the following:

@reboot /usr/bin/python /path/to/GitAutoDeploy.py --daemon-mode --quiet

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 installed in /opt/Git-Auto-Deploy/ and that the pidfilepath config option is set to /var/run/gitautodeploy.pid. If this is not the case, edit the gitautodeploy init script and modify DAEMON, PWD and PIDFILE.
  • 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

Configure GitHub

  • Go to your repository -> Settings -> Webhooks and Services -> Add webhook
  • In "Payload URL", enter your hostname and port (your-host:8001)
  • Hit "Add webhook"

Configure GitLab

  • Go to your repository -> Settings -> Web hooks
  • In "URL", enter your hostname and port (your-host:8001)
  • Hit "Add Web Hook"

Configure Bitbucket

  • Go to your repository -> Settings -> Webhooks -> Add webhook
  • In "URL", enter your hostname and port (your-host:8001)
  • Hit "Save"

git-auto-deploy's People

Contributors

alexanderkjeldaas avatar alexandernst avatar ares86 avatar ibobik avatar markdorison avatar nache avatar olipo186 avatar stuartcarnie avatar

Watchers

 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.