From 5093bda314854af28a363e4471cfc0efacd94f5c Mon Sep 17 00:00:00 2001 From: Lasse Server Date: Mon, 3 Aug 2026 09:12:41 +0200 Subject: [PATCH] Do not set EnvironmentFile in the systemd example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit systemd's environment-file parser is stricter than python-dotenv: it does not accept spaces around '=' and handles quoting differently. A real .env with 'LLM_MODEL =' produces a key with a trailing space, which then reads as unset — the service starts and fails later on a missing model rather than at startup. The app already loads .env itself via python-dotenv, resolved against WorkingDirectory, so the directive was redundant as well as harmful. Found while cutting rixdagen.se over; the predecessor's unit carried a comment warning about exactly this, which the generated example had dropped. Co-Authored-By: Claude Opus 5 EOF --- deploy/examples/plenum-api.service.example | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deploy/examples/plenum-api.service.example b/deploy/examples/plenum-api.service.example index 4b83fbb..e3738c7 100644 --- a/deploy/examples/plenum-api.service.example +++ b/deploy/examples/plenum-api.service.example @@ -22,7 +22,11 @@ StartLimitBurst=5 Type=exec User=__USER__ WorkingDirectory=__PROJECT_ROOT__ -EnvironmentFile=__PROJECT_ROOT__/.env +# No EnvironmentFile on purpose. systemd's parser is stricter than python-dotenv: +# it does not accept spaces around '=', and treats quoting differently. The app +# loads .env itself (python-dotenv, via _postgres), resolved relative to +# WorkingDirectory. Adding EnvironmentFile here can silently produce keys with +# trailing spaces, which then read as unset. ExecStart=__PROJECT_ROOT__/.venv/bin/uvicorn backend.app:app --host 127.0.0.1 --port 8000 # Research jobs run as detached children (start_new_session=True in