Open-source lightweight backup tool for paperless-ngx
504
paperless-backup is a lightweight backup utility for paperless-ngx environments. It automates the creation of consistent backups from a running paperless container and transfers them to remote storage, such as an SFTP server.
The tool is designed to run in containerized setups and is configured entirely through environment variables. It supports configurable backup intervals, flexible file naming, and optional cleanup of local artifacts after successful uploads.
Retention policies can be applied to control long-term storage usage. Multiple strategies are available, ranging from simple "keep last N" behavior to more advanced models like Grandfather-Father-Son (GFS), allowing a balance between short-term recovery points and long-term history.
The focus of this project is reliability, predictable behavior, and minimal operational overhead.
| Backend | Status |
|---|---|
| SFTP | ā Supported |
| S3 / compatible | š Planned |
Backups are stored in a structured directory tree on the remote:
paperless/
āāā backups/
ā āāā YYYY/MM/DD/
ā āāā <timestamp>.tar.gz
āāā metadata/
ā āāā YYYY/MM/DD/
ā āāā <timestamp>.tar.gz.sha256
āāā latest.tar.gz
Each archive has a corresponding .sha256 sidecar written to metadata/ after a successful upload. latest.tar.gz always points to the most recent backup.
services:
paperless-backup:
image: ghcr.io/rechergg/paperless-backup:latest
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
PAPERLESS_CONTAINER: paperless-webserver
SFTP_HOST: your-storage-box.example.com
SFTP_USERNAME: your-username
SFTP_KEY: your-private-key
SFTP_PATH: paperless
BACKUP_INTERVAL_HOURS: 6
A full docker-compose.coolify.yml is available in the repository for Coolify deployments.
All configuration is done through environment variables. The config.toml in the repository documents every available option with its default value.
| Variable | Default | Description |
|---|---|---|
PAPERLESS_CONTAINER | paperless-webserver | Name of the Paperless Docker container |
SFTP_HOST | ā | SFTP hostname |
SFTP_PORT | 22 | SFTP port |
SFTP_USERNAME | ā | SFTP username |
SFTP_KEY | ā | SSH private key (preferred over password) |
SFTP_PASSWORD | ā | SSH password (fallback) |
SFTP_PATH | paperless | Remote root directory |
BACKUP_INTERVAL_HOURS | 6 | Hours between backups |
BACKUP_FILENAME_TEMPLATE | {timestamp}.tar.gz | Archive filename template |
BACKUP_DELETE_LOCAL_AFTER_UPLOAD | true | Delete local archive after upload |
BACKUP_KEEP_FAILED | true | Keep local workspace on failure for debugging |
Configure the strategy via RETENTION_STRATEGY (default: gfs).
The default strategy. Keeps backups across four tiers so you always have recent snapshots as well as long-term history.
| Variable | Default | Description |
|---|---|---|
RETENTION_HOURLY | 24 | Most recent backups to keep |
RETENTION_DAILY | 7 | One backup per day for the last N days |
RETENTION_WEEKLY | 4 | One backup per week for the last N weeks |
RETENTION_MONTHLY | 12 | One backup per month for the last N months |
A file is kept if it qualifies in any tier ā so a weekly snapshot is never deleted just because the hourly window has passed.
Keeps only the N most recent backups regardless of age.
| Variable | Default | Description |
|---|---|---|
RETENTION_KEEP_LAST | 10 | Number of backups to retain |
Deletes any backup older than a configured number of days.
| Variable | Default | Description |
|---|---|---|
RETENTION_MAX_AGE_DAYS | 30 | Maximum backup age in days |
RETENTION_MINIMUM_KEEP | 1 | Always keep at least this many recent backups |
RETENTION_MINIMUM_KEEP prevents full deletion during extended outages ā even if all backups exceed max_age_days, the most recent one is never removed.
Keeps one backup per calendar day for the last N days.
| Variable | Default | Description |
|---|---|---|
RETENTION_KEEP_DAYS | 7 | Number of days to retain |
RETENTION_MINIMUM_KEEP | 1 | Safety floor |
Disables cleanup entirely. All backups are kept indefinitely.
Set RETENTION_STRATEGY=none ā no additional variables required.
Content type
Image
Digest
sha256:06db8897aā¦
Size
69.3 MB
Last updated
5 months ago
docker pull rechergg/paperless-backup