From 5f7cccf9018f2645df4d36b8c2871fd3df5698e3 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Mon, 28 Jul 2025 20:47:06 +0200 Subject: [PATCH] PID_FILE check: don't use in docker/systemd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per the parent commit: the "small check" is not bullet-proof (as per #99) and in Docker/systemd environments it's better to leave the thing that's actually in charge of lifecycles in charge rather than reproduce that behavior. You can’t fail the check if you deliberately skipped it. Fix #99 --- bugsink/conf_templates/docker.py.template | 6 ++++++ bugsink/conf_templates/singleserver.py.template | 6 +++++- bugsink/settings/development.py | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bugsink/conf_templates/docker.py.template b/bugsink/conf_templates/docker.py.template index c7c4760..620a6c4 100644 --- a/bugsink/conf_templates/docker.py.template +++ b/bugsink/conf_templates/docker.py.template @@ -59,6 +59,12 @@ SNAPPEA = { "NUM_WORKERS": int(os.getenv("SNAPPEA_NUM_WORKERS", 2)), "STATS_RETENTION_MINUTES": int(os.getenv("SNAPPEA_STATS_RETENTION_MINUTES", 60 * 24 * 7)), + + # in our Dockerfile the foreman is started exactly once (no check against collisions needed) and whaterver is + # running the container is responsible for the container's lifecycle (again: no pid-file check needed to avoid + # collisions) + "PID_FILE": None, + } diff --git a/bugsink/conf_templates/singleserver.py.template b/bugsink/conf_templates/singleserver.py.template index c30b1dc..60804c6 100644 --- a/bugsink/conf_templates/singleserver.py.template +++ b/bugsink/conf_templates/singleserver.py.template @@ -43,7 +43,11 @@ SNAPPEA = { "TASK_ALWAYS_EAGER": False, "NUM_WORKERS": 4, - "PID_FILE": "{{ base_dir }}/snappea/snappea.pid", + "PID_FILE": None, + # alternatively (if you don't trust systemd to get at most one snappea foreman running; or if you don't use systemd + # at all), use the below: + # "PID_FILE": "{{ base_dir }}/snappea/snappea.pid", + "WAKEUP_CALLS_DIR": "{{ base_dir }}/snappea/wakeup", "STATS_RETENTION_MINUTES": 60 * 24 * 7, } diff --git a/bugsink/settings/development.py b/bugsink/settings/development.py index f8e7127..1e1c6c7 100644 --- a/bugsink/settings/development.py +++ b/bugsink/settings/development.py @@ -61,6 +61,7 @@ if not I_AM_RUNNING == "TEST": SNAPPEA = { "TASK_ALWAYS_EAGER": True, # at least for (unit) tests, this is a requirement "NUM_WORKERS": 1, + "PID_FILE": "/tmp/snappea.pid", # for development: a thing to 'tune' to None to test the no-pid-check branches. } EMAIL_HOST = os.getenv("EMAIL_HOST")