Short guide on backup / restore (#1411)

Fixes #1270
This commit is contained in:
Jamil
2023-02-08 12:42:01 -08:00
committed by GitHub
parent 62ea380b4f
commit 0303ea2811
2 changed files with 100 additions and 7 deletions

View File

@@ -0,0 +1,89 @@
---
title: Backup and Restore
sidebar_position: 4
---
Firezone can be safely backed up and restored in a couple of minutes under
most circumstances.
:::info
This guide is written for Firezone deployments using **Docker Engine** on **Linux** only.
:::
Unless your hosting provider supports taking live VM snapshots, you'll
need to stop Firezone before backing it up. This ensures the Postgres data
directory is in a consistent state when the backup is performed. Backing up a
running Firezone instance will **most likely** result in data loss when restored;
you have been warned.
After stopping Firezone, backing up Firezone is mostly a matter of copying the relevant
[files and directories](/reference/file-and-directory-locations/) to a location of your
choosing.
See the steps below for specific examples for Docker and Omnibus.
<Tabs>
<TabItem label="Docker" value="docker" default>
### Backup
For Docker-based deployments, this will consist of backing up the `$HOME/.firezone`
directory along with the Postgres data directory, typically located at
`/var/lib/docker/volumes/firezone_postgres-data` on Linux if you're using the default
Docker compose template.
1. Stop Firezone (warning: this **will** disconnect any users connected to the VPN):
```
docker compose -f $HOME/.firezone/docker-compose.yml down
```
2. Copy relevant files and folders. If your made any customizations to `/etc/docker/daemon.json`
(for example, for IPv6 support), be sure to include that in the backup as well.
```
tar -zcvfp $HOME/firezone-back-$(date +'%F-%H-%M').tgz $HOME/.firezone /var/lib/docker/volumes/firezone_postgres-data
```
A backup file named `firezone-back-TIMESTAMP.tgz` will then be stored in `$HOME/`.
### Restore
1. Copy the files back to their original location:
```
tar -zxvfp /path/to/firezone-back.tgz -C / --numeric-owner
```
2. Optionally, enable Docker to boot on startup:
```
systemctl enable docker
```
</TabItem>
<TabItem label="Omnibus" value="omnibus">
### Backup
1. Stop Firezone (warning: this **will** disconnect any users connected to the VPN):
```
firezone-ctl stop
```
2. Copy relevant files and folders:
```
tar -zcvfp $HOME/firezone-back-$(date +'%F-%H-%M').tgz /var/opt/firezone /opt/firezone /usr/bin/firezone-ctl /etc/systemd/system/firezone-runsvdir-start.service /etc/firezone
```
A backup file named `firezone-back-TIMESTAMP.tgz` will then be stored in `$HOME/`.
### Restore
1. Copy the files back to their original location:
```
tar -zxvfp /path/to/firezone-back.tgz -C / --numeric-owner
```
2. Reconfigure Firezone to ensure configuration is applied to the host system:
```
firezone-ctl reconfigure
```
</TabItem>
</Tabs>
import SupportOptions from '@site/src/partials/_support_options.mdx';
<SupportOptions />

View File

@@ -10,13 +10,13 @@ your installation.
<Tabs>
<TabItem label="Docker" value="docker" default>
| Default path | Description |
| --- | --- |
| `$HOME/.firezone/.env` | Firezone secrets used for encryption, cookies, and sessions. **Losing this file will result in irrecoverable data loss**. |
| `$HOME/.firezone/docker-compose.yml` | Docker Compose file used to manage Firezone services. |
| `$HOME/.firezone/firezone` | Top-level directory containing Firezone-related persisted data |
| `$HOME/.firezone/caddy` | Caddy persisted files. |
| Default Docker volume location, typically `/var/lib/docker/volumes/firezone_postgres-data`. | Postgres DB files. |
| Default path | Description |
| --- | --- |
| `$HOME/.firezone/.env` | Firezone secrets used for encryption, cookies, and sessions. **Losing this file will result in irrecoverable data loss**. |
| `$HOME/.firezone/docker-compose.yml` | Docker Compose file used to manage Firezone services. |
| `$HOME/.firezone/firezone` | Top-level directory containing Firezone-related persisted data |
| `$HOME/.firezone/caddy` | Caddy persisted files. |
| Default Docker named volume location, typically `/var/lib/docker/volumes/firezone_postgres-data` for Linux. | Postgres DB files. |
</TabItem>
<TabItem label="Omnibus" value="omnibus">
@@ -31,3 +31,7 @@ your installation.
</TabItem>
</Tabs>
## Backup and restore
See our [backup guide](/administer/backup).