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?
Accordingly to this discussion, there is no safe way to stop Kestrel now. You need to find a PID by name of your dll and kill it:
kill $(ps aux | grep 'MySite.dll' | awk '{print $2}')
In case of process tree, you need to manually grep all child IDs and call kill
for each. Like it was done in
Microsoft.Extensions.Internal.ProcessExtensions.KillTree method (correct link from the discussion).