Skip to content

Commit b0dabf7

Browse files
Merge pull request #2 from JarvusInnovations/develop
Release: v1.0.1
2 parents dc2bafe + 6115458 commit b0dabf7

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,71 @@
11
# restic-toolkit
2+
23
A container image containing restic plus some other tools useful for backups in Kubernetes and other container environments
4+
5+
## Example usage
6+
7+
```yaml
8+
apiVersion: batch/v1beta1
9+
kind: CronJob
10+
metadata:
11+
namespace: myapp-production
12+
name: myapp-backup
13+
spec:
14+
schedule: 15 * * * *
15+
concurrencyPolicy: Forbid
16+
startingDeadlineSeconds: 86400 # one day
17+
jobTemplate:
18+
spec:
19+
activeDeadlineSeconds: 7200 # two hours
20+
template:
21+
spec:
22+
restartPolicy: Never
23+
containers:
24+
- name: restic-toolkit
25+
image: 'ghcr.io/jarvusinnovations/restic-toolkit:1.0.0'
26+
imagePullPolicy: IfNotPresent
27+
envFrom:
28+
- secretRef:
29+
name: restic-env
30+
env:
31+
- name: PGHOST
32+
value: mydb
33+
- name: PGPORT
34+
valueFrom:
35+
secretKeyRef:
36+
key: POSTGRES_PORT
37+
name: postgres-production
38+
- name: PGDATABASE
39+
valueFrom:
40+
secretKeyRef:
41+
key: POSTGRES_DB
42+
name: postgres-production
43+
- name: PGUSER
44+
valueFrom:
45+
secretKeyRef:
46+
key: POSTGRES_USER
47+
name: postgres-production
48+
- name: PGPASSWORD
49+
valueFrom:
50+
secretKeyRef:
51+
key: POSTGRES_PASSWORD
52+
name: postgres-production
53+
command: ["/bin/bash", "-c"]
54+
args:
55+
- |
56+
57+
# snapshot current database
58+
pg_dumpall --clean \
59+
| gzip --rsyncable \
60+
| restic backup \
61+
--host myapp \
62+
--stdin \
63+
--stdin-filename database.sql.gz
64+
65+
# prune aged snapshots
66+
restic forget \
67+
--host myapp \
68+
--keep-last 36 \
69+
--keep-daily 7 \
70+
--keep-weekly 52
71+
```

0 commit comments

Comments
 (0)