Skip to content

Commit

Permalink
Merge pull request #98 from jkaninda/multi-backup
Browse files Browse the repository at this point in the history
docs: add mutli database backup example
  • Loading branch information
jkaninda authored Oct 9, 2024
2 parents eebcfc6 + 361626b commit b71f3e6
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
36 changes: 33 additions & 3 deletions docs/how-tos/encrypt-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ nav_order: 8
---
# 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.
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.


{: .warning }
To restore an encrypted backup, you need to provide the same GPG passphrase used during backup process.
Expand All @@ -33,7 +34,7 @@ Using your private key
```shell
gpg --output database_20240730_044201.sql.gz --decrypt database_20240730_044201.sql.gz.gpg
```
### Backup
## Using GPG passphrase

```yml
services:
Expand Down Expand Up @@ -61,3 +62,32 @@ services:
networks:
web:
```
## Using GPG Public Key
```yml
services:
pg-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/pg-bkup/releases
# for a list of available releases.
image: jkaninda/pg-bkup
container_name: pg-bkup
command: backup -d database
volumes:
- ./backup:/backup
environment:
- DB_PORT=5432
- DB_HOST=postgres
- DB_NAME=database
- DB_USERNAME=username
- DB_PASSWORD=password
## Required to encrypt backup
- GPG_PUBLIC_KEY=/config/public_key.asc
# pg-bkup container must be connected to the same network with your database
networks:
- web
networks:
web:
```
24 changes: 24 additions & 0 deletions docs/how-tos/mutli-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,28 @@ databases:
user: joplin
password: password
path: /s3-path/joplin #For SSH or FTP you need to define the full path (/home/toto/backup/)
```
## Docker compose file
```yaml
services:
pg-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/pg-bkup/releases
# for a list of available releases.
image: jkaninda/pg-bkup
container_name: pg-bkup
command: backup
volumes:
- ./backup:/backup
environment:
## Multi backup config file
- BACKUP_CONFIG_FILE=/backup/config.yaml
# pg-bkup container must be connected to the same network with your database
networks:
- web
networks:
web:
```

0 comments on commit b71f3e6

Please sign in to comment.