cexll / swoole-webhook
Using WebHooks to automatically pull code
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=7.2
- ext-json: *
- swoole/ide-helper: @dev
README
Using WebHooks to automatically pull code
Support
- GitHub
- Gitee
Require
- php >= 7.2
- ext-swoole >= 4.5
Install
composer create-project cexll/swoole-webhook
Configure
- vim
config.json
"server": { "ip": "0.0.0.0", "port": 9501, "mode": 1, // SWOOLE_BASE=1, SWOOLE_PROCESS=2 "setting": { "worker_num": 1, "task_worker_num": 1, "task_enable_coroutine": true, "daemonize": true // 后台运行 } }
server
对应的是Swoole\Http\Server
的相关配置
ip
:IP地址port
:端口mode
:启动模式SWOOLE_BASE/SWOOLE_PROCESS
settings
:Server的配置
设置 daemonize => true 时,程序将转入后台作为守护进程运行。长时间运行的服务器端程序必须启用此项。 如果不启用守护进程,当 ssh 终端退出后,程序将被终止运行。
sites
对应的是项目的仓库等信息
分为github
和gitee
,name
是仓库名称,支持多个仓库。
secret
/password
:密钥/密码;github
使用secret
,gitee
的 WebHook 密码使用password
,签名密钥使用secret
ref
:分支hook_name
:事件名称;github
为push
,gitee
为push_hooks
cmds
:需要执行的脚本/命令
"sites": { "github": [{ "name": "cexll/swoole-webhook", "secret": "password", "ref": "refs/heads/master", "hook_name": "push", "cmds": [ "git -C /yourpath/project pull" ] }], "gitee": [{ "name": "cexll/swoole-webhook", "password": "password", "ref": "refs/heads/master", "hook_name": "push_hooks", "cmds": [ "git -C /yourpath/project pull" ] }] }
- 填写WebHook
URL:http://ip:port/github
or http://ip:port/gitee
Secret/PassWord:对应config.json
中的secret/password
Start
php run.php
License
Apache License Version 2.0, http://www.apache.org/licenses/