我通过以下方式安装了 webhook 服务器adnanh/webhook并以我认为正确的方式配置它 - Github 给了我一个 200 响应,webhook-url 可以访问,另一个执行已在运行。我还通过 CLI 单独运行了 .sh 文件 - 也可以运行。
链接到 webhook:https://webhooks.dmnktoe.de/hooks/pull-dmnktoe
这是我的钩子:
{
"id": "pull-dmnktoe",
"execute-command": "/var/www/html/webhooks/commands/pull-dmnktoe-de.sh",
"command-working-directory": "/var/www/html/dmnktoe-de-webhooks/webhook",
"trigger-rule": {
"and": [{
"match": {
"type": "payload-hash-sha1",
"secret": "mysecret",
"parameter": {
"source": "header",
"name": "X-Hub-Signature"
}
}
}]
}
},
这是我对应的“拉-dmnktoe-de.sh“-新的提交后应触发的文件:
#! /bin/bash
cd /var/www/html/dmnktoe-de/$1
git stash
git pull
gulp serve:dist
我想知道为什么页面没有更新。我查看了 nginx 错误日志,发现:
2019/01/25 15:17:33 [error] 12297#12297: *4771 connect() failed (111: Connection refused) while connecting to upstream, client: 91.42.172.89, server: webhooks.dmnktoe.de, request: "GET /hooks/pull-dmnktoe HTTP/1.1", upstream: "http://127.0.0.1:9001/hooks/pull-dmnktoe", host: "webhooks.dmnktoe.de"
我认为您需要服务器块来理解我的问题。这是我的 webhooks.dmnktoe.de 服务器块。
server {
listen 443 ssl;
server_name webhooks.dmnktoe.de;
ssl_certificate /etc/letsencrypt/live/webhooks.dmnktoe.de/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/webhooks.dmnktoe.de/privkey.pem; # managed by Certbot
location / {
try_files $uri @proxy;
}
location @proxy {
proxy_pass http://webhooks;
}
}
upstream webhooks {
server 127.0.0.1:9001;
}
答案1
正如 netstat 输出中所述,webhook 似乎正在监听 IPv6 接口,因此您必须将上游从重写http://127.0.0.1/hooks/...
为http://[::1]/hooks/...
- 或者 -
-ip 127.0.0.1
在启动 webhook 时传递,告诉 webhook 绑定到 127.0.0.1 IP 。
干杯,Adnan(adnanh/webhook 的作者:-))