Files
clawstor/deploy/systemd/README.md
Omar Sobh f33468b7c2
Build with clawstor cache / Cargo build (clawstor-cached) (pull_request) Successful in 16s
dashboard-v2 PR 2: frontend SPA + serve integration
React 19 + Vite + Tailwind + wouter (tiny router, no external
state library). Consumes the /api/v2/* endpoints shipped in PR 1.
Serves under /v2/* so the legacy dashboard at / stays live.

Pages:
* CommandCenter (/)      — fleet strip + this-node stat tiles
* NodeDetail (/nodes/:name) — per-node deep dive
* StorageBrowser (/storage/{blobs,tags,refs,snapshots}) — tables
  with prefix filter
* RefTrackingPage (/refs/tracking) — grouped by repo

Backend changes:
* claw-store serve grows --v2-static-dir <path>
* build_app split into build_app_with_v2 for the extra static
  mount
* /v2/* falls through to index.html so wouter client routing works

New systemd unit: clawstor-dashboard.service. Points at both
static dirs; installs on any node.

dashboard/ (legacy) untouched. dashboard-v2/ built to
target/dashboard-v2/dist for deploy.

Deploy sequence per node:
1. cp target/release/claw-store  ~/clawstor-deploy/
2. rsync dashboard-v2/dist/      ~/clawstor-deploy/dashboard-v2/
3. cp deploy/systemd/clawstor-dashboard.service ~/.config/systemd/user/
4. systemctl --user daemon-reload && enable --now clawstor-dashboard.service

Cross-node fan-out for /api/v2/node/:name/status is PR 3.
Action POSTs (scrub/gc/snapshot/pin) are PR 4.
2026-07-14 15:59:47 -07:00

71 lines
2.8 KiB
Markdown

# deploy/systemd
Systemd **user** units for clawstor.
## Units
| Unit | Purpose |
|---|---|
| `clawstor-cluster.service` | daemon (gossip + RPC + Prometheus + build cache). Not shipped here — deployed per-node from the fleet playbook. |
| `clawstor-fuse.service` | Phase 6 read-only FUSE mount at `~/clawstor-mount/`. Depends on `clawstor-cluster.service`. |
| `clawstor-dashboard.service` | HTTP dashboard on `:7700`. Serves the v2 SPA at `/v2/*` + `/api/v2/*`. See `docs/dashboard-v2.md`. |
| `clawstor-scrub.service` + `clawstor-scrub.timer` | Weekly (Sun 04:00) BLAKE3 verify every chunk against its manifest. Non-zero exit = integrity failure — surfaced by systemd status. |
| `clawstor-gc.service` + `clawstor-gc.timer` | Nightly (03:30) orphan-chunk sweep. Override ExecStart via drop-in to add `--evict-to-gb N` for size-cap fleets. Sequenced before the Sunday scrub so scrub reads a fresh layout. |
| `clawstor-ref-sweep.service` + `clawstor-ref-sweep.timer` | Nightly (03:15) Gitea live-refs poll + stale-fingerprint report. Set `GITEA_TOKEN` via a drop-in for private repos. Report-only (dry-run) — deletion is a follow-on. |
| `clawstor-snapshot-rotate.service` + `clawstor-snapshot-rotate.timer` | Daily (02:00) create `daily-YYYY-MM-DD` snapshot + prune snapshots older than `RETAIN_DAYS` (default 30). Only touches snapshots whose name matches `daily-*` — hand-created ones survive. |
## Install `clawstor-fuse.service` (Linux)
Prereqs: `libfuse3-dev` + `pkg-config` installed, `claw-fuse` binary built with
`cargo build --release --features fuse --bin claw-fuse`. Create the
mount directory once before enabling the unit — the unit no longer
does that itself (some Ubuntu builds refuse subsequent FUSE mounts
after an ExecStartPre chain touches the mount point):
```bash
mkdir -p ~/clawstor-mount
```
```bash
# 1. Copy the binary
cp target/release/claw-fuse ~/clawstor-deploy/claw-fuse
# 2. Install the unit
mkdir -p ~/.config/systemd/user
cp deploy/systemd/clawstor-fuse.service ~/.config/systemd/user/
# 3. Reload + enable
systemctl --user daemon-reload
systemctl --user enable --now clawstor-fuse.service
# 4. Verify
systemctl --user status clawstor-fuse.service
ls ~/clawstor-mount/ # blobs snapshots tags
```
Override the default paths with a drop-in:
```bash
systemctl --user edit clawstor-fuse.service
```
```ini
[Service]
Environment=CLAWSTOR_MOUNT=/mnt/clawstor
```
## Install `clawstor-scrub.timer`
```bash
cp deploy/systemd/clawstor-scrub.service ~/.config/systemd/user/
cp deploy/systemd/clawstor-scrub.timer ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now clawstor-scrub.timer
# Verify:
systemctl --user list-timers clawstor-scrub.timer
# Run once manually to confirm the service works:
systemctl --user start clawstor-scrub.service
journalctl --user -u clawstor-scrub.service --since -5min
```