Files
loki/scripts/hetzner/loki-embed.service
CatoandClaude Opus 5.5 7fddc81f46 fix(deploy): every deploy ships the embed server, so #1594 reaches the box (#1595)
The memory bound from #1594 merged and changed nothing on the box: server.py
and the loki-embed unit were written only by install-fleet-rag.sh, which needs
a laptop's ssh key (and this morning the laptop's agent could not sign). The
unit lived as a heredoc inside that installer, so the deploy had nothing to
ship.

Move the unit to scripts/hetzner/loki-embed.service, have the installer copy
it, and have deploy-hetzner.sh content-sync server.py + the unit, restarting
loki-embed (and waiting on /health) only when one changed. Warn-only, skipped
where the install never ran. scripts/test/deploy-ships-embed.ts guards both
halves.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 07:05:57 +01:00

27 lines
910 B
Desktop File

# Installed by scripts/hetzner/install-fleet-rag.sh and re-synced by every
# deploy (scripts/deploy-hetzner.sh), so an edit here reaches the box without a
# laptop holding an ssh key.
[Unit]
Description=Loki local embeddings server (fastembed, OpenAI-compatible)
After=network-online.target
# Keep retrying past the default start-limit instead of locking to "failed".
StartLimitIntervalSec=0
[Service]
Type=simple
User=root
WorkingDirectory=/opt/loki/embed
Environment=EMBED_MODEL=BAAI/bge-small-en-v1.5
Environment=EMBED_PORT=7997
# A shared box: when this process balloons, the kernel must reclaim or kill IT,
# not swap every app into Postgres timeouts (2026-11-06: 2GB, swap full, six
# other apps' crons failed). Steady state is ~320MB.
MemoryHigh=768M
MemoryMax=1G
ExecStart=/opt/loki/embed/venv/bin/python /opt/loki/embed/server.py
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target