Git-Auto-Deploy consists of a small HTTP server that listens for Webhook requests sent from GitHub, GitLab or Bitbucket servers. This application allows you to continuously and automatically deploy your projects each time you push new commits to your repository.
How does it work?
When commits are pushed to your Git repository, the Git server will notify Git-Auto-Deploy by sending an 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. Git-Auto-Deploy parses and validates the request, and if all goes well it issues a git pull.
Additionally, Git-Auto-Deploy 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
You can install Git-Auto-Deploy in multiple ways. Below are instructions for the most common methods.
service git-auto-deploy start
service git-auto-deploy status
Install from repository (recommended for other systems)
When installing Git-Auto-Deploy from the repository, you'll need to make sure that Python (tested on version 2.7) and Git (tested on version 2.5.0) is installed on your system.
Copy of the sample config and modify it. Read more about the configuration options. Make sure that pidfilepath is writable for the user running the script, as well as all paths configured for your repositories.
cd Git-Auto-Deploy
cp config.json.sample config.json
Start Git-Auto-Deploy manually using;
python -m gitautodeploy --config config.json
To start Git-Auto-Deploy automatically on boot, open crontab in edit mode using crontab -e and add the entry below.
Verify that Git is added to your system PATH. Make sure that C:\Program Files\Git\cmd is added (should have been added automatically by the installer) as well as C:\Program Files\Git\bin (not added by default).
To make your git provider send notifications to Git-Auto-Deploy you will need to provide the hostname and port for your Git-Auto-Deploy instance. Instructions for the most common git providers is listed below.
GitHub
Go to your repository -> Settings -> Webhooks -> Add webhook
In "Payload URL", enter your hostname and port (your-host:8001)
Hit "Add webhook"
GitLab
Go to your repository -> Settings -> Web hooks
In "URL", enter your hostname and port (your-host:8001)
Hit "Add Web Hook"
Bitbucket
Go to your repository -> Settings -> Webhooks -> Add webhook
In "URL", enter your hostname and port (your-host:8001)
Hit "Save"
More documentation
Have a look in the docs directory, where you'll find more detailed documentation on configurations, alternative installation methods, and example workflows.
请发表评论