# NetBox Restoration Guide

### Introduction

The restore process works by taking a backup generated by the [NetBox Backup](https://docs.netos.io/books/semaphore-netbox/page/netbox-backup-guide), decrypting it, and restoring it. Check the [NetBox Development Snapshots](https://docs.netos.io/books/semaphore-netbox/page/netbox-backup-guide#bkmrk-netbox-development-s) section in the backup guide for an approach on using this feature for dev/test.

<p class="callout warning">The `ENCRYPTION_KEY` value in the **NetBox Backup Settings** Semaphore environment is used in both the backup and restore process. Be sure to keep track as if you change it on the target system, all future backups will use the new key.</p>

#### Configure the Restore

The NetBox backup process will create three timestamped (`mm_dd_yyyy_HH_MM`) files like these. The `enc` files are encrypted using the `ENCRYPTION_KEY` variable.

```
netbox_db_03_18_2024_01_00.sql.gz.enc
netbox_media_03_18_2024_01_00.tar.gz.enc
netbox_status_03_18_2024_01_00.json
```

<p class="callout info">You can manually decrypt the files using the command openssl `enc -aes-256-cbc -d -in BACKUP_FILE.enc -out OUTPUT.sql.gz.tar.gz`</p>

The restore file prefix is set in the NetBox Backup Settings environment and is the timestamp used for all three files. Set this to match the timestamp of the files that you place in the `/netos/netbox/backups` directory.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/8vSSlDZFoJuvEKbR-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/8vSSlDZFoJuvEKbR-image.png)

#### Plugin Version Validation Logic

By default, when the backup runs it will check the **NetBox version** and **plugin versions** of the target system by comparing the output of the `/api/status` endpoint collected from the backup with the version of the target system.

This is an example of the relevant JSON:

```json
    "netbox-version": "3.7.8",
    "plugins": {
        "netos": "1.4.6",
        "netos_fabric": "1.3.3",
        "netos_model_builder": "1.2.37",
        "netos_reporting": "1.3.16"
    }
```

In the event of a mismatch, you will see a warning like this that details the discrepancies between the backup and target system.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/xmR4A2UOYzZ0pyhi-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/xmR4A2UOYzZ0pyhi-image.png)

To disable this check, change `BYPASS_PLUGIN_CHECK` to `Yes`. Disabling may be acceptable when restoring to a slightly different target system, for example, where the Netos Insights plugin has increased from minor version `1.2.24` to `1.2.26`.

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/xoCDes2oDTzVv8OJ-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/xoCDes2oDTzVv8OJ-image.png)

When `BYPASS_PLUGIN_CHECK` is set to `Yes` the restore process will look like this:

[![image.png](https://docs.netos.io/uploads/images/gallery/2024-09/scaled-1680-/QxHxdV47PHudNbfu-image.png)](https://docs.netos.io/uploads/images/gallery/2024-09/QxHxdV47PHudNbfu-image.png)

<p class="callout info">Any [NetBox Open Source Plugins](https://docs.netos.io/books/semaphore-netbox/page/deploy-netbox-community-plugins) or [Netos Enterprise NetBox Plugins](https://docs.netos.io/books/semaphore-netbox/page/deploy-netos-enterprise-plugins) installed using Semaphore will be named according to their version and saved in `/netos/working-dir/netbox-plugins` and `/netos/working-dir/netos-plugins`. The `/netos/working-dir` directory is [backed up each day](https://docs.netos.io/books/semaphore-netbox/page/netbox-backup-guide), assuming you enable the schedule in Semaphore.</p>