shadowsocks-rust icon indicating copy to clipboard operation
shadowsocks-rust copied to clipboard

希望能接收信号以重载配置

Open pexcn opened this issue 3 years ago • 11 comments

举个例子: 我启动 ssserver 的时候加载了插件,我的启动命令是

ssserver \
  --server-addr 0.0.0.0:1 \
  --password password \
  --encrypt-method chacha20-ietf-poly1305 \
  --timeout 3600 \
  --udp-timeout 300 \
  --udp-max-associations 1024 \
  --nofile 1048576 \
  --tcp-keep-alive 300 \
  --tcp-fast-open \
  --tcp-no-delay \
  -U \
  --plugin "xray-plugin" \
  --plugin-opts "server;tls;fast-open;mode=grpc;host=xxx.domain.com"

这个插件加载了 SSL 证书,假设是免费的证书,有效期只有 3 个月,虽然我设置了 acme.sh 自动续期证书,但是要重启 ssserver 的进程才能让证书生效。

所以想问下 ssserver 能否增加接收某个信号来重启自身进程这个功能?就像 kill -SIGUSR1 <pid of ssserver>

pexcn avatar Jan 18 '22 08:01 pexcn

I am using process managers to fulfill the exact same goal. OpenWRT: procd, Linux: systemd.

zonyitoo avatar Jan 18 '22 08:01 zonyitoo

请问 docker 有类似的功能吗?:grinning:

pexcn avatar Jan 18 '22 08:01 pexcn

Well, you can always package any process managers you flavored in Dockerfile.

zonyitoo avatar Jan 18 '22 08:01 zonyitoo

Well, you can always package any process managers you flavored in Dockerfile.

意思是把 systemd 也打包进容器吗?好像有点大...

pexcn avatar Jan 18 '22 08:01 pexcn

How about supervisord, which should be relatively smaller.

zonyitoo avatar Jan 18 '22 09:01 zonyitoo

Oh BTW, since you have set a crontab to call acme.sh, why not just kill the ssserver process and restart it after calling acme.sh?

zonyitoo avatar Jan 18 '22 09:01 zonyitoo

Oh BTW, since you have set a crontab to call acme.sh, why not just kill the ssserver process and restart it after calling acme.sh?

acme.sh 的 docker 镜像是这里提供的,它应该是自带了一个 Cron 来自动更新证书的,不是我自己设置的。

pexcn avatar Jan 18 '22 09:01 pexcn

目前打算使用 Systemd 的定时器来定时重启 docker 容器来解决此问题了😀

pexcn avatar Jan 18 '22 09:01 pexcn

@zonyitoo 请问 ssservice 能否增加类似于 nginx -s reload 的功能? 因为根据 acme.sh 的文档,可以通过配置 DEPLOY_DOCKER_CONTAINER_RELOAD_CMD 来达到更加优雅地重载证书

pexcn avatar Jul 22 '22 16:07 pexcn

What behavior do you expect for this reload feature?

zonyitoo avatar Jul 24 '22 18:07 zonyitoo

What behavior do you expect for this reload feature?

  • 发送 SIGUSR1 信号来重启 SS 本身和插件
  • 发送 SIGUSR2 信号来重启插件

如果可以的话,并希望信号能传递到插件里面

pexcn avatar Jul 25 '22 06:07 pexcn

已通过 restart-container.sh 解决了

pexcn avatar Oct 01 '22 09:10 pexcn