docs: add Kubernetes restore Job example
This commit is contained in:
1
Makefile
1
Makefile
@@ -1,6 +1,5 @@
|
|||||||
BINARY_NAME=pg-bkup
|
BINARY_NAME=pg-bkup
|
||||||
IMAGE_NAME=jkaninda/pg-bkup
|
IMAGE_NAME=jkaninda/pg-bkup
|
||||||
#IMAGE_NAME=ghcr.io/jkaninda/pg-bkup:v1.0
|
|
||||||
include .env
|
include .env
|
||||||
export
|
export
|
||||||
run:
|
run:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ services:
|
|||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- pg-bkup restore --storage s3 -d my-database -f store_20231219_022941.sql.gz --path /my-custom-path
|
- bkup restore --storage s3 -d my-database -f store_20231219_022941.sql.gz --path /my-custom-path
|
||||||
volumes:
|
volumes:
|
||||||
- ./backup:/backup
|
- ./backup:/backup
|
||||||
environment:
|
environment:
|
||||||
@@ -48,4 +48,50 @@ services:
|
|||||||
- web
|
- web
|
||||||
networks:
|
networks:
|
||||||
web:
|
web:
|
||||||
```
|
```
|
||||||
|
## Restore on Kubernetes
|
||||||
|
|
||||||
|
Simple Kubernetes restore Job:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: restore-db
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: pg-bkup
|
||||||
|
image: jkaninda/pg-bkup
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- bkup restore -s s3 --path /custom_path -f store_20231219_022941.sql.gz
|
||||||
|
env:
|
||||||
|
- name: DB_PORT
|
||||||
|
value: "5432"
|
||||||
|
- name: DB_HOST
|
||||||
|
value: ""
|
||||||
|
- name: DB_NAME
|
||||||
|
value: ""
|
||||||
|
- name: DB_USERNAME
|
||||||
|
value: ""
|
||||||
|
# Please use secret!
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
value: ""
|
||||||
|
- name: AWS_S3_ENDPOINT
|
||||||
|
value: "https://s3.amazonaws.com"
|
||||||
|
- name: AWS_S3_BUCKET_NAME
|
||||||
|
value: "xxx"
|
||||||
|
- name: AWS_REGION
|
||||||
|
value: "us-west-2"
|
||||||
|
- name: AWS_ACCESS_KEY
|
||||||
|
value: "xxxx"
|
||||||
|
- name: AWS_SECRET_KEY
|
||||||
|
value: "xxxx"
|
||||||
|
- name: AWS_DISABLE_SSL
|
||||||
|
value: "false"
|
||||||
|
restartPolicy: Never
|
||||||
|
backoffLimit: 4
|
||||||
|
```
|
||||||
|
|||||||
@@ -47,4 +47,50 @@ services:
|
|||||||
- web
|
- web
|
||||||
networks:
|
networks:
|
||||||
web:
|
web:
|
||||||
|
```
|
||||||
|
## Restore on Kubernetes
|
||||||
|
|
||||||
|
Simple Kubernetes restore Job:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: restore-db
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: pg-bkup
|
||||||
|
image: jkaninda/pg-bkup
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- bkup restore -s ssh -f store_20231219_022941.sql.gz
|
||||||
|
env:
|
||||||
|
- name: DB_PORT
|
||||||
|
value: "5432"
|
||||||
|
- name: DB_HOST
|
||||||
|
value: ""
|
||||||
|
- name: DB_NAME
|
||||||
|
value: ""
|
||||||
|
- name: DB_USERNAME
|
||||||
|
value: ""
|
||||||
|
# Please use secret!
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
value: ""
|
||||||
|
- name: SSH_HOST_NAME
|
||||||
|
value: ""
|
||||||
|
- name: SSH_PORT
|
||||||
|
value: "22"
|
||||||
|
- name: SSH_USER
|
||||||
|
value: "xxx"
|
||||||
|
- name: SSH_REMOTE_PATH
|
||||||
|
value: "/home/jkaninda/backups"
|
||||||
|
- name: AWS_ACCESS_KEY
|
||||||
|
value: "xxxx"
|
||||||
|
- name: SSH_IDENTIFY_FILE
|
||||||
|
value: "/tmp/id_ed25519"
|
||||||
|
restartPolicy: Never
|
||||||
|
backoffLimit: 4
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user