added install script for agent

changed backend to agent
This commit is contained in:
Philipp
2026-06-04 14:05:50 +02:00
parent 7f2785fb05
commit 0b059aec1d
669 changed files with 767 additions and 70582 deletions
+25 -6
View File
@@ -2,21 +2,38 @@
## Node Agent
Run this on every Incus host:
Run this on every Incus host. The installer clones or updates the repository, creates the agent state/config directories, prepares `agent/.env`, installs npm dependencies, installs the systemd unit, and starts the service:
```bash
cd /opt/incus-backup-ui/backend
cp .env.example .env
npm install
sudo npm start
curl -fsSL https://forgejo.digital-droplets.de/philschlo/incus-backup-ui/raw/branch/main/deploy/install-agent.sh | sudo sh
```
To pin the source repository or branch:
```bash
curl -fsSL https://forgejo.digital-droplets.de/philschlo/incus-backup-ui/raw/branch/main/deploy/install-agent.sh \
| sudo INCUS_BACKUP_REPO_URL="https://forgejo.digital-droplets.de/philschlo/incus-backup-ui.git" INCUS_BACKUP_BRANCH="main" sh
```
Useful installer environment variables:
- `INSTALL_DIR`: install location, default `/opt/incus-backup-ui`.
- `INCUS_BACKUP_REPO_URL`: Git repository URL.
- `INCUS_BACKUP_BRANCH`: Git branch, default `main`.
- `API_TOKEN`: explicit agent token. If omitted, the installer generates one and prints it once.
- `ALLOWED_MANAGEMENT_IPS`: optional comma-separated management server IP allowlist.
- `HTTPS_ENABLED`, `TLS_CERT_FILE`, `TLS_KEY_FILE`: direct HTTPS settings for the agent.
- `SKIP_START=true`: install/update but do not start the service.
If you are upgrading an older installation, the node-agent directory was previously named `backend`. The installer handles the code directory rename and moves an existing ignored `backend/.env` to `agent/.env` when needed.
Important `.env` values:
```env
HOST="0.0.0.0"
PORT=3000
API_TOKEN="long-random-token-at-least-32-characters"
AGENT_DATABASE_PATH="/var/lib/incus-backup-agent/agent.sqlite"
HTTPS_ENABLED=true
TLS_CERT_FILE="/etc/incus-backup-agent/tls.crt"
TLS_KEY_FILE="/etc/incus-backup-agent/tls.key"
@@ -25,6 +42,8 @@ ALLOWED_MANAGEMENT_IPS="management-server-ip"
`API_TOKEN` is required and must be at least 32 characters long. If `ALLOWED_MANAGEMENT_IPS` is set, the agent only accepts requests from those comma-separated IP addresses.
`AGENT_DATABASE_PATH` stores recent agent jobs. Put it on persistent local storage, for example under `/var/lib/incus-backup-agent/`. If the agent restarts while a backup or restore is active, the persisted job is marked `failed` on startup and stale per-VM locks are cleared.
For private networks such as NetBird, the agent can serve HTTPS directly with an internal CA. Create one CA and sign one certificate per agent. The certificate must contain the NetBird IP or internal DNS name as a SAN:
```bash
@@ -41,7 +60,7 @@ sudo install -m 644 tls.crt /etc/incus-backup-agent/tls.crt
Copy `agent-ca.crt` to the management server and set `AGENT_CA_FILE` there.
Install systemd service:
Manual systemd service installation, if not using the installer:
```bash
sudo cp deploy/systemd/incus-backup-agent.service /etc/systemd/system/