Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/muhlba91/homelab-node-red-backup

Homelab: Python application for backing up and restoring Node-RED via its API
https://github.com/muhlba91/homelab-node-red-backup

homelab node-red

Last synced: about 1 month ago
JSON representation

Homelab: Python application for backing up and restoring Node-RED via its API

Awesome Lists containing this project

README

        

# Homelab: Node-RED Backup & Restore

[![](https://img.shields.io/github/license/muhlba91/homelab-node-red-backup?style=for-the-badge)](LICENSE)
[![](https://img.shields.io/github/actions/workflow/status/muhlba91/homelab-node-red-backup/verify.yml?style=for-the-badge)](https://github.com/muhlba91/homelab-node-red-backup/actions/workflows/verify.yml)
[![](https://api.scorecard.dev/projects/github.com/muhlba91/homelab-node-red-backup/badge?style=for-the-badge)](https://scorecard.dev/viewer/?uri=github.com/muhlba91/homelab-node-red-backup)
[![](https://img.shields.io/pypi/pyversions/homelab-node-red-backup?style=for-the-badge)](https://pypi.org/project/homelab-node-red-backup/)
[![](https://img.shields.io/pypi/v/homelab-node-red-backup?style=for-the-badge)](https://pypi.org/project/homelab-node-red-backup/)
[![](https://img.shields.io/github/release-date/muhlba91/homelab-node-red-backup?style=for-the-badge)](https://github.com/muhlba91/homelab-node-red-backup/releases)
[![](https://img.shields.io/pypi/dm/homelab-node-red-backup?style=for-the-badge)](https://pypi.org/project/homelab-node-red-backup/)
Buy Me A Coffee

This repository contains Python scripts leveraging the [Node-RED Admin API](https://nodered.org/docs/api/admin/methods/) endpoints to create and restore backups.

**Attention:** the Node-RED installation must either be unsecured or secured by OAuth!

---

## Installation

The package is published in **(Test)PyPi** and can be installed via:

```bash
pip install homelab-node-red-backup
```

## Configuration

The following arguments are available:

- `--endpoint` / `-e`: the Node-RED endpoint
- `--file` / `-f`: the JSON file
- `--jwt-token` / `-jwt`: the JWT token to authenticate with

## Credentials

Credentials are detected, retrieved, and merged to the output JSON file.
The following credential types are recognized:

- `servers`: e.g. a Home Assistant server with an access token
- `telegram bot`: Telegram bot with a token

## Usage

The following commands are available, and all commands require the arguments `--endpoint`, and, optionally, `--jwt-token` set.

- `check`: checks if data exists for a backup (return code `0` if data exists, else `1`)
- `backup`: creates a backup
- requires: `--file`
- `restore`: restores from a backup
- requires: `--file`
- `auto`: performs a `check` and either creates a backup to or restores a backup from the given `--file`
- requires: `--file`

### Examples

```bash
# checking if data exists
homelab-node-red-backup check -e http://localhost:1880 -jwt

# creating a backup
homelab-node-red-backup backup -e http://localhost:1880 -jwt -f backup.json

# restoring from the backup
homelab-node-red-backup restore -e http://localhost:1880 -jwt -f backup.json
```

---

## Supporting

If you enjoy the application and want to support my efforts, please feel free to buy me a coffe. :)

Buy Me A Coffee