Open izidormatusov opened 1 month ago
If using Blocky in the Docker, you can use the restarter sidecar like:
# compose.yml
services
restarter:
image: docker
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart <blocky_container_name>; done"]
restart: unless-stopped
blocky:
...
I'm running blocky as a systemd service. I guess I can add a similar cron job that periodically restarts blocky systemd service. It seems like hassle, especially when other software dealing with SSL certificates (e.g. nginx) are able to use the up to date TLS certificates.
Certificate reloading is generally a pain in non cloud-native environment. Relying on cronjob is not sexy. Try considering systemd timers.
Can you clarify why certificate reloading is pain? Quick search shows that the pattern of dynamically reloading SSL certificate is quite common:
The patch would require making sure that the certificate is loaded only when the file gets modified. blocky codebase already indirectly depends on fsnotify:
$ go mod why -m github.com/fsnotify/fsnotify
# github.com/fsnotify/fsnotify
github.com/0xERR0R/blocky/log
github.com/x-cray/logrus-prefixed-formatter
github.com/x-cray/logrus-prefixed-formatter.test
github.com/onsi/ginkgo
github.com/onsi/ginkgo/internal/remote
github.com/nxadm/tail
github.com/nxadm/tail/watch
github.com/fsnotify/fsnotify
It's a pain for ops, not developers. So thanks for the cloud-native environment.
I'm running blocky as a systemd service. I guess I can add a similar cron job that periodically restarts blocky systemd service. It seems like hassle, especially when other software dealing with SSL certificates (e.g. nginx) are able to use the up to date TLS certificates.
for systemd its much easier than docker. you can use inotify or systemd.path to monitor file changes
https://www.freedesktop.org/software/systemd/man/latest/systemd.path.html
for those running blocky on docker instead of systemd, you can even use systemd.path to restart the docker service when the file changes on disk
Is there a way to get blocky to pick up renewed certificate?
My blocky instance has run for roughly 3 months and the original letsencrypt SSL certificate expired. Blocky did not picked up the renewed certificate, becoming unavailable when serving DNS-over-TLS:
Blocky reports the old certificate expiry
After I restarted blocky:
which matches the certificate expiry date:
Could blocky automatically pick up new certificates with long expiry date?
blocky's configuration: