Overview
To add a server, a team installs the NetPoa backup agent, points it at its Storage Box sub-account, and lists its Laravel apps in one .netpoa-backup.yml file. Nothing in the app's own code changes.
- Panel —
cloud.netpoa.com, a Laravel app. It holds the servers, schedules, job history, alerts and encryption keys, and hands jobs to agents. - Agent —
netpoa-backup, one per server, running as root under systemd. It runs restic, dumps the databases, uploads snapshots straight to the Storage Box, runs restores, and reports to the panel. - Storage Box — Hetzner, 5 TB. One sub-account per server; each server can only reach its own folder.
- Engine — restic: incremental, deduplicated, AES-256 encrypted snapshots over SFTP on port 23.
Three rules shape the design:
- The agent calls the panel, never the reverse. No inbound ports open on any app server.
- Backups do not depend on the panel. The agent keeps the schedule locally and keeps backing up if
cloud.netpoa.comis down. It reports once the panel is back. - Backup data never passes through the panel. It goes from the server to the Storage Box. The panel only reads snapshots (through a read-only sub-account) for browsing and downloads.
This is draft v1. The panel and agent are not built yet. This document is the contract both are built to, and the steps teams follow to add their servers.
Before you start
A server can be added when every line below holds.
| Requirement | Detail |
|---|---|
| OS | Ubuntu 22.04 or 24.04, x86_64 |
| Access | root or passwordless sudo on the server |
| Outbound HTTPS | to cloud.netpoa.com:443 |
| Outbound SSH | to <sub-account>.your-storagebox.de:23 |
| Database tools | mysqldump / mysql for MySQL or MariaDB; pg_dump / psql for PostgreSQL |
| Free disk | 2 GB, or 10% of the biggest database, for temporary dumps and safety copies |
| Storage Box sub-account | created in Hetzner Console with SSH on, Samba and WebDAV off, external reachability on |
| Panel entry | the sub-account username saved in the admin UI (step 2 below) |
Inbound ports do not change. The agent opens no listening port.
Adding a server
Seven steps, about 20 minutes per server. Steps 1–2 are done by a NetPoa admin; steps 3–7 by whoever runs the server.
Create the sub-account (Hetzner Console → Storage Box → Sub-accounts → Create).
- Base directory:
/<server-slug>, for example/changisha. - SSH on, Samba off, WebDAV off, external reachability on, read-only off.
- Keep the generated password in the password manager. It is typed once, in step 4, and never sent to the panel.
- Base directory:
Register the server in the admin UI (
cloud.netpoa.com→ Servers → Add server).- Enter the name, a slug, the sub-account username (
u123456-sub1) and its base directory. - The panel creates the restic repository password. Download the recovery sheet it offers and store it offline.
- Copy the one-time enrollment token. It is valid for 24 hours and works once.
- Enter the name, a slug, the sub-account username (
Install the agent on the server. Compare the checksum with the one the panel shows before running it.
curl -fsSLo /tmp/netpoa-install.sh https://cloud.netpoa.com/agent/install.sh sha256sum /tmp/netpoa-install.sh sudo bash /tmp/netpoa-install.sh --token <ENROLLMENT_TOKEN>The installer adds a pinned restic version and the agent, creates
/etc/netpoa-backup/(root only), generates the Storage Box SSH key, and enrolls with the panel.Give the agent access to the Storage Box. This asks for the sub-account password once.
sudo netpoa-backup storagebox install-key sudo netpoa-backup storagebox testDescribe each app with a
.netpoa-backup.ymlin its root (next section), then register it:sudo netpoa-backup app add /var/www/changishaRun the first full backup. It creates the repository on the first run.
sudo netpoa-backup run --policy weeklyProve a restore from the panel: one file to another folder, and the database into a new database. The server is live only once both pass.
Agent commands
| Command | Does |
|---|---|
netpoa-backup status |
Agent, panel and Storage Box connection, last and next run per policy |
netpoa-backup app add <path> |
Validates the manifest, reads the database settings, reports the app to the panel |
netpoa-backup app list |
Apps on this server and what each backs up |
netpoa-backup run --policy hourly|daily|weekly |
Runs a backup now, outside the schedule |
netpoa-backup snapshots [--app <slug>] |
Lists restore points |
netpoa-backup restore ... |
Command-line restore, same options as the panel |
netpoa-backup logs [-f] |
Agent log |
Laravel apps: the manifest
Each app describes what to back up in .netpoa-backup.yml at its root, committed to the app's repository. The agent reads it on app add and whenever it changes.
version: 1
app: changisha # slug, unique on this server
type: laravel # laravel | generic
user: www-data # owner of restored files; runs the artisan hooks
databases:
- from_env: .env # DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD
# - name: changisha_reports
# connection: mysql # extra database on the same credentials
files:
include:
- . # the app folder, including .env and storage/app
exclude:
- vendor/
- node_modules/
- .git/
- bootstrap/cache/
- storage/logs/
- storage/framework/cache/
- storage/framework/sessions/
- storage/framework/views/
config: # backed up by the weekly full only
- /etc/nginx/sites-available/changisha
- /etc/cron.d/changisha
- /etc/php/8.3/fpm/pool.d/changisha.conf
- /etc/supervisor/conf.d/changisha-worker.conf
hooks:
before_restore:
- php artisan down --retry=60
after_restore:
- php artisan optimize
- php artisan queue:restart
- php artisan up
Defaults for type: laravel
- The excludes above apply even if the manifest leaves them out.
vendor/andnode_modules/are rebuilt withcomposer installandnpm ciafter a full restore. .envis backed up. The repository is encrypted, and a full restore is useless without it.hooksdefault to the ones shown.php artisan migrate --forceis not run by default; add it only if a restored database should be brought up to the current code's schema.
Database access
- The agent uses the app's own credentials from
.env. They already have full rights on the app's database, so no extra MySQL user is needed. - MySQL and MariaDB dumps run with
--single-transaction --quick --routines --triggers --no-tablespaces: no table locks, the site stays up. - PostgreSQL dumps use
pg_dump --format=custom, so single tables can be restored. - Each database is streamed straight into the snapshot. No dump file is left on the server's disk.
Apps that are not Laravel
Use type: generic and list each database with name, connection, host, port, username, and password_file (a root-only file holding the password). Hooks default to none.
Agent API v1
Base URL https://cloud.netpoa.com/api/agent/v1. JSON in and out, UTF-8, times in ISO 8601 UTC. The agent is the only client; teams never call this API by hand.
Authentication
- Enrollment uses the one-time token from the admin UI, sent once to
POST /enroll. - Every other call sends
Authorization: Bearer <agent_token>andX-Agent-Id: <agent_id>. The token is 64 random bytes, stored hashed in the panel and root-only on the server (/etc/netpoa-backup/agent.json). - Rotation: the panel can return
rotate_token: trueon a heartbeat; the agent then callsPOST /token/rotateand swaps the token. - Revocation: removing the server in the admin UI makes every call return
401. The agent stops and logs it.
Endpoints
| Method & path | Called | Purpose |
|---|---|---|
POST /enroll |
once, by the installer | Trade the enrollment token for an agent id, agent token, Storage Box target and repository password |
POST /heartbeat |
every 60 s | Report health; learn if jobs or new config are waiting |
GET /config |
when config_version changes |
Fetch schedules, retention and apps |
POST /apps |
on app add and manifest change |
Report an app and its parsed manifest |
POST /jobs/claim |
when the heartbeat says jobs wait | Take the next job (manual backup, restore, verify, prune) |
POST /jobs/{id}/progress |
every 5 s while a job runs | Percent, bytes, current item |
POST /jobs/{id}/log |
batched, every 5 s | Log lines shown live in the panel |
POST /jobs/{id}/complete |
once per job | Final status and stats |
POST /runs |
after each scheduled run | Report a backup the agent started on its own schedule |
POST /snapshots/sync |
after every backup and prune | Current list of snapshots in the repository |
POST /token/rotate |
when asked | New agent token |
POST /enroll
{
"enrollment_token": "enr_7Kq...",
"hostname": "changisha-vps",
"os": "Ubuntu 24.04.1 LTS",
"agent_version": "1.0.0",
"restic_version": "0.17.3",
"storagebox_public_key": "ssh-ed25519 AAAA... netpoa-backup@changisha-vps"
}
Response 201:
{
"agent_id": "srv_01JD8X...",
"agent_token": "agt_...",
"storage": {
"host": "u123456-sub1.your-storagebox.de",
"port": 23,
"user": "u123456-sub1",
"repository": "sftp:u123456-sub1@u123456-sub1.your-storagebox.de:/restic"
},
"repository_password": "...",
"config_version": 1
}
POST /heartbeat
{
"agent_version": "1.0.0",
"uptime_s": 86400,
"disk_free_bytes": 18253611008,
"storagebox_reachable": true,
"running_job_id": null,
"last_runs": { "hourly": "2026-11-27T07:00:41Z", "daily": "2026-11-26T23:06:12Z", "weekly": "2026-11-22T00:14:03Z" }
}
Response 200: { "jobs_waiting": 1, "config_version": 3, "rotate_token": false }.
GET /config
{
"config_version": 3,
"timezone": "Africa/Dar_es_Salaam",
"policies": {
"hourly": { "enabled": true, "cron": "0 * * * *", "scope": ["databases"], "keep": 24 },
"daily": { "enabled": true, "cron": "0 2 * * *", "scope": ["databases", "files"], "keep": 14 },
"weekly": { "enabled": true, "cron": "0 3 * * 0", "scope": ["databases", "files", "config"], "keep": 8 }
},
"bandwidth_limit_kbps": null,
"verify": { "cron": "0 4 * * 0", "read_data_subset": "5%" }
}
The agent writes these schedules into systemd timers, so backups keep running while the panel is unreachable.
POST /jobs/claim
Response 200 with one job, or 204 when nothing waits.
{
"id": "job_01JD9...",
"type": "restore",
"requested_by": "jacob",
"params": {
"app": "my-netpoa",
"snapshot": "4bf1c2e9",
"items": [
{ "kind": "file", "path": "/var/www/my.netpoa.com/storage/app/invoices/INV-2026-0418.pdf" },
{ "kind": "dir", "path": "/var/www/my.netpoa.com/storage/app/invoices/receipts" }
],
"target": { "mode": "original", "overwrite": true, "safety_copy": true }
}
}
Job types
type |
params |
Notes |
|---|---|---|
backup |
app?, policy |
Manual run; same as a scheduled one |
restore |
app, snapshot, items[], target |
Files and folders |
restore_db |
app, snapshot, database, tables?[], target |
target.mode: original or new_database (+ name) |
restore_full |
app, snapshot, confirm_code |
Files, all databases and config; runs the app's hooks |
verify |
read_data_subset |
restic check; result shown as the weekly test |
prune |
— | Applies retention now |
target.mode for files is original, alternate (+ path) or download. Downloads are served by the panel straight from the Storage Box, so the agent never sees them.
POST /jobs/{id}/complete and POST /runs
{
"status": "success",
"started_at": "2026-11-27T07:00:02Z",
"finished_at": "2026-11-27T07:00:41Z",
"snapshot": "9a7c0d11",
"stats": { "files_new": 12, "files_changed": 40, "bytes_added": 41943040, "bytes_total": 3543348019 },
"warnings": [],
"error": null
}
status is success, warning or failed. POST /runs takes the same body plus policy.
Errors
Errors return { "error": { "code": "job_not_found", "message": "..." } }.
| HTTP | When | Agent does |
|---|---|---|
400 |
Body fails validation | Logs it, does not retry |
401 |
Token wrong, rotated or revoked | Stops calling, logs, keeps local backups running |
404 |
Unknown job or app | Drops that job |
409 |
Job already claimed or finished | Drops that job |
429 |
More than 120 calls a minute | Waits for Retry-After |
5xx / timeout |
Panel down | Retries with backoff up to 10 min; reports are queued on disk and sent later |
Snapshots, schedules and retention
Every server has one restic repository at /restic inside its sub-account. Each run makes one snapshot per item, tagged so the panel can group them.
| Item | Snapshot path | Tags |
|---|---|---|
| App files | the app folder, e.g. /var/www/changisha |
app:changisha kind:files policy:daily |
| Database | /db/<database>.sql (MySQL) or /db/<database>.dump (PostgreSQL) |
app:changisha kind:db db:changisha policy:hourly |
| Server config | the paths under config: |
app:changisha kind:config policy:weekly |
| Policy | Runs (EAT) | Backs up | Keeps |
|---|---|---|---|
| Hourly | every hour at :00 | databases | 24 |
| Daily | 02:00 | databases + files | 14 |
| Weekly | Sunday 03:00 | databases + files + config | 8 |
- Retention runs after each backup:
restic forget --group-by host,tags --keep-last <keep>per policy, thenpruneweekly. - Schedules and retention are set per server in the admin UI and reach the agent through
GET /config. - Runs that overlap wait for the one before to finish. A run that waits more than 30 minutes is skipped and reported as a warning.
Restores
Every restore is a job started in the panel and run by the agent, except downloads, which the panel serves itself.
| Restore | What happens | Site stays up |
|---|---|---|
| File or folder → original place | Live copies are moved to .netpoa-restore/<timestamp>/ in the app folder (kept 7 days), then the snapshot copies are written with the app's owner |
Yes |
| File or folder → another folder | Written under the chosen path; nothing live is touched | Yes |
| Database → new database | <name>_restored_<HHMM> is created and filled; the app keeps using the live one |
Yes |
| Database → original | A safety dump of the live database is taken first, then the snapshot is loaded | Yes, if the hooks are off; by default the app is put in maintenance mode |
| Single tables | Only the chosen tables are dropped and loaded, after a safety dump of those tables | Yes |
| Full server | before_restore hooks, then files, every database and config, then composer install --no-dev, npm ci if a lockfile exists, then after_restore hooks |
No, maintenance mode throughout |
| Download | The panel streams a .zip (files) or .sql.gz (database) through the read-only sub-account; the link lasts 24 hours |
Yes |
- A full restore needs the admin to type the server's slug and re-enter their password in the panel (
confirm_code). - A full restore can target a fresh VPS: install the agent there with the same server's enrollment flow and pick it as the destination.
- Every restore is logged with who started it, what was restored, and where the safety copy is.
Security
- Isolation: each sub-account sees only its own base directory, so a compromised server can read or delete only its own backups.
- Encryption: restic encrypts everything with AES-256 before it leaves the server. Hetzner never sees plaintext.
- Repository passwords: one per server, made by the panel, stored encrypted in the panel database (Laravel
encryptedcast,APP_KEYkept off the database server) and root-only on the server. The recovery sheet from step 2 is the offline copy; without it, a lost panel means unreadable backups. - Panel access to backups: a fifth sub-account with base directory
/and read-only on. It browses and downloads; it cannot write or delete. - Secrets on servers:
/etc/netpoa-backup/is0700 root. The agent never logs passwords, tokens or.envcontents. - Sub-account passwords: typed once into
storagebox install-key, never stored or sent anywhere. Rotate them in Hetzner Console at any time; keys keep working. - Transport: HTTPS only to the panel; SSH with host-key pinning to the Storage Box.
- Audit: every restore, download, schedule change and server removal is logged with the admin's name and time.
Done checklist and troubleshooting
A server counts as protected when every box is ticked.
- Sub-account created and its username saved in the admin UI
- Recovery sheet stored offline
-
netpoa-backup statusshows panel and Storage Box connected - Every app on the server added with
app add - First weekly (full) backup finished
- One file restored to another folder and checked
- Database restored into a new database and checked
- Hourly backups show in the panel for 24 hours
| Symptom | Likely cause | Fix |
|---|---|---|
storagebox test fails: connection refused |
Outbound port 23 blocked, or SSH off on the sub-account | Allow outbound 23; turn SSH on in Hetzner Console |
storagebox test fails: permission denied |
Key not installed on that sub-account | Run storagebox install-key again |
app add cannot reach the database |
.env points at another host, or uses a socket the agent cannot see |
Set host and port explicitly in the manifest |
Enrollment returns 401 |
Token used, or older than 24 hours | Create a new token in the admin UI |
| Server shows Offline in the panel | No heartbeat for 5 minutes | systemctl status netpoa-backup; check outbound 443 |
| Hourly run marked Slow | Upload under 10 MB/s or run over 60 s | Check the server's bandwidth; set bandwidth_limit_kbps if it hurts the site |