Skip to content

Arch Linux systemd packaging with dependency ordering - #2233

Closed
Raudbjorn wants to merge 3 commits into
vectorize-io:mainfrom
Raudbjorn:feature/archlinux-packaging
Closed

Raudbjorn wants to merge 3 commits into
vectorize-io:mainfrom
Raudbjorn:feature/archlinux-packaging

Conversation

@Raudbjorn

Copy link
Copy Markdown

Summary

Packaging for Arch Linux with systemd service units, dependency ordering, and Arc A770 XPU support.

Changes

  • hindsight-api.service:

    • Inline all env vars (fixes startup freeze caused by EnvironmentFile parsing issues)
    • ,
    • for startup ordering
      • — the working combo that allows PostgreSQL's socket file while still hardening the service
  • hindsight-control-plane.service:

    • for dependency ordering
    • (via env, Next.js standalone ignores most port env vars)
  • hindsight-worker.service:

    • New service for async import processing
    • Depends on
  • embeddings.py: Added detection for Arc A770 XPU embedding acceleration

Deployment

The installed package at provides:

  • : API on
  • : CP on
  • : Async worker

Ports 6699 and 9966 are reachable over Tailscale at and .

Known limitations

  • Arc A770 XPU for Ollama LLM is fragile when shared with the Wayland compositor (KWin). The GPU can deadlock under heavy concurrent use.
  • Embeddings run on CPU (XPU torch causes iGPU initialization spin with override).
  • on Arc A770 via Ollama Vulkan is slow (~30s+ per response); smaller models like are more responsive.
  • Control plane endpoint returns 500 (calls but API has ).
  • Reflect operations can time out on large banks (54K+ pending ops).

- hindsight-api.service: FastAPI server on port 8888
- hindsight-control-plane.service: Next.js web UI on port 9999
- hindsight.install: post-install hook for user/group creation and shebang fix
- PKGBUILD: builds monorepo, installs Python packages via uv + local paths,
  bundles Node.js standalone build, creates hindsight user, installs systemd units
- env.env.systemd: env template for systemd deployment
- packaging/systemd/README.md: usage instructions
…ordering

- hindsight-api: inline all env vars instead of EnvironmentFile (fixes startup freeze)
- hindsight-api: add HINDSIGHT_API_SKIP_LLM_VERIFICATION, HINDSIGHT_API_PORT=6699
- hindsight-api: add After=postgresql.service, PrivateTmp=false
- hindsight-api: ProtectSystem=full + PrivateTmp=false is the working combo (full whitelist includes /tmp)
- hindsight-control-plane: add Requires=hindsight-api.service for startup ordering
- hindsight-worker: new service file for async import processing
- embeddings.py: add XPU torch detection for Arc A770

@nicoloboschi nicoloboschi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good example but I prefer to not commit it since it contains custom hindsight vars

can you remove the ollama config?

Fixes 502 Bad Gateway when browser accesses CP from remote.
CP→API proxy fails without this env var.
@nicoloboschi

Copy link
Copy Markdown
Collaborator

Thanks for this @Raudbjorn — the Intel XPU support is genuinely useful and I've pulled it out into its own PR (#2260) so it can land independently with your authorship credited. I'm going to close this PR in favor of that split. Below is the reasoning and what would be needed to revisit the packaging side.

Why split

This PR bundles two unrelated concerns: a product-code change (embeddings.py XPU detection) and Arch-specific distro packaging. The first is broadly useful and low-risk; the second is niche, contentious, and untested. Keeping them together means the good change waits on the debatable one.

Packaging — concrete issues found

  1. Env var name mismatch. env.env.systemd uses HINDSIGHT_API_LLM_SKIP_VERIFICATION, but the real config var is HINDSIGHT_API_SKIP_LLM_VERIFICATION (config.py). The service file gets it right, so the two disagree.
  2. Installed config file is never read. PKGBUILD installs the env template to /etc/hindsight/env and the README tells users to edit it — but neither unit uses EnvironmentFile=; they inline all env. So editing /etc/hindsight/env has no effect. That's a confusing operator trap.
  3. hindsight-worker.service is added but never installed — package() only installs the api and control-plane units.
  4. Wrong license — PKGBUILD declares ISC; this repo is MIT.
  5. Points at a personal fork — url/source reference Raudbjorn/hindsight instead of vectorize-io/hindsight.
  6. Personal infra baked in — hardcoded ports 6699/9966 and Tailscale references are deployment-specific.
  7. Redundant version — pkgver=0.8.2 is hardcoded alongside a pkgver() that derives it from git tags.

On distro packaging in-tree

Conventionally Arch packaging lives in the AUR rather than the upstream repo, since it's distro-specific and needs ongoing maintenance + CI to not bitrot. If the team does want first-party packaging here, the bar would be: upstream URL/source, correct license, config actually wired via EnvironmentFile= (or drop the file), all three units installed, and a CI job that at least lints the PKGBUILD.

Happy to look again if you'd like to reopen the packaging piece against that bar. Thanks again for the XPU contribution! 🙏

nicoloboschi added a commit that referenced this pull request Jun 17, 2026
…2260)

Extend local device detection so sentence-transformers can use an Intel
XPU (e.g. Arc A770) when a torch XPU build is loaded, falling back to CPU
otherwise. Split out from #2233.

Co-authored-by: Sveinbjörn Geirsson <raudbjorn@github>
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.

2 participants