docs: add mutli database backup example

This commit is contained in:
Jonas Kaninda
2024-10-09 12:45:55 +02:00
parent bbd5422089
commit ca5633882e
2 changed files with 54 additions and 4 deletions

View File

@@ -6,9 +6,8 @@ nav_order: 8
--- ---
# Encrypt backup # Encrypt backup
The image supports encrypting backups using one of two available methods: GPG with passphrase or GPG with a public key The image supports encrypting backups using one of two available methods: GPG with passphrase or GPG with a public key.
## Using GPG passphrase
The image supports encrypting backups using GPG out of the box. In case a `GPG_PASSPHRASE` or `GPG_PUBLIC_KEY` environment variable is set, the backup archive will be encrypted using the given key and saved as a sql.gpg file instead or sql.gz.gpg. The image supports encrypting backups using GPG out of the box. In case a `GPG_PASSPHRASE` or `GPG_PUBLIC_KEY` environment variable is set, the backup archive will be encrypted using the given key and saved as a sql.gpg file instead or sql.gz.gpg.
@@ -20,7 +19,7 @@ To restore an encrypted backup, you need to provide the same GPG passphrase used
{: .note } {: .note }
The backup encrypted using `GPG passphrase` method can be restored automatically, no need to decrypt it before restoration. The backup encrypted using `GPG passphrase` method can be restored automatically, no need to decrypt it before restoration.
Suppose you used a GPG public key during the backup process. In that case, you need to decrypt your backup before restoration because decryption using a `GPG private` key is not fully supported.
To decrypt manually, you need to install `gnupg` To decrypt manually, you need to install `gnupg`
@@ -34,7 +33,7 @@ Using your private key
```shell ```shell
gpg --output database_20240730_044201.sql.gz --decrypt database_20240730_044201.sql.gz.gpg gpg --output database_20240730_044201.sql.gz --decrypt database_20240730_044201.sql.gz.gpg
``` ```
### Backup ## Using GPG passphrase
```yml ```yml
services: services:
@@ -61,4 +60,32 @@ services:
- web - web
networks: networks:
web: web:
```
## Using GPG Public Key
```yml
services:
mysql-bkup:
# In production, it is advised to lock your image tag to a proper
# release version instead of using `latest`.
# Check https://github.com/jkaninda/mysql-bkup/releases
# for a list of available releases.
image: jkaninda/mysql-bkup
container_name: mysql-bkup
command: backup -d database
volumes:
- ./backup:/backup
environment:
- DB_PORT=3306
- DB_HOST=mysql
- DB_NAME=database
- DB_USERNAME=username
- DB_PASSWORD=password
## Required to encrypt backup
- GPG_PUBLIC_KEY=/config/public_key.asc
# mysql-bkup container must be connected to the same network with your database
networks:
- web
networks:
web:
``` ```

View File

@@ -37,4 +37,27 @@ databases:
user: joplin user: joplin
password: password password: password
path: /s3-path/joplin #For SSH or FTP you need to define the full path (/home/toto/backup/) path: /s3-path/joplin #For SSH or FTP you need to define the full path (/home/toto/backup/)
```
## Docker compose file
```yaml
services:
mysql-bkup:
# In production, it is advised to lock your image tag to a proper
# release version instead of using `latest`.
# Check https://github.com/jkaninda/mysql-bkup/releases
# for a list of available releases.
image: jkaninda/mysql-bkup
container_name: mysql-bkup
command: backup
volumes:
- ./backup:/backup
environment:
## Multi backup config file
- BACKUP_CONFIG_FILE=/backup/config.yaml
# mysql-bkup container must be connected to the same network with your database
networks:
- web
networks:
web:
``` ```