Contents

用caddy-git使用webhook初體驗

Contents

最近想自動化樹莓派同步git server上面的東西
有找到要使用webhook
目前樹莓派上面沒有啟用fastcgi東西
上次有看到caddy他還有類似webhook這玩意
就玩一下,筆記
abiosoft/caddy-git: git middleware for Caddy

首先就先用gitea來建立server測試
執行caddy的時候
會git pull動作
caddy-git文件寫預設1小時會git pull動作

1
2
3
4
5
localhost:80
git {
	repo     http://localhost:3000/root/test.git
	path     C:/test/
}

要設定多久要git pull 可以設定
interval 60 是1分鐘git pull動作
要加入webhook
只要設定

1
2
3
4
5
6
7
localhost:80
git {
    	repo     http://localhost:3000/root/test.git
    	path     C:/test/
	    #interval        60
      hook /webhook test
}

可以用#當注解
hook設定也想當簡單
hook /webhook secret-password

當然gitea設定webhook也很簡單
[img]https://i.imgur.com/5pFYK8Z.png[/img]
這樣就搞定了

這之後我也有找一些webhook工具
但是都沒有看到apache相關webhook東西

NetEaseGame/git-webhook: 使用 Python Flask + SQLAchemy + Celery + Redis + React 开发的用于迅速搭建并使用 WebHook 进行自动化部署和运维,支持 Github / GitLab / Gogs / GitOsc。
Webhook 实践 —— 自动部署 | 咀嚼之味
Raspberry Pi Raspbian Jessie 安裝設定 – 靠der Cowder – Medium

原本想試試rvagg/github-webhook-handler: Node.js web handler / middleware for processing GitHub Webhooks
不過對systemd還不是很熟
不知道要怎麼設定

最後,我覺得直接crontab設定1小時做git pull動作
因為我的需求也不需要很及時做更新

這應該就能解決我的需求
待下次作筆記