git: 5db79829135c - main - www/py-gunicorn: Record child process
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 08 Sep 2024 17:29:35 UTC
The branch main has been updated by bofh:
URL: https://cgit.FreeBSD.org/ports/commit/?id=5db79829135c999165db8864f37c2d8b3ba7b4f5
commit 5db79829135c999165db8864f37c2d8b3ba7b4f5
Author: Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-09-08 16:10:51 +0000
Commit: Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-09-08 17:29:11 +0000
www/py-gunicorn: Record child process
add -p to daemon to store child process pid
Currently the installed gunicorn rc.d script records the PID of the
supervisor process to /var/run/gunicorn. This is done by passing "-P"
via daemon(8).
Record the primary gunicorn worker process in /var/run as well, this
will enable better integration with tools like newsyslog(8). For example
gunicorn accepts a SIG1 signal to the main worker process to close and
reopen logfiles after rotation to the main worker as well as child
process. By also passing "-p" to daemon we can then have newsyslog get
the appropriate pid
to sent a SIG1 to.
Here are the docs on the signals gunicorn accepts, as there are other
interesting usecases this would enable as well:
https://docs.gunicorn.org/en/stable/signals.html
PR: 281005
Reported by: pete@nomadlogic.org
---
www/py-gunicorn/Makefile | 1 +
www/py-gunicorn/files/gunicorn.in | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/www/py-gunicorn/Makefile b/www/py-gunicorn/Makefile
index 2a845194b50f..3fe09753c57d 100644
--- a/www/py-gunicorn/Makefile
+++ b/www/py-gunicorn/Makefile
@@ -1,5 +1,6 @@
PORTNAME= gunicorn
DISTVERSION= 23.0.0
+PORTREVISION= 1
CATEGORIES= www python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
diff --git a/www/py-gunicorn/files/gunicorn.in b/www/py-gunicorn/files/gunicorn.in
index 86d3e2d3cad2..62e1fb68f56d 100644
--- a/www/py-gunicorn/files/gunicorn.in
+++ b/www/py-gunicorn/files/gunicorn.in
@@ -25,14 +25,16 @@ load_rc_config $name
: ${gunicorn_group=%%GROUPS%%}
pidfile="/var/run/${name}.pid"
+cpidfile="/var/run/${name}-worker.pid"
command=/usr/sbin/daemon
-command_args="-P ${pidfile} -f -ST ${name} %%PREFIX%%/bin/gunicorn -c ${gunicorn_config}"
+command_args="-P ${pidfile} -p ${cpidfile} -f -ST ${name} %%PREFIX%%/bin/gunicorn -c ${gunicorn_config}"
required_files="${gunicorn_config}"
start_precmd="gunicorn_precmd"
gunicorn_precmd()
{
install -o ${gunicorn_user} /dev/null ${pidfile}
+ install -o ${gunicorn_user} /dev/null ${cpidfile}
}
run_rc_command "$1"