Open adamsewell opened 2 years ago
Similar to #7 . There are some challenges:
If reload is triggered by user (by restarting the application manually), the problem can be fixed immediately, but if reload happens automatically it can lead in a total crash. Since DNS is a critical part of the network infrastructure, there must be a safety net.
Please read my concerns in the linked issue. Maybe you have some ideas how to solve them?
I swear I searched for this before I posted haha.
So in my opinion, some sort of validation would be needed here. Something similar to the nginx -t option. If blocky detects that there is a error in the configuration, it would continue to run the existing config in memory but if it passes validation then it would reload.
Edit: I'm not familiar with Go, but I did a quick search and it looks like the go-yaml library has a built-in validation function. Does the YAML library you use have a function like that? If so, that's where I'd start. Make sure it's a valid config.
It validates if YAML has correct syntax and if some custom types (like upstreams) have correct format. It would probably also make sense only reload a part of configuration attributes (for example, changing of listening port must require restart, but defining a new blocking list not).
I would be good with that. The most common use case for me would be to add new entries in clientGroupsBlock and blackLists/whiteLists or modify existing entries.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
While implementing #375 the whole config loading is done through koanf. Auto loading could be reevaluated as followup as koanf provides a watch functionality.
Even without watching, reloading on SIGHUP would be useful and provide some mitigation on config loading failure as the signal sender could be expected to be watching. It would be similar to a full restart but, ideally, without (or will less) downtime.
A feature I'd love to have is the ability for blocky to automatically reload it's configuration from time to time or a configurable time period. For example, if I add another client, I'd like to have blocky pick that up rather than restart the docker instance.