Skip to main content

A simple tool to fetch backups from the TrueNAS via the JSON-RPC protocol

Reason this release was yanked:

not installable

Project description

Usage

truenas-backup is a simple tool to fetch configuration backups from the TrueNAS installation using the JSON-RPC API.

Installation

As the API client is not published as a package, you’ll need to install the dependency manually

pip install git+https://github.com/truenas/api_client.git

Arguments

-h, --help

show the help message and exit.

-c FILE, --config FILE

the configuration file (default: ~/.config/truenas-backup/config.yml)

-o FILE, --output FILE

the output file. The file name can contain strftime directives. If the argument is specified, directory, name and keep fields of the configuration are ignored.

Configuration file

The truenas-backup needs a configuration file (default ~/.config/truenas-backup/config.yml). As the file contains secrets, take care to set reasonable permissions. The file is in the YAML format.

Configuration file

truenas:
   host: truenas.local[:port]
   api_user: truenas_admin
   api_key: ...
   ssl_verify: false
   call_timeout: 20
   backup_password: ...
output:
   directory: .
   name: "truenas-%Y%m%d-%H%M.backup"
   keep: 12

All fields except api_user and api_key are optional. The user the API key was generated for needs to have the FULL_ADMIN role (TrueNAS requirement).

host is a hostname or an IP address, and an optional port. Secure connection will be used.

The backup file is compressed using gzip first, then encrypted if backup_password is specified. It can be decrypted and unpacked manually using

openssl aes-256-cbc -d -md sha512 -pbkdf2 -iter 100000 -in ... | tar tvfz -

name specifies the name of the output file. strftime directives are allowed.

keep removes all but the most recent *.backup files from the directory, that in this case has to be specified and has to be an absolute path.

directory has to already exist. As the backup is not encrypted and contains secrets the permissions should be set accordingly.

Observability

The backups done can be exported through prometheus text-file format and consumed by the node exporter’s textfile collector. If the metrics key exists, the file is atomically populated after each backup run.

metrics:
    directory: "/var/local/lib/prom_metrics"
    suffix: "my-truenas"

directory is mandatory and specifies the path of the directory passed as the --collector.textfile.directory for the node_exporter. It has to already exist. suffix is optional and will be appended to the file name to distinguish metrics files generated by different configurations. For the above configuration the full file name will be /var/local/lib/prom_metrics/truenas-backup-my-truenas.prom.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

truenas_backup_tool-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

truenas_backup_tool-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file truenas_backup_tool-0.1.0.tar.gz.

File metadata

  • Download URL: truenas_backup_tool-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for truenas_backup_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7cffe8be3bc182c631df9fc3c99e9cff2134178fe83b03e721cd0c915ca82c32
MD5 f9200df629ae8dad864a00d96b599ec0
BLAKE2b-256 d86024d1aaaf82911d38502a00ab1f781a6a2c07c97f3bf10607dbebef1332ea

See more details on using hashes here.

File details

Details for the file truenas_backup_tool-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for truenas_backup_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f92c6e6a66456a0e11b48530e7dd467bf828fd0798d3fed75db51e8dfadcb7ae
MD5 f27d966d078989324613481d27139a6b
BLAKE2b-256 7a0740c56ed2ea82184f6aa62d94ccd44f6f5182b512160bb67dfbe6db409e95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page