thread_id: 019fbceb-abdb-7f40-9c7f-6529d8480a03
updated_at: 2026-08-01T18:03:37+00:00
rollout_path: /home/Messier82/.codex/sessions/2026/08/01/rollout-2026-08-01T13-43-09-019fbceb-abdb-7f40-9c7f-6529d8480a03.jsonl
cwd: /home/Messier82/projects/pellet-price-tracker
git_branch: main

# Added rootless Podman Quadlet deployment and clarified data persistence

Rollout context: In `/home/Messier82/projects/pellet-price-tracker`, the user requested running the container as a host service using Quadlet. The worktree already had unrelated in-progress changes, which were preserved.

## Task 1: Add Quadlet host service deployment

Outcome: partial

Preference signals:
- The user wanted the container to persist as a host service after PC restart, not merely run interactively. Future deployment work should explicitly address boot persistence and storage migration.
- The user later emphasized that the old manually launched container had data before Quadlet and expected that data to be accounted for; deployment changes should verify the exact existing volume/container storage before creating a new volume.

Key steps:
- Inspected `compose.yaml`, `Dockerfile`, settings, worker health behavior, and existing operations documentation.
- Added rootless Quadlet definitions under `deploy/quadlet/` for separate web and worker services plus a named `pellet-data` volume.
- Added `deploy/install-quadlet.sh`, which installs units, creates a mode-0600 environment file, builds `localhost/pellet-price-tracker:latest`, reloads user units, and restarts both services.
- Added documentation for installation, `loginctl enable-linger`, updates, logs, health checks, Compose migration, backup, and restore.
- Fixed a Quadlet label parsing issue: labels containing spaces were split into multiple labels; the label was changed to `io.containers.systemd.description=pellet-price-tracker-data`.
- Fixed environment-file portability by using `%E/pellet-price-tracker/environment` and ensuring the installer reapplies mode 0600.

Failures and how to do differently:
- The first full test run reached 143/152 tests and then hung in `test_dashboard_and_delivery_cost_flow`; it was interrupted. Do not report the full suite as passing without rerunning the remaining web tests.
- This execution environment lacked `systemctl`, so the installer was not run against a real systemd user session. Validate installation on the target host.
- An initial attempt to inspect Podman volumes and Compose-resolved naming was aborted by the user, so the exact old storage location was never verified.

Reusable knowledge:
- Quadlet generated cleanly with `/usr/lib/systemd/system-generators/podman-system-generator --user --dryrun` using the three definitions.
- Generated web and worker services both mount the named `pellet-data` volume at `/data`; the worker depends on the web service and both have restart policies and health checks.
- The image build succeeded and disposable runtime checks passed: web `/health/ready` returned `{"status":"ready","database":"ok"}` and the worker health check passed after elevated execution. Temporary containers and volume were removed.
- Quadlet-generated services use `[Install] WantedBy=default.target`; they are not enabled with ordinary `systemctl enable`. `loginctl enable-linger <user>` is needed for services to run across logout and boot.
- Container recreation is safe only when the same named volume is mounted. Explicitly deleting `pellet-data` deletes the database, backups, Telegram secrets, and Drive-backup configuration.
- The old manually launched container likely used its writable layer or a different/anonymous volume. Quadlet created a fresh `pellet-data` volume, explaining why previous data was absent. Recovery is possible only if the old container or its original volume still exists, or a backup exists.

References:
- `deploy/quadlet/pellet-price-tracker-data.volume`
- `deploy/quadlet/pellet-price-tracker-web.container`
- `deploy/quadlet/pellet-price-tracker-worker.container`
- `deploy/quadlet/environment.example`
- `deploy/install-quadlet.sh`
- Install command: `./deploy/install-quadlet.sh`
- Boot persistence: `loginctl enable-linger "$USER"`
- Generator validation: `QUADLET_UNIT_DIRS="$PWD/deploy/quadlet" /usr/lib/systemd/system-generators/podman-system-generator --user --dryrun`
- Storage inspection: `podman volume inspect pellet-data --format '{{.Mountpoint}}'`
