So I'm making a load balancer that compiles to a binary. This will be scaled across multiple servers.
To update, the program itself will check a GitHub repo for a new release every 5 minutes, if there is a new release, it downloads it overwriting the old one, then would run the command systemctl restart lb
.
Now my question is, is this a bad practice, are there any disadvantages to doing this, and is there a better practice for updating other than this?
--
Just a side note, running a cronjob is not ideal.
The recommended approach is to produce an OS package (.deb/.rpm/etc.) and offer it to the package manager.
You could utilize Github actions to generate the package, and upload it to a binary repository that creates the necessary meta files for a package repository.
The package should have the necessary commands to restart the service.
That makes replacing the service unit, the binary and supporting files trivial. Most package managers support some form of automatic updates. Even rolling back to an older release on a botched update is trivial.
You can set up your system to respond to an HTTP request that's called via Github actions (a webhook) after upload to the package repository, thus switching from a pull based polling approach to a push based approach that only triggers on an update of the git repository.