When deploying a new version of an existing .net core website. How do I first safely stop the old running kestrel app?
Here is an exmaple of what I would like to write (Pseudo deployment script):
dotnet stop mysite/mysite.dll <---- this line here mv mysite/ mysite.bak/ cp newly-published-mysite/ mysite/ dotnet run mysite/mysite.dll
killall dotnet
seems a little unsafe. How would it work if I were hosting two small sites on one box?
Advertisement
Answer
I have decided to use supervisor to monitor and manage the process. Here is an excellent article on getting it set up.
It allows simple control over specific dotnet apps like this:
supervisorctl stop MyWebsiteName supervisorctl start MyWebsiteName
And it has one huge advantage in that it can try restart the process if it falls over, or when the system reboots… for whatever reason.