I’m using the discourse_docker repo with the launcher script to run an internal Discourse instance. I’d like to persistently change the restart policy from always to unless-stopped to be able to keep the docker containers stopped when doing OS upgrades / reboots.
I can see that the restart policy is a variable in the launcher script but how to best keep this setting when a new container is built? It should work via both “launcher rebuild” as well as using the docker_manager via /admin/upgrade
Yeah, I know that The docker update is what I’m currently doing. But I’m afraid I’m going to forget it at some of the next rebuilds. So hence the question how to make it persistent.
Another option would be to just edit the launcher script and hope for not too many rebase conflicts upon pull
The only time I’ve had trouble wtih restarts after a boot is if I switched from app.yml to web_only.yml and forgot to destroy the app container. I regularly do docker upgrades and reboots without any trouble with the autostarts. FWIW, I haven’t seen anyone else concerned about this in the past 5 years. Unless you’ve got some stuff at play that I don’t know about, maybe just don’t worry about it?
Well today the issue was that I wanted to do a fresh install as I had some weird 2.4.0-betaXYZ which wouldn’t update on it’s own. I did a test on another VM with a clean install and restoring the backup to 2.7.12 which worked perfectly (also split the data container into redis and postgres).
Now the main server was still running an old Ubuntu and old Docker, so I wanted to
take a backup
shutdown Discourse
do OS upgrade shenanigans without worrying about Discourse including several reboots
Do a fresh installation
Restore the backup
I just wanted to keep the containers off and do not delete them right away, as I wasn’t sure anymore if I needed anything from them which I might had forgotten during my test. And I just thought, hey, unless-stopped is to me the perfect restart policy as it makes sure the containers come up after reboot automatically just unless you manually stop them. Usually exactly what I want, so i thought why not trying to make that permanent.
It’s not a big deal if it’s not possible. Will just do the docker update (or if I keep forgetting it too often do the docker update via cron every 5 min )