From 739c7e7dc0e4a2822df12a9fdc9c75e15b1f8f7e Mon Sep 17 00:00:00 2001 From: Fred Date: Mon, 28 Dec 2020 12:46:42 +0100 Subject: [PATCH] =?UTF-8?q?Red=C3=A9marrage=20gracieux=20du=20process=20ma?= =?UTF-8?q?ster=20de=20gunicorn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `pc -C gunicorn` only lists the processes with `gunicorn` command, i.e., workers and master process. Workers are children of master as can be seen using `ps -C gunicorn fc -o ppid,pid,cmd`. We only need the pid of the master, therefore h flag is used to remove the first line which is PID text. Note that, f flag assures that master is printed above workers. The correct procedure is to send `HUP` signal only to the master. In this way `gunicorn` is gracefully restarted, only the workers, not master, are recreated. --- source/part-2-deployment/debian.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/part-2-deployment/debian.adoc b/source/part-2-deployment/debian.adoc index c053801..d6d9ff0 100644 --- a/source/part-2-deployment/debian.adoc +++ b/source/part-2-deployment/debian.adoc @@ -357,8 +357,9 @@ git checkout vX.Y.Z pip install -U requirements/prod.txt python manage.py migrate python manage.py collectstatic -gunicorn reload -HUP +kill -HUP `ps -C gunicorn fch -o pid | head -n 1` <1> ---- +<1> https://stackoverflow.com/questions/26902930/how-do-i-restart-gunicorn-hup-i-dont-know-masterpid-or-location-of-pid-file ==== Configuration des sauvegardes