Skip to content

apkatsikas/navarchiver

Repository files navigation

Navarchiver archives your Navidrome audio library and metadata using GCS (Google Cloud Storage).

It runs in 3 modes:

Tested on versions:

Scheduled

Scheduled mode is designed to be used for archiving the library "moving forward" on a nightly basis. For backfilling, use batch mode.

Scheduled mode takes 2 positional arguments for:

  • Location of the Navidrome SQLite DB file
  • Location for the Navarchiver SQLite DB file

Environment variables

  • GCS_PROJECT_ID - Project ID for GCS uploading
  • GCS_BUCKET_NAME - Bucket name for GCS uploading
  • GCS_TIMEOUT_SECONDS - maximum time to allow for a GCS upload before timing out
  • GCS_CREDS_FILE - path to GCS JSON credentials file

For alerting, discord-alert is used. Please see the documentation for this tool and for more info on creating a bot.

  • BOT_TOKEN - Discord bot token for alerting on failure of the nightly backup
  • CHANNEL_ID - Discord channel ID for alerting

Running scheduled mode

One nice way to run scheduled mode is a Linux cron job.

An example cron command might look like:

cd /var/lib/navidrome && /opt/navarchiver/navarchiver navidrome.db archive_run.db >> /var/lib/navidrome/archiver.log 2>&1

Batch

Batch mode takes a JSON file produced by the ledger mode. You might choose to split the resultant ledger into smaller JSON files and run multiple batches. This mode is suitable for backfilling an archive for an existing library. It only backfills the audio library, not the SQLite metadata.

You will need to set:

  • GCS_PROJECT_ID
  • GCS_BUCKET_NAME
  • GCS_TIMEOUT_SECONDS
  • GCS_CREDS_FILE

from the environment variables section.

This mode is invoked using the -runMode=batch flag, and takes a single positional argument for the ledger path.

Ledger

The ledger mode produces a JSON file suitable for backfilling a batch in batch mode of the user's Navidrome library.

This mode is invoked using the -runMode=ledger flag, and takes 2 positional arguments for:

  • Location of the Navidrome SQLite DB file
  • Destination for the ledger JSON file

Flags

-runMode
Determines which mode the archiver runs in.
Valid values: scheduled, batch, ledger
Default: scheduled


-fileSizeLimit
Maximum allowed size for any single file.
If a file exceeds this limit, the archiver will error.
Format: human-readable size (e.g., 10MB, 1GB, 500KB, 1024B)
Default: 500MB


-fileCountLimit
Maximum number of files allowed in a folder.
If exceeded, the archiver will error.
Format: integer value (e.g., 1, 50, 1000)
Default: 150

About

Archives your Navidrome audio library and metadata using GCS.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors