<- Back to Home

๐Ÿ“ฆ Paperless Backup

An automated Docker-based backup system for Paperless-ngx with email notifications and retention policies.

Features

  • ๐Ÿ”„ Automated Backups - Time-scheduled backups with cron integration
  • ๐Ÿ“ง Email Notifications - Success and failure alerts via SMTP
  • ๐Ÿงน Retention Policy - Automatic cleanup of old backups

Available on

๐Ÿš€ Quick Start

minimal Docker Run

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 \
  ghcr.io/rossberi/paperless-backup:latest

Docker Compose (with SMTP)

services:
  paperless-backup:
    image: ghcr.io/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: your-email@example.com
      # SMTP_PASSWORD: your-app-password
      # SMTP_SENDER: your-email@example.com
      # SMTP_RECIPIENT: recipient@example.com
      # 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

โš™๏ธ Configuration

Required Environment Variables

VariableDefaultDescription
PAPERLESS_CONTAINER_NAMEpaperlessName of the Paperless Docker container
PAPERLESS_EXPORT_DIR../exportExport directory inside Paperless container
BACKUP_DIR/backupTarget directory for backups
BACKUP_PREFIXbackupPrefix of the backup files
EXPORT_DIR/exportLocal export directory
KEEP_BACKUPS7Number of backup versions to keep
BACKUP_ON_STARTUPFalseRun a backup on startup

Optional: SMTP Configuration

To enable email notifications, set the following variables:

VariableDescription
SMTP_SERVERSMTP server address
SMTP_PORTSMTP port (default: 587)
SMTP_USERNAMEUsername for SMTP authentication
SMTP_PASSWORDPassword for SMTP authentication
SMTP_SENDERSender email address
SMTP_RECIPIENTRecipient email address
SMTP_SUBJECT_SUCCESSSubject line for successful backup
SMTP_SUBJECT_FAILURESubject line for failed backup
SMTP_SECURITYSecurity type: starttls (default), ssl, or plain

Cron Syntax

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 AM
  • 0 3 * * 0 - Every Sunday at 03:00 AM
  • 30 1 * * * - Daily at 01:30 AM
  • 0 */4 * * * - Every 4 hours

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ“ž Support

๐Ÿ“š Resources


Note: Make sure to regularly test your backups and keep them in a safe location! ๐Ÿ”’