Skip to content

Service user - #12

Merged
MarcSchlichting merged 4 commits into
mainfrom
service-user
Jun 24, 2026
Merged

MarcSchlichting merged 4 commits into
mainfrom
service-user

Conversation

@MarcSchlichting

Copy link
Copy Markdown
Collaborator

Fix expired deployment re-adoption and run services as the installing user

Summary

Fix a sync-loop bug that re-adopts expired deployments after deletion, and switch all systemd services from running as root to running as the installing user. This also consolidates data paths (model cache, logs, packages) under the Aquila data directory so behavior is identical between interactive and service mode.

Motivation

Two issues surfaced after running the cluster overnight as systemd services:

  1. Expired deployments reappear after deletion. The sync loop's adoption filter skips "stopped" and "error" statuses but not "expired", so every deleted expired deployment is re-created within 5 seconds. The client never cleans up _statuses entries for expired deployments, keeping them reportable forever via /deployments/status.

  2. Manage card shows wrong models and 0 GB weights. All systemd units lacked a User= directive, so services ran as root. The HF model cache resolved to /root/.cache/huggingface instead of the installing user's directory, causing the client agent to report a completely different set of cached models than what users expected. The same root-vs-user mismatch affected VLLM_CLIENT_ROOT (deployment logs, uploaded packages, compile caches).

Changes

  • Sync loop (sync.py): Add "expired" to the adoption skip filter so expired deployments are not re-adopted after deletion.
  • Delete endpoint (deployments.py): Best-effort stop the container before removing the DB row, preventing any active deployment from being re-adopted.
  • Systemd units (cli.py): Add User=/Group= (resolved via SUDO_USER) to all four service units (infra, backend, frontend, client). Set XDG_RUNTIME_DIR on the client unit and call loginctl enable-linger so rootless Podman sockets survive logout.
  • Data paths (cli.py, config.py): Write HF_CACHE_DIR and VLLM_CLIENT_ROOT as absolute paths in the client .env, pointing into the Aquila runtime directory. Update defaults in config.py to ~/.local/share/aquila/models and add vllm_client_root as a proper pydantic setting.
  • Clean command (cli.py): Add /root/.cache/huggingface, ~/.cache/huggingface, and /root/.vllm-client as legacy cleanup targets.
  • Documentation: Update operations.md, deployments.md, and client README.md to reflect new defaults and VLLM_CLIENT_ROOT.

Testing

  • All 492 existing tests pass.
  • DB queries confirmed deployment and node data is correct at the database level.
  • Live cluster diagnosis confirmed the model cache mismatch (client agent reporting /root/.cache/huggingface contents while users expected the llm user's cache).

Notes

Existing services continue running as root until re-deployed with aquila host up --service / aquila client up --service. Model weights in the old root-owned cache (/root/.cache/huggingface) will need to be moved to the new location or re-downloaded.

@MarcSchlichting
MarcSchlichting merged commit b33b66a into main Jun 24, 2026
5 checks passed
@MarcSchlichting
MarcSchlichting deleted the service-user branch June 24, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant