Skip to content

Backup *Arr stack databases to Google Drive.

License

Notifications You must be signed in to change notification settings

EthanC/Arrchive

Repository files navigation

Arrchive

GitHub Workflow Status Docker Pulls Docker Image Size (tag)

Arrchive mirrors Radarr, Sonarr, Prowlarr, and Bazarr database backups to Google Drive.

Setup

Although not required, a Discord Webhook is recommended for notifications.

Arrchive is intended to be run at an interval using a task scheduler, such as cron.

Environment Variables:

  • LOG_LEVEL: Loguru severity level to write to the console.
  • LOG_DISCORD_WEBHOOK_URL: Discord Webhook URL to receive log events.
  • LOG_DISCORD_WEBHOOK_LEVEL: Minimum Loguru severity level to forward to Discord.
  • DISCORD_WEBHOOK_URL: Discord Webhook URL to receive backup action notifications.
  • BAZARR_BACKUP_PATH: Path to a directory containing database backup .zip files for Bazarr.
  • PROWLARR_BACKUP_PATH: Path to a directory containing database backup .zip files for Prowlarr.
  • RADARR_BACKUP_PATH: Path to a directory containing database backup .zip files for Radarr.
  • SONARR_BACKUP_PATH: Path to a directory containing database backup .zip files for Sonarr.
  • GOOGLE_SERVICE_EMAIL: Email Address for a Google Service Account.
  • GOOGLE_SERVICE_CLIENT_ID: Client ID for a Google Service Account.
  • GOOGLE_SERVICE_PRIVATE_KEY_ID: Private Key ID for a Google Service Account.
  • GOOGLE_SERVICE_PRIVATE_KEY: Private Key for a Google Service Account.
  • GOOGLE_DRIVE_FOLDER_ID: Identifier for a Google Drive folder derrived from its URL.
  • BACKUP_RETAIN_LIMIT: Number of backup files to retain on a per-application basis.

Google Drive (Required)

  1. Create a new Project in the Google Cloud console.
    • (Recommended) Project Name: Arrchive
    • After creation, select the Project.
  2. Enable the Google Drive API for the Arrchive project.
  3. Create a new Service Account for the Arrchive project.
    • (Recommended) Servive Account Name: Arrchive
    • (Recommended) Service Account Description: https://github.com/EthanC/Arrchive
    • Create and Continue
  4. Grant the Arrchive Service Account access to the Arrchive project.
    • (Recommended) Service Account Role: Owner
    • Continue -> Done
  5. Obtain a Private Key for the Service Account.
    • Actions -> Manage Keys -> Add Key -> Create a new Key -> JSON -> Private Key saved to your Computer
  6. Set the corresponding environment variables using the values in the JSON file.
  7. Open Google Drive and create a folder for *Arr application backups to be stored.
    • (Recommended) Folder Name: Arrchive
  8. Share the backup folder to the Service Account email address with Editor permissions.
  9. Open the Arrchive folder and copy its ID from the page URL.
    • Example: https://drive.google.com/drive/folders/ARRCHIVE_FOLDER_ID
    • Set the GOOGLE_DRIVE_FOLDER_ID environment variable to this value.

Docker (Recommended)

Modify the following compose.yaml example file, then run docker compose up.

services:
  arrchive:
    container_name: arrchive
    image: ethanchrisp/arrchive:latest
    environment:
      LOG_LEVEL: INFO
      LOG_DISCORD_WEBHOOK_URL: https://discord.com/api/webhooks/YYYYYYYY/YYYYYYYY
      LOG_DISCORD_WEBHOOK_LEVEL: WARNING
      DISCORD_WEBHOOK_URL: https://discord.com/api/webhooks/XXXXXXXX/XXXXXXXX
      BAZARR_BACKUP_PATH: /container/path/to/bazarr/backups
      PROWLARR_BACKUP_PATH: /container/path/to/prowlarr/backups
      RADARR_BACKUP_PATH: /container/path/to/radarr/backups
      SONARR_BACKUP_PATH: /container/path/to/sonarr/backups
      GOOGLE_SERVICE_EMAIL: [email protected]
      GOOGLE_SERVICE_CLIENT_ID: 000000000000000000000
      GOOGLE_SERVICE_PRIVATE_KEY_ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      GOOGLE_SERVICE_PRIVATE_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      GOOGLE_DRIVE_FOLDER_ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      BACKUP_RETAIN_LIMIT: 3
    volumes:
      - /local/path/to/bazarr/backups:/container/path/to/bazarr/backups:ro
      - /local/path/to/prowlarr/backups:/container/path/to/prowlarr/backups:ro
      - /local/path/to/radarr/backups:/container/path/to/radarr/backups:ro
      - /local/path/to/sonarr/backups:/container/path/to/sonarr/backups:ro

Standalone

Arrchive is built for Python 3.13 or greater, compatability with prior versions is not guaranteed.

  1. Install required dependencies using uv: uv sync
  2. Rename .env.example to .env, then provide the environment variables.
  3. Start Arrchive: uv run arrchive.py

Thanks