systemd-live-dev
Long-lived BAS dev stack via systemd user units (not Docker): install units, restart after code changes, journalctl for errors, health curls between wakes…
от bbartling★ 20 звёзд на GitHub
Установить systemd-live-dev в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
systemd live dev (not Docker)
Default runtime
- Do not use Docker Compose as the primary long-lived runtime unless
BUILD_CHECKPOINTSexplicitly requires it. - Use systemd user units
bas-backend.serviceandbas-frontend.service(create frontend unit if missing — remote UI needs:5173). - Source of truth for commands and ports:
bas_app/README.md§ Run (not old templates that assumeduvicorn+bas_app_backend).
Canonical unit files (this repo’s bas_app layout)
Install copies under ~/.config/systemd/user/. After edits: systemctl --user daemon-reload then restart each changed unit.
bas-backend.service
Must match cd /home/ben/bas_app && python3 -m backend (stdlib package backend with __main__.py). Wrong: WorkingDirectory=/home/ben/bas_app/backend + python3 -m bas_app_backend + PYTHONPATH=src — that produces No module named bas_app_backend and empty :8000.
[Unit]
Description=BAS head-end API (bas_app stdlib backend)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/ben/bas_app
Environment=BAS_BIND_HOST=0.0.0.0
Environment=BAS_BIND_PORT=8000
# When UI is loaded from the LAN IP, include that Origin (comma list replaces defaults — add loopback too).
Environment=BAS_ALLOWED_ORIGINS=http://127.0.0.1:5173,http://localhost:5173,http://<head-end-ip>:5173
ExecStart=/usr/bin/python3 -m backend
Restart=on-failure
RestartSec=3
[Install]
WantedBy=default.target
bas-frontend.service
Must match cd /home/ben/bas_app/frontend && python3 -m http.server 5173 --bind 0.0.0.0.
[Unit]
Description=BAS static frontend (http.server)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/ben/bas_app/frontend
ExecStart=/usr/bin/python3 -m http.server 5173 --bind 0.0.0.0
Restart=on-failure
RestartSec=3
[Install]
WantedBy=default.target
Anti-drift checklist (run after any backend layout change)
| Symptom | Likely cause |
|---|---|
No module named bas_app_backend in journal |
Unit still points at old FastAPI / src layout |
curl http://127.0.0.1:8000/health fails |
Backend not started or wrong WorkingDirectory |
| UI static but login never works from LAN | :8000 down; UI alone is not enough |
Wake log: post_wake_stack: skip (no …/backend yet) but backend/app.py exists |
Default bas_post_wake_stack.sh gate does not match this tree — Codex does not depend on patching it: ship bas_app/scripts/ + README “headless start” and/or point POST_WAKE_HOOK at that script until ops upgrades the hook |
post_wake starts uvicorn app.main:app and dies |
Hook command does not match stdlib python3 -m backend — same: Path B in BUILD_CHECKPOINTS.md |
bas_post_wake_stack.sh (optional hook; not Codex’s only lever)
- May skip or use the wrong start command for this repo’s stdlib layout. Policy: Codex delivers
bas_app/README.md+bas_app/scripts/parity so humans/cron canPOST_WAKE_HOOK=bash /home/ben/bas_app/scripts/<your>.shwithout editingbas_build_specbinaries.
Codex / cron wake shells and systemctl --user
Symptom: Failed to connect to bus: No medium found (or Connection refused to session bus) when running systemctl --user, journalctl --user, or systemctl --user cat … from bas_wake.sh → codex exec.
Why: User systemd --user talks to $XDG_RUNTIME_DIR/systemd/private (usually /run/user/<UID>). Cron and non-interactive Codex shells often have no XDG_RUNTIME_DIR / DBUS_SESSION_BUS_ADDRESS, and there may be no active logind session for that UID when the job fires — so there is literally no user manager bus in that environment. This is normal, not a broken app.
What Codex should do (in order):
- Detect:
UID=$(id -u); test -d "/run/user/$UID" && echo "runtime_dir_ok" || echo "runtime_dir_missing". - If
runtime_dir_ok: prepend commands withXDG_RUNTIME_DIR=/run/user/$UID(and optionallyDBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/busif the socket exists):XDG_RUNTIME_DIR=/run/user/$(id -u) systemctl --user daemon-reloadXDG_RUNTIME_DIR=/run/user/$(id -u) systemctl --user restart bas-backend.service bas-frontend.service - If
runtime_dir_missing: do not treat “systemctl failed” as proof the unit file is wrong. Document for operators inbas_app/README.md:sudo loginctl enable-linger <username>once (keeps[email protected]and/run/user/UIDafter boot and without GUI login).- Or run
systemctl --user …from an SSH login as that user (interactive session creates the bus).
- Always verify the stack with Path-agnostic checks that work from cron:
ss -ltnp,curl http://127.0.0.1:8000/health. If these pass, the product is up
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл systemd-live-dev?
Long-lived BAS dev stack via systemd user units (not Docker): install units, restart after code changes, journalctl for errors, health curls between wakes. Triggers on: systemd, user unit, bas-backend, bas-frontend, journalctl, crash-loop, No module named, POST_WAKE_HOOK, bas_post_wake_stack, 8000, 5173, remote dial-in, WorkingDirectory, python3 -m backend, No medium found, XDG_RUNTIME_DIR, loginctl enable-linger, codex exec, cron wake shell.
Как установить скилл systemd-live-dev?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл systemd-live-dev запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…