added install script for agent
changed backend to agent
This commit is contained in:
@@ -7,22 +7,21 @@ Backups include the instance disk or dataset plus Incus metadata captured with `
|
||||
## Layout
|
||||
|
||||
- `management/`: Central Express API with cookie login, SQLite storage, node registry, central schedules, and proxy calls to node agents.
|
||||
- `backend/`: Node agent API that runs on each Incus host, validates Incus VMs, runs host commands with `spawn`, manages in-memory jobs, and enforces one active backup/restore per VM.
|
||||
- `agent/`: Node agent API that runs on each Incus host, validates Incus VMs, runs host commands with `spawn`, persists recent jobs, and enforces one active backup/restore per VM.
|
||||
- `frontend/`: React/Vite dashboard for management login, node management, health, VM status, snapshots, backup jobs, and explicit destructive restore confirmation.
|
||||
- `incus-backup-ui-plan.md`: Product and implementation plan.
|
||||
|
||||
## Node Agent
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
cp .env.example .env
|
||||
npm install
|
||||
npm run dev
|
||||
curl -fsSL https://forgejo.digital-droplets.de/philschlo/incus-backup-ui/raw/branch/main/deploy/install-agent.sh | sudo sh
|
||||
```
|
||||
|
||||
The node agent must run on every Incus host with permission to access Incus, ZFS, `/dev/zvol`, Restic, and S3 credentials. In production this usually means running it as root or through a tightly scoped service account with the needed privileges.
|
||||
|
||||
Set `API_TOKEN` in `backend/.env`; the management server uses that token when calling the agent. The token is required and must be at least 32 characters long.
|
||||
Set `API_TOKEN` in `agent/.env`; the management server uses that token when calling the agent. The token is required and must be at least 32 characters long.
|
||||
|
||||
The agent persists recent jobs in SQLite through `AGENT_DATABASE_PATH` (default: `./agent.sqlite`). If the agent restarts while a job is `queued` or `running`, that job is marked `failed` on startup so management can poll a final state and stale VM locks are not kept.
|
||||
|
||||
The agent can serve HTTPS directly for private networks:
|
||||
|
||||
@@ -83,7 +82,7 @@ Changing most node-agent values applies to new API calls and jobs immediately. C
|
||||
|
||||
## Safety Notes
|
||||
|
||||
Restore is intentionally guarded twice: the backend validates the snapshot against the VM, and the UI requires typing the VM name before sending the restore request. VM restores create a pre-restore ZFS snapshot and roll back to it if writing the disk fails. Restore jobs are never retried automatically.
|
||||
Restore is intentionally guarded twice: the agent validates the snapshot against the VM, and the UI requires typing the VM name before sending the restore request. VM restores write the Restic dump to a staged ZFS volume first, then swap it into place with `zfs rename`; the previous volume is kept as a pre-restore rollback copy. Restore jobs are never retried automatically.
|
||||
|
||||
## Deployment
|
||||
|
||||
|
||||
Reference in New Issue
Block a user