Do not set EnvironmentFile in the systemd example

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 <noreply@anthropic.com>
EOF
main
Lasse Edfast 1 week ago
parent dbbc264a0a
commit 5093bda314
  1. 6
      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

Loading…
Cancel
Save