docs: add docker recurring backup examples

This commit is contained in:
Jonas Kaninda
2024-09-29 06:52:38 +02:00
parent a90e5c673c
commit 5a5e4dee2a
4 changed files with 31 additions and 4 deletions

View File

@@ -87,6 +87,18 @@ services:
networks: networks:
web: web:
``` ```
### Docker recurring backup
```shell
docker run --rm --network network_name \
-v $PWD/backup:/backup/ \
-e "DB_HOST=hostname" \
-e "DB_USERNAME=user" \
-e "DB_PASSWORD=password" \
jkaninda/pg-bkup backup -d dbName --cron-expression "@every 1m"
```
See: https://jkaninda.github.io/pg-bkup/reference/#predefined-schedules
## Deploy on Kubernetes ## Deploy on Kubernetes
For Kubernetes, you don't need to run it in scheduled mode. You can deploy it as Job or CronJob. For Kubernetes, you don't need to run it in scheduled mode. You can deploy it as Job or CronJob.

View File

@@ -82,6 +82,18 @@ services:
networks: networks:
web: web:
``` ```
### Docker recurring backup
```shell
docker run --rm --network network_name \
-v $PWD/backup:/backup/ \
-e "DB_HOST=hostname" \
-e "DB_USERNAME=user" \
-e "DB_PASSWORD=password" \
jkaninda/pg-bkup backup -d dbName --cron-expression "@every 1m"
```
See: https://jkaninda.github.io/pg-bkup/reference/#predefined-schedules
## Kubernetes ## Kubernetes
```yaml ```yaml

View File

@@ -3,12 +3,14 @@ services:
pg-bkup: pg-bkup:
image: jkaninda/pg-bkup image: jkaninda/pg-bkup
container_name: pg-bkup container_name: pg-bkup
command: backup --dbname database_name command: backup --dbname database_name #--cron-expression "@every 5m"
volumes: volumes:
- ./backup:/backup - ./backup:/backup
environment: environment:
- DB_PORT=5432 - DB_PORT=5432
- DB_HOST=postgress - DB_HOST=postgres
- DB_USERNAME=userName - DB_USERNAME=userName
- DB_PASSWORD=${DB_PASSWORD} - DB_PASSWORD=${DB_PASSWORD}
- BACKUP_CRON_EXPRESSION=0 1 * * * # Check https://jkaninda.github.io/pg-bkup/reference/#predefined-schedules
- BACKUP_CRON_EXPRESSION=@daily #@every 5m|@weekly | @monthly |0 1 * * *

View File

@@ -21,7 +21,8 @@ services:
- AWS_SECRET_KEY=xxxxx - AWS_SECRET_KEY=xxxxx
## In case you are using S3 alternative such as Minio and your Minio instance is not secured, you change it to true ## In case you are using S3 alternative such as Minio and your Minio instance is not secured, you change it to true
- AWS_DISABLE_SSL="false" - AWS_DISABLE_SSL="false"
- BACKUP_CRON_EXPRESSION=0 1 * * * # Check https://jkaninda.github.io/pg-bkup/reference/#predefined-schedules
- BACKUP_CRON_EXPRESSION=@daily #@every 5m|@weekly | @monthly |0 1 * * *
# pg-bkup container must be connected to the same network with your database # pg-bkup container must be connected to the same network with your database
networks: networks:
- web - web