All Projects → abiosoft → Caddy Git

abiosoft / Caddy Git

Licence: mit
git middleware for Caddy

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Caddy Git

Botserver
http://telegram.org Bot API Webhooks Framework, for Rubyists
Stars: ✭ 125 (-28.57%)
Mutual labels:  webhook
Keel
Kubernetes Operator to automate Helm, DaemonSet, StatefulSet & Deployment updates
Stars: ✭ 1,870 (+968.57%)
Mutual labels:  webhook
Loginsrv
JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd, osiam, ..
Stars: ✭ 1,835 (+948.57%)
Mutual labels:  caddy
Rust Slack
A rust crate for sending messages to Slack via webhooks
Stars: ✭ 128 (-26.86%)
Mutual labels:  webhook
Aliyun Ddns
阿里云动态域名工具,支持docker和ipv6。
Stars: ✭ 131 (-25.14%)
Mutual labels:  webhook
Tradingview Webhook Bot
⚙️ Send TradingView alerts to Telegram, Discord, Slack, Twitter and/or Email.
Stars: ✭ 135 (-22.86%)
Mutual labels:  webhook
Gitwebhookproxy
A proxy to let webhooks reach running services behind a firewall – [✩Star] if you're using it!
Stars: ✭ 123 (-29.71%)
Mutual labels:  webhook
Xcaddy
Build Caddy with plugins
Stars: ✭ 168 (-4%)
Mutual labels:  caddy
Stage Ci
Automatic deploy previews for your PRs using zeit.co/now.
Stars: ✭ 132 (-24.57%)
Mutual labels:  webhook
Hwamei
企业微信webhook,企业微信群机器人webhook,支持Github、Gitlab、Sentry等Webhook
Stars: ✭ 142 (-18.86%)
Mutual labels:  webhook
Account Activity Dashboard
Sample web app and helper scripts to get started with the premium Account Activity API
Stars: ✭ 129 (-26.29%)
Mutual labels:  webhook
Download Webhook
🍰 Download files through webhook
Stars: ✭ 131 (-25.14%)
Mutual labels:  webhook
Dhooks
A simple python Discord webhook API wrapper
Stars: ✭ 136 (-22.29%)
Mutual labels:  webhook
Caddy Auth Jwt
JWT Authorization Plugin for Caddy v2
Stars: ✭ 127 (-27.43%)
Mutual labels:  caddy
Packages
Enhances Composer Satis with webhook integrations to GitHub and GitLab
Stars: ✭ 157 (-10.29%)
Mutual labels:  webhook
Prom2teams
prom2teams is an HTTP server built with Python that receives alert notifications from a previously configured Prometheus Alertmanager instance and forwards it to Microsoft Teams using defined connectors
Stars: ✭ 122 (-30.29%)
Mutual labels:  webhook
Ngrok
Expose your localhost to the web. Node wrapper for ngrok.
Stars: ✭ 1,897 (+984%)
Mutual labels:  webhook
Go Git Webhook
Golang 实现的自动化部署和运维工具,支持:Github / GitLab / GitOsc。
Stars: ✭ 173 (-1.14%)
Mutual labels:  webhook
Pyngrok
A Python wrapper for ngrok
Stars: ✭ 159 (-9.14%)
Mutual labels:  webhook
Caddy Gen
Automated Caddy reverse proxy for docker containers
Stars: ✭ 139 (-20.57%)
Mutual labels:  caddy

git

Middleware for Caddy.

Build Status

git clones a git repository into the site. This makes it possible to deploy your site with a simple git push.

The git directive starts a service routine that runs during the lifetime of the server. When the service starts, it clones the repository. While the server is still up, it pulls the latest every so often. You can also set up a webhook to pull immediately after a push. In regular git fashion, a pull only includes changes, so it is very efficient.

If a pull fails, the service will retry up to three times. If the pull was not successful by then, it won't try again until the next interval.

Requirements: This directive requires git to be installed. Also, private repositories may only be accessed from Linux or Mac systems. (Contributions are welcome that make private repositories work on Windows.)

Syntax

git repo [path]
  • repo is the URL to the repository; SSH and HTTPS URLs are supported
  • path is the path, relative to site root, to clone the repository into; default is site root

This simplified syntax pulls from master every 3600 seconds (1 hour) and only works for public repositories.

For more control or to use a private repository, use the following syntax:

git [repo path] {
	repo        repo
	path        path
	branch      branch
	key         key
	interval    interval
	clone_args  args
	pull_args   args
	hook        path secret
	hook_type   type
	then        command [args...]
	then_long   command [args...]
}
  • repo is the URL to the repository; SSH and HTTPS URLs are supported.
  • path is the path to clone the repository into; default is site root. It can be absolute or relative (to site root).
  • branch is the branch or tag to pull; default is master branch. {latest} is a placeholder for latest tag which ensures the most recent tag is always pulled.
  • key is the path to the SSH private key; only required for private repositories.
  • interval is the number of seconds between pulls; default is 3600 (1 hour), minimum 5. An interval of -1 disables periodic pull.
  • clone_args is the additional cli args to pass to git clone e.g. --depth=1. git clone is called when the source is being fetched the first time.
  • pull_args is the additional cli args to pass to git pull e.g. -s recursive -X theirs. git pull is used when the source is being updated.
  • path and secret are used to create a webhook which pulls the latest right after a push. This is limited to the supported webhooks. secret is currently supported for GitHub, Gitlab and Travis hooks only.
  • type is webhook type to use. The webhook type is auto detected by default but it can be explicitly set to one of the supported webhooks. This is a requirement for generic webhook.
  • command is a command to execute after successful pull; followed by args which are any arguments to pass to the command. You can have multiple lines of this for multiple commands. then_long is for long executing commands that should run in background.

Each property in the block is optional. The path and repo may be specified on the first line, as in the first syntax, or they may be specified in the block with other values.

Webhooks

A webhook is an interface between a git repository and an external server. On Github, the simplest webhook makes a request to a 3rd-party URL when the repository is pushed to. You can set up a Github webhook at github.com/[username]/[repository]/settings/hooks, and a Travis webhook in your .travis.yml. Make sure your webhooks are set to deliver JSON data!

The JSON payload should include at least a ref key, but all the default supported webhooks will handle this for you.

The hook URL is the URL Caddy will watch for requests on; if your url is, for example /__github_webhook__ and Caddy is hosting https://example.com, when a request is made to https://example.com/__github_webhook__ Caddy will intercept this request and check that the secret in the request (configured wherever you configure your webhooks) and the secret in your Caddyfile match. If the request is valid, Caddy will git pull its local copy of the repo to update your site as soon as you push new data. It may be useful to then use a post-merge script or another git hook to rebuild any needed files (updating SASS styles and regenerating Hugo sites are common use-cases), although the then parameter can also be used for simpler cases.

Note that because the hook URL is used as an API endpoint, you shouldn't have any content / files at its corresponding location in your website.

Supported Webhooks

Examples

Public repository pulled into site root every hour:

git github.com/user/myproject

Public repository pulled into the "subfolder" directory in the site root:

git github.com/user/myproject subfolder

Private repository pulled into the "subfolder" directory with tag v1.0 once per day:

git {
	repo     [email protected]:user/myproject
	branch   v1.0
	key      /home/user/.ssh/id_rsa
	path     subfolder
	interval 86400
}

Generate a static site with Hugo after each pull:

git github.com/user/site {
	path  ../
	then  hugo --destination=/home/user/hugosite/public
}

Part of a Caddyfile for a PHP site that gets changes from a private repo:

git [email protected]:user/myphpsite {
	key /home/user/.ssh/id_rsa
}
fastcgi / 127.0.0.1:9000 php

Specifying a webhook:

git [email protected]:user/site {
	hook /webhook secret-password
}

You might need quotes "secret-password" around your secret if it contains any special characters, or you get an error.

Generic webhook payload: <branch> is branch name e.g. master.

{
	"ref" : "refs/heads/<branch>"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].