2015-05-01 10:11:01 +08:00
|
|
|
// Package git is the middleware that pull sites from git repo
|
|
|
|
//
|
|
|
|
// Caddyfile Syntax :
|
|
|
|
// git repo path {
|
|
|
|
// repo
|
|
|
|
// path
|
|
|
|
// branch
|
|
|
|
// key
|
|
|
|
// interval
|
2015-05-02 08:44:51 +08:00
|
|
|
// then command args
|
2015-05-01 10:11:01 +08:00
|
|
|
// }
|
|
|
|
// repo - git repository
|
|
|
|
// compulsory. Both ssh (e.g. git@github.com:user/project.git)
|
|
|
|
// and https(e.g. https://github.com/user/project) are supported.
|
|
|
|
// Can be specified in either config block or top level
|
|
|
|
//
|
2015-05-02 00:18:58 +08:00
|
|
|
// path - directory to pull into, relative to site root
|
2015-05-01 10:11:01 +08:00
|
|
|
// optional. Defaults to site root.
|
|
|
|
//
|
|
|
|
// branch - git branch or tag
|
|
|
|
// optional. Defaults to master
|
|
|
|
//
|
|
|
|
// key - path to private ssh key
|
|
|
|
// optional. Required for private repositories. e.g. /home/user/.ssh/id_rsa
|
|
|
|
//
|
|
|
|
// interval- interval between git pulls in seconds
|
|
|
|
// optional. Defaults to 3600 (1 Hour).
|
|
|
|
//
|
2015-05-02 08:44:51 +08:00
|
|
|
// then - command to execute after successful pull
|
|
|
|
// optional. If set, will execute only when there are new changes.
|
|
|
|
//
|
2015-05-01 10:11:01 +08:00
|
|
|
// Examples :
|
|
|
|
//
|
|
|
|
// public repo pulled into site root
|
|
|
|
// git github.com/user/myproject
|
|
|
|
//
|
2015-05-02 00:18:58 +08:00
|
|
|
// public repo pulled into <root>/mysite
|
2015-05-01 10:11:01 +08:00
|
|
|
// git https://github.com/user/myproject mysite
|
|
|
|
//
|
2015-05-02 08:44:51 +08:00
|
|
|
// private repo pulled into <root>/mysite with tag v1.0 and interval of 1 day.
|
2015-05-01 10:11:01 +08:00
|
|
|
// git {
|
|
|
|
// repo git@github.com:user/myproject
|
|
|
|
// branch v1.0
|
|
|
|
// path mysite
|
|
|
|
// key /home/user/.ssh/id_rsa
|
|
|
|
// interval 86400 # 1 day
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// Caddyfile with private git repo and php support via fastcgi.
|
|
|
|
// path defaults to /var/www/html/myphpsite as specified in root config.
|
|
|
|
//
|
|
|
|
// 0.0.0.0:8080
|
|
|
|
//
|
|
|
|
// git {
|
|
|
|
// repo git@github.com:user/myphpsite
|
|
|
|
// key /home/user/.ssh/id_rsa
|
|
|
|
// interval 86400 # 1 day
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// fastcgi / 127.0.0.1:9000 php
|
|
|
|
//
|
|
|
|
// root /var/www/html/myphpsite
|
|
|
|
//
|
|
|
|
// A pull is first attempted after initialization. Afterwards, a pull is attempted
|
|
|
|
// after request to server and if time taken since last successful pull is higher than interval.
|
|
|
|
//
|
|
|
|
// After the first successful pull (should be during initialization except an error occurs),
|
|
|
|
// subsequent pulls are done in background and do not impact request time.
|
|
|
|
//
|
|
|
|
// Note: private repositories are currently only supported and tested on Linux and OSX
|
|
|
|
package git
|