Appearance
Tenant Backups
EaseLab provides tenant-scoped database backups so laboratories can protect their data, meet retention policies, and recover from operational mistakes. Platform-wide backups are managed separately in Platform Backups.
Screen: /admin/backups
Permission: backups.view (manual trigger requires backups.create)
Backup architecture
mermaid
flowchart TB
subgraph Tenant Portal
UI[Admin Backups UI]
end
subgraph API
TB[TenantBackupsController]
BS[BackupService]
end
subgraph Storage
LOC[Local storage]
S3[S3-compatible storage]
end
UI --> TB --> BS
BS --> LOC
BS --> S3
BS --> PG[(PostgreSQL pg_dump)]Each backup run captures:
| Component | Content |
|---|---|
| Tenant database | Full PostgreSQL dump of lab data |
| Uploads archive | Tenant-scoped files (logos, attachments) |
| Manifest | Metadata, retention flags, plan context |
Backup types
| Type | Trigger | Initiator |
|---|---|---|
| Manual | On-demand | Lab admin via UI |
| Scheduled | Cron / background service | Platform configuration |
Scheduled backups respect platform BackupSettings — enabled flag, interval, retention days, and storage provider.
Running a manual backup
- Open Admin → Backups.
- Review last successful run and storage location.
- Click Run Backup (
backups.create). - Monitor status: Pending → Running → Completed.
- Download manifest or verify size when completed.
Before major changes
Always run a manual backup before bulk catalog imports, fiscal year rollover, or restore drills.
Backup run statuses
| Status | Meaning |
|---|---|
| Pending | Queued |
| Running | Dump in progress |
| Completed | Safe to restore |
| Failed | See error message; retry after fixing cause |
| Restoring | Restore operation active — avoid concurrent writes |
Interrupted runs may be recovered automatically on next service start.
Storage providers
Platform configuration selects storage:
| Provider | Use case |
|---|---|
| Local | Development, single-server deployments |
| S3 | Production — durable off-site copies |
S3 settings include bucket, region, prefix, and optional custom endpoint for MinIO-compatible stores.
Listing and retention
The backups list shows:
- Run ID and timestamp
- Type (manual / scheduled)
- Size and duration
- Storage path
- Retention eligibility
Retention policy may mark old tenant copies as non-restorable (Retained = false in manifest). Plan slugs can influence retention tiers.
Retention is not unlimited
Confirm your plan's retention window. Expired backups are removed from restorable manifests.
Restore operations
Tenant admins can restore their own data from eligible backups:
mermaid
flowchart TD
A[Select backup run] --> B{Confirm destructive action}
B --> C[Stop writes / notify staff]
C --> D[Restore tenant DB]
D --> E[Restore uploads archive]
E --> F[Verify sample invoices]| Scope | Description |
|---|---|
| Single tenant | Restores one laboratory database and uploads |
| Full platform | Platform admin only — all tenants |
Restore requires explicit confirmation. All current data since the backup point will be lost.
Post-restore verification
| Check | Pass criteria |
|---|---|
| Login | Staff accounts authenticate |
| Latest invoice | Expected data present or correctly rolled back |
| Catalog | Test count matches expectation |
| Uploads | Logo and report assets load |
| Analyzer keys | Devices still registered |
Permissions
| Action | Permission |
|---|---|
| View backup list | backups.view |
| Trigger manual backup | backups.create |
| Restore | Typically admin + platform policy |
| Delete backup artifact | Platform admin |
Tenant UI does not grant edit/delete on backup rows — immutability protects audit trail.
PostgreSQL tooling
Backups use pg_dump / pg_restore with configurable binary paths:
PgDumpPath/PgRestorePathPgBinDirectoryfor non-standard installs
Contact EaseLab support if restore fails or backups do not appear in the list.
Security
| Control | Detail |
|---|---|
| Tenant isolation | Backups contain only requesting tenant data |
| Encrypted transit | S3 HTTPS |
| Access control | backups.view minimum |
| Locked tenants | Backup may still run; verify billing status |
Troubleshooting
| Issue | Resolution |
|---|---|
| Backup stuck Running | Check API logs; recovery service resets interrupted runs |
| Failed — disk full | Free space or switch to S3 |
| Failed — pg_dump missing | Install PostgreSQL client tools |
| Restore 403 | Insufficient permission or backup expired |
| Slow backup | Large database — schedule off-peak |