An automated Docker-based backup system for Paperless-NGX
537
An automated Docker-based backup system for Paperless-ngxโ with email notifications and retention policies.
docker run -d \
--name paperless-backup \
-e PAPERLESS_CONTAINER_NAME=paperless \
-e PAPERLESS_EXPORT_DIR=../export \
-v /path/to/paperless/export:/export \
-v /path/to/backups:/backups \
-v /var/run/docker.sock:/var/run/docker.sock \
rossberi/paperless-backup:latest
services:
paperless-backup:
image: rossberi/paperless-backup:latest
container_name: paperless-backup
environment:
PAPERLESS_CONTAINER_NAME: paperless
PAPERLESS_EXPORT_DIR: '../export'
BACKUP_DIR: '/backups'
EXPORT_DIR: '/export'
BACKUP_PREFIX: 'backup'
BACKUP_SCHEDULE: "0 2 * * *" # Optional: Daily at 02:00
KEEP_BACKUPS: 7
BACKUP_ON_STARTUP: False
# Optional: SMTP Configuration
# SMTP_SERVER: smtp.example.com
# SMTP_PORT: 587
# SMTP_USERNAME: [email protected]
# SMTP_PASSWORD: your-app-password
# SMTP_SENDER: [email protected]
# SMTP_RECIPIENT: [email protected]
# SMTP_SUBJECT_SUCCESS: "โ
Paperless Backup successful"
# SMTP_SUBJECT_FAILURE: "โ Paperless Backup failed"
# SMTP_SECURITY: starttls
volumes:
- /path/to/paperless/export:/export
- /path/to/backups:/backups
- /var/run/docker.sock:/var/run/docker.sock
| Variable | Default | Description |
|---|---|---|
PAPERLESS_CONTAINER_NAME | paperless | Name of the Paperless Docker container |
PAPERLESS_EXPORT_DIR | ../export | Export directory inside Paperless container |
BACKUP_DIR | /backup | Target directory for backups |
BACKUP_PREFIX | backup | Prefix of the backup files |
EXPORT_DIR | /export | Local export directory |
KEEP_BACKUPS | 7 | Number of backup versions to keep |
BACKUP_ON_STARTUP | False | Run a backup on startup |
To enable email notifications, set the following variables:
| Variable | Description |
|---|---|
SMTP_SERVER | SMTP server address |
SMTP_PORT | SMTP port (default: 587) |
SMTP_USERNAME | Username for SMTP authentication |
SMTP_PASSWORD | Password for SMTP authentication |
SMTP_SENDER | Sender email address |
SMTP_RECIPIENT | Recipient email address |
SMTP_SUBJECT_SUCCESS | Subject line for successful backup |
SMTP_SUBJECT_FAILURE | Subject line for failed backup |
SMTP_SECURITY | Security type: starttls (default), ssl, or plain |
The BACKUP_SCHEDULE variable uses standard cron syntax:
โโโโโโโโโโโโโโ Minute (0 - 59)
โ โโโโโโโโโโโโโโ Hour (0 - 23)
โ โ โโโโโโโโโโโโโโ Day of Month (1 - 31)
โ โ โ โโโโโโโโโโโโโโ Month (1 - 12)
โ โ โ โ โโโโโโโโโโโโโโ Day of Week (0 - 6) (Sunday = 0)
โ โ โ โ โ
โ โ โ โ โ
* * * * *
Examples:
0 2 * * * - Daily at 02:00 AM0 3 * * 0 - Every Sunday at 03:00 AM30 1 * * * - Daily at 01:30 AM0 */4 * * * - Every 4 hoursThis project is licensed under the MIT Licenseโ .
Note: Make sure to regularly test your backups and keep them in a safe location! ๐
Content type
Image
Digest
sha256:1ef6c18c1โฆ
Size
21.4 MB
Last updated
10 months ago
docker pull rossberi/paperless-backup