@
onyourhead #41 通过 frp 也好,或者 cf tunnel ,把 webhook 服务暴露出去,webhook 服务部署在 NAS 上,docker compose 如下
```
services:
webhook:
image: thecatlady/webhook
container_name: webhook
command: -verbose -hooks=/config/hooks.yaml -hotreload
# 参考
https://segmentfault.com/a/1190000042002239 ,docker 访问宿主机命令
pid: host
privileged: true
environment:
- TZ=Asia/Shanghai
- UID=1000
- GID=1000
mem_limit: 200m
memswap_limit: -1
volumes:
- ./data/config:/config:ro
# ports:
# - 8606:9000
restart: always
```
上边提到的 hooks.yaml
```
- id: ping
execute-command: "/config/run/
ping.sh"
command-working-directory: "/config/run"
include-command-output-in-response: true
include-command-output-in-response-on-error: true
pass-arguments-to-command:
- source: string
name: '100.64.0.1' # 这里是要 ping 的 ip
comment: ip
```
/config/run/
ping.sh```sh
#!/usr/bin/env sh
# variables
IP=${1}
if [ "$IP" = "" ];then
IP="100.64.0.1"
fi
PURE_IP=`echo ${IP}|grep -Eo '([0-9]+[.]){3}[0-9]+'|grep -v "255"`
echo "当前请求 IP 是: ${PURE_IP}"
#nsenter -m -u -i -n -p -t 1 sh -c "tailscale netcheck"
nsenter -m -u -i -n -p -t 1 sh -c "tailscale ping ${PURE_IP}"
exit 0
```