# 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://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/)
[![Known Vulnerabilities](https://snyk.io/test/github/muhlba91/homelab-node-red-backup/badge.svg)](https://snyk.io/test/github/muhlba91/homelab-node-red-backup/)
<a href="https://www.buymeacoffee.com/muhlba91" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="28" width="150"></a>
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 <TOKEN>
# creating a backup
homelab-node-red-backup backup -e http://localhost:1880 -jwt <TOKEN> -f backup.json
# restoring from the backup
homelab-node-red-backup restore -e http://localhost:1880 -jwt <TOKEN> -f backup.json
```
---
## Supporting
If you enjoy the application and want to support my efforts, please feel free to buy me a coffe. :)
<a href="https://www.buymeacoffee.com/muhlba91" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="75" width="300"></a>
Raw data
{
"_id": null,
"home_page": "https://github.com/muhlba91/onyx-client",
"name": "homelab-node-red-backup",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.12,<4.0",
"maintainer_email": "",
"keywords": "node-red,homelab",
"author": "Daniel Muehlbachler-Pietrzykowski",
"author_email": "daniel.muehlbachler@niftyside.io",
"download_url": "https://files.pythonhosted.org/packages/92/d2/aee5f881eb62a575a77a2b8c1e0c5cadd1ca496f0a726f5bee7be2932acb/homelab_node_red_backup-2.0.0.tar.gz",
"platform": null,
"description": "# Homelab: Node-RED Backup & Restore\n\n[![](https://img.shields.io/github/license/muhlba91/homelab-node-red-backup?style=for-the-badge)](LICENSE)\n[![](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)\n[![](https://img.shields.io/pypi/pyversions/homelab-node-red-backup?style=for-the-badge)](https://pypi.org/project/homelab-node-red-backup/)\n[![](https://img.shields.io/pypi/v/homelab-node-red-backup?style=for-the-badge)](https://pypi.org/project/homelab-node-red-backup/)\n[![](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)\n[![](https://img.shields.io/pypi/dm/homelab-node-red-backup?style=for-the-badge)](https://pypi.org/project/homelab-node-red-backup/)\n[![Known Vulnerabilities](https://snyk.io/test/github/muhlba91/homelab-node-red-backup/badge.svg)](https://snyk.io/test/github/muhlba91/homelab-node-red-backup/)\n<a href=\"https://www.buymeacoffee.com/muhlba91\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"28\" width=\"150\"></a>\n\nThis repository contains Python scripts leveraging the [Node-RED Admin API](https://nodered.org/docs/api/admin/methods/) endpoints to create and restore backups.\n\n**Attention:** the Node-RED installation must either be unsecured or secured by OAuth!\n\n---\n\n## Installation\n\nThe package is published in **(Test)PyPi** and can be installed via:\n\n```bash\npip install homelab-node-red-backup\n```\n\n## Configuration\n\nThe following arguments are available:\n\n- `--endpoint` / `-e`: the Node-RED endpoint\n- `--file` / `-f`: the JSON file\n- `--jwt-token` / `-jwt`: the JWT token to authenticate with\n\n## Credentials\n\nCredentials are detected, retrieved, and merged to the output JSON file.\nThe following credential types are recognized:\n\n- `servers`: e.g. a Home Assistant server with an access token\n- `telegram bot`: Telegram bot with a token\n\n## Usage\n\nThe following commands are available, and all commands require the arguments `--endpoint`, and, optionally, `--jwt-token` set.\n\n- `check`: checks if data exists for a backup (return code `0` if data exists, else `1`)\n- `backup`: creates a backup\n - requires: `--file`\n- `restore`: restores from a backup\n - requires: `--file`\n- `auto`: performs a `check` and either creates a backup to or restores a backup from the given `--file`\n - requires: `--file`\n\n### Examples\n\n```bash\n# checking if data exists\nhomelab-node-red-backup check -e http://localhost:1880 -jwt <TOKEN>\n\n# creating a backup\nhomelab-node-red-backup backup -e http://localhost:1880 -jwt <TOKEN> -f backup.json\n\n# restoring from the backup\nhomelab-node-red-backup restore -e http://localhost:1880 -jwt <TOKEN> -f backup.json\n```\n\n---\n\n## Supporting\n\nIf you enjoy the application and want to support my efforts, please feel free to buy me a coffe. :)\n\n<a href=\"https://www.buymeacoffee.com/muhlba91\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"75\" width=\"300\"></a>\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Backup and Restore for Node-RED.",
"version": "2.0.0",
"project_urls": {
"Homepage": "https://github.com/muhlba91/onyx-client",
"Repository": "https://github.com/muhlba91/onyx-client"
},
"split_keywords": [
"node-red",
"homelab"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6678407b8886187136233dae0de7139fed088b09377eace675f98d1eaa3222fb",
"md5": "5575c89471423a4722f4b1ef82a942ff",
"sha256": "bee3fb46c5905e80ff0e277a95dbc387e448a14c3d2b865b1dc4284fe17c3009"
},
"downloads": -1,
"filename": "homelab_node_red_backup-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5575c89471423a4722f4b1ef82a942ff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12,<4.0",
"size": 7545,
"upload_time": "2024-02-18T06:55:24",
"upload_time_iso_8601": "2024-02-18T06:55:24.912676Z",
"url": "https://files.pythonhosted.org/packages/66/78/407b8886187136233dae0de7139fed088b09377eace675f98d1eaa3222fb/homelab_node_red_backup-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "92d2aee5f881eb62a575a77a2b8c1e0c5cadd1ca496f0a726f5bee7be2932acb",
"md5": "f7aff31dc26781665edc7c37f69a4870",
"sha256": "ba515dc1be911437c765c0820268bf1bcc20e4f8826d0493684d236a4a83c9f3"
},
"downloads": -1,
"filename": "homelab_node_red_backup-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "f7aff31dc26781665edc7c37f69a4870",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12,<4.0",
"size": 4589,
"upload_time": "2024-02-18T06:55:26",
"upload_time_iso_8601": "2024-02-18T06:55:26.721697Z",
"url": "https://files.pythonhosted.org/packages/92/d2/aee5f881eb62a575a77a2b8c1e0c5cadd1ca496f0a726f5bee7be2932acb/homelab_node_red_backup-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-18 06:55:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "muhlba91",
"github_project": "onyx-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "homelab-node-red-backup"
}