- Does Fly automatically restart servers by default?
- If no (to #1), is there a way to automatically restart servers at least once every 24 hours (Eg. via a
Reason – I have a web service running on Fly, and I’d like to have each instance restart regularly to mitigate any memory leaks I’ve introduced (or have been introduced by dependencies) but haven’t been fixed yet.
As far as I know (just as a user), no to both.
I wonder if you could simply reboot your vm once a day using a simple cron?
sudo crontab -e
… and then e.g …
0 2 * * * shutdown -r now
… which (in theory) should cause the vm to reboot at 2am each day (adjust the ‘2’ as desired). I’ve never run a cron on a Fly vm so there may be a better way of automating it. But that would be my guess.
Update: actually, thinking about it, that’s not going to work. Because it’s run using docker (well, sort of). I’ve been back working on non docker (firecracker) VMs where you can do this kind of stuff. Hmm.
Depending on your base image, I found this repo which may offer some examples of how to run a general task GitHub - AnalogJ/docker-cron: `cron` base images for various distros. So you could run a shutdown/reboot command.
But there may be an official way to do it.