Builded new structure.

Now with remote setup and management Server
more than one Node can be connected
added user auth
This commit is contained in:
Philipp
2026-05-21 09:51:07 +02:00
parent 4c98d14352
commit aae54167a1
25 changed files with 1942 additions and 52 deletions
+23 -11
View File
@@ -4,11 +4,12 @@ Dark-mode control plane for Incus VM backups using ZFS block devices, Restic, an
## Layout
- `backend/`: Express API that validates Incus VMs, runs host commands with `spawn`, manages in-memory jobs, and enforces one active backup/restore per VM.
- `frontend/`: React/Vite dashboard for health, VM status, snapshots, backup jobs, and explicit destructive restore confirmation.
- `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.
- `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.
## Backend
## Node Agent
```bash
cd backend
@@ -17,7 +18,9 @@ npm install
npm run dev
```
The backend must run on the 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.
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.
Required commands:
@@ -27,6 +30,19 @@ Required commands:
- `udevadm`
- `dd`
## Management API
```bash
cd management
cp .env.example .env
npm install
npm run dev
```
The management API stores nodes, users, sessions, and central schedules in SQLite. Configure the first admin user through `AUTH_USERNAME` and `AUTH_PASSWORD` before the first start. If no password is configured, the development fallback is `admin`.
The management API uses Node's built-in SQLite module and requires Node.js 22.5 or newer.
## Frontend
```bash
@@ -35,17 +51,13 @@ npm install
npm run dev
```
Set `VITE_API_URL` if the API is not available at `http://localhost:3000/api`.
If `API_TOKEN` is set in the backend, set matching `VITE_API_TOKEN` for the frontend.
Set `VITE_API_URL` if the management API is not available at `http://localhost:3100/api`.
## Settings Page
The UI includes a Settings page for editing the backend environment values directly. It writes to `backend/.env` through `GET /api/settings` and `PUT /api/settings`.
The UI includes a Settings page for editing selected node-agent environment values through the management API. The management server forwards those requests to the selected node agent.
If `API_TOKEN` is set from the Settings page, the browser stores that token locally and immediately uses it for subsequent API requests. If a token is already configured on the backend and the browser does not know it yet, start the frontend with `VITE_API_TOKEN` or clear/update the token manually in browser storage.
Changing most values applies to new API calls and jobs immediately. Changing `PORT` requires restarting the backend process.
Changing most node-agent values applies to new API calls and jobs immediately. Changing a node-agent `PORT` requires restarting that agent process.
## Safety Notes