Deepl.io

A simple yet powerful PHP tool to catch Git webhooks from GitLab and GitHub and deploy your projects to your server after pushing.


Features

  • Catch webhooks from GitLab & GitHub
  • Configure multiple repositories
  • Configure multiple branches per repository
  • Use your own deploy scripts, either PHP, shell or both
  • Sends confirmation emails

How does it work?

Deepl.io catches and then acts on post requests sent by your git service-provider using webhooks. Currently github.com and gitlab.com are supported.
You configure your repository to send push-updates to your Deepl.io instance runing on your server via Webhooks. Check the repository setting for the appropriate options. Deepl.io will check if the request comes from the right source, detects if the branch that has been updated is correct and then executes your custom PHP or shell commands. Deepl.io only calls your commands, it does not act on it's own since this would be way too unflexible.


Installation

Download Deepl.io to your server or clone using Git. Consider creating a subdomain: deploy.yourserver.com.

Requirements: PHP, and your web host needs to allow php exec commands and mod_rewrite has to be enabled.


Setup Depl.io

Open config/config.example.json and rename it to config.json. Set a secret token and maybe configure allowed IPs.
You can configure the repositoryPath to a location outside the deepl.io path to use your own git repo for the deploy-configuration: "repositoriesPath": "./../my-own-deployment-repositories/"
Then, add this to the webhook settings of your Git provider: deploy.yourserver.com/your-secret-token


Configure Deployments

Right now, you need to configure your deploys manually. It's pretty simple: Open the repositories/ folder, create a new folder corresponding with your Git repository name and add 3 files:

The branch. part is needed to distinguish push events only for the desired branch.

Example Structure:
deepl.io.git/master.config.json
deepl.io.git/master.script.sh
deepl.io.git/master.request.json


Example Project Configuration

Make sure to set the "enabled" flag to enable execution

{
	"enabled": true,
	"project": {
		"name": "Example Music Project",
		"repository_ssh_url": "git@example.com:music/example.git",
		"branch": "deploy/test"
	},
	"mails": {
		"michael.jackson@gmail.com": "Michael Jackson",
		"tina.turner@gmail.com": "Tina Turner"
	}
}

It is important, that the "repository_ssh_url" matches the repository that your service provider delivers using the JSON payload. You can test this by calling /admin/ (protected by .htaccess, only works localy) and updating the example request branch.request.json:

GitLab JSON:
	"repository": {
		"git_ssh_url":"git@example.com:music/example.git",
	},
GitHub JSON:
	"repository": {
		"ssh_url": "git@github.com:music/example.git",
	},

Debugging & Issues

Check logs/deeplio.log if you have any problems or open up an issue.