Right now, my main website is a CL executable behind an nginx proxy.
When I make changes, I have to create a new executable. Stop, the old one and restart the new one. As my traffic grows, this is concerning.
Is there a better buils system approach that doesn’t have me stopping the image?
2
Answers
You can minimize downtime by running the new executable on a different port, then switch the port in nginx, and only then stopping the old one.
You could also try to organize your code in such a way that you can reliably load/reload/unload only parts to transform your running image to a defined target state, but I am not aware of a systematic approach to that. There have been people who did this on the fly, but I think in general, one should try to make things reproducible.
The Common Lisp way would be to create a Swank server from your executable, connect to it from your Slime at home, and load the new code -to update the running instance.
Hints: https://lispcookbook.github.io/cl-cookbook/debugging.html#remote-debugging
It isn’t as solid as deploying a whole new binary, but if you don’t develop new code in production without local checkouts, it should be reproducible.
It is anyways a useful method to poke data on the production instance, or update settings without a restart.