PID_FILE check: don't use in docker/systemd

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
This commit is contained in:
Klaas van Schelven
2025-07-28 20:47:06 +02:00
parent 4a73880ea7
commit 5f7cccf901
3 changed files with 12 additions and 1 deletions

View File

@@ -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,
}

View File

@@ -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,
}

View File

@@ -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")