Sign inSign up

rossberi/paperless-backup

By rossberi

โ€ขUpdated 10 months ago

An automated Docker-based backup system for Paperless-NGX

Image
Security
Databases & storage
0

537

rossberi/paperless-backup repository overview

โ ๐Ÿ“ฆ Paperless Backup

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

Docker Python GitHub Actions

โ โœจ 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 GitHub

โ ๐Ÿš€ 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 \
  rossberi/paperless-backup:latest
โ Docker Compose (with SMTP)
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

โ ๐Ÿ“‹ 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! ๐Ÿ”’

Tag summary

Content type

Image

Digest

sha256:1ef6c18c1โ€ฆ

Size

21.4 MB

Last updated

10 months ago

docker pull rossberi/paperless-backup