1
0

Improve and document backup script, add scp option (#429)

* Improve and document backup script, add scp option

* dump_db as helper function

* Add option to only dump the database
This commit is contained in:
d11n
2021-01-22 05:53:53 +01:00
committed by GitHub
parent 01899efd57
commit 8bd3b65b5a
3 changed files with 128 additions and 30 deletions

View File

@@ -471,3 +471,40 @@ If you need to run on a different port, it's best to terminate SSL using another
## Can I offload HTTPS termination?
Yes. Please [see the documentation](https://docs.btcpayserver.org/FAQ/FAQ-Deployment/#can-i-use-an-existing-nginx-server-as-a-reverse-proxy-with-ssl-termination).
## How can I back up my BTCPay Server?
We provide a backup script that dumps the database and saves the important files:
```bash
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
./backup.sh
```
This will save the backup locally as `/var/lib/docker/volumes/backup_datadir/_data/backup.tar.gz`.
These are the options to customize the backup name and location:
- `BACKUP_TIMESTAMP=true` saves the backup with datetime as part of the file name, so that backups do not get overwritten.
- `BACKUP_PROVIDER=SCP` saves the backup remotely, requires additional `SCP_TARGET` environment variable (see below).
- `BACKUP_PROVIDER=Dropbox` saves the backup to Dropbox, requires additional `DROPBOX_TOKEN` environment variable (see below).
```bash
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
# Backup with custom file name and timestamp:
BACKUP_TIMESTAMP=true ./backup.sh
# Backup via SCP:
BACKUP_PROVIDER=SCP SCP_TARGET=myhost:backups/btcpay ./backup.sh
# Backup to Dropbox:
BACKUP_PROVIDER=Dropbox DROPBOX_TOKEN=myDropboxToken ./backup.sh
```
You can also choose to only dump the database.
This option does not need to stop and restart the docker-containers:
```bash
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
./backup.sh --only-db
```