aboutsummaryrefslogtreecommitdiff
path: root/rpi5/sonarr/backup.yaml
blob: a9facc7c4632d277813d68619b9eaa95516cdb8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
apiVersion: batch/v1
kind: CronJob
metadata:
  name: sonarr-backup
spec:
  schedule: 15 14 * * *
  jobTemplate:
    spec:
      template:
        metadata:
          annotations:
            linkerd.io/inject: enabled
        spec:
          initContainers:
            - name: sonarr-backup
              image: ghcr.io/ansg191-lab/arr-backup:0.1.8@sha256:4252f217d584f3c1038b8990df7263b3bf1dedbf5c559827924cf39e3b626982
              imagePullPolicy: IfNotPresent
              env:
                - name: ARR_URL
                  value: "http://sonarr"
                - name: ARR_API_KEY
                  valueFrom:
                    secretKeyRef:
                      key: api-key
                      name: backup-secrets
                - name: ARR_CONFIG_DIR
                  value: /config
                - name: ARR_DEST_DIR
                  value: /backup
                - name: RUST_LOG
                  value: "info"
                - name: ARR_PRODUCTION
                  value: "true"
              volumeMounts:
                - mountPath: /config
                  name: config
                  readOnly: true
                - mountPath: /backup
                  name: backup
          containers:
            - name: restic
              image: creativeprojects/resticprofile:0.31.0@sha256:7aa9467ba73f44e1306b6143fa91af65d3652a964c1b44a83920d2e1336a0944
              imagePullPolicy: IfNotPresent
              command: [ "resticprofile", "backup" ]
              env:
                - name: RESTIC_REST_USERNAME
                  value: "sonarr-restic"
                - name: RESTIC_REST_PASSWORD
                  valueFrom:
                    secretKeyRef:
                      key: restic-password
                      name: backup-secrets
              volumeMounts:
                - mountPath: /resticprofile/profiles.yaml
                  name: profile
                  subPath: profiles.yaml
                - mountPath: /resticprofile/sonarr.txt
                  name: backup-secrets
                  subPath: sonarr.txt
                - mountPath: /backup
                  name: backup
          restartPolicy: OnFailure
          volumes:
            - name: config
              persistentVolumeClaim:
                claimName: config-sonarr-0
                readOnly: true
            - name: backup
              emptyDir: { }
            - name: profile
              configMap:
                name: restic-profile
            - name: backup-secrets
              secret:
                secretName: backup-secrets
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: restic-profile
data:
  profiles.yaml: |
    version: "1"

    global:
      restic-lock-retry-after: "1m"
      restic-stale-lock-age: "4h"

    default:
      repository: "rest:https://restic.anshulg.com/sonarr-restic/"
      initialize: true
      password-file: "/resticprofile/sonarr.txt"
      compression: "max"
      force-inactive-lock: true

      env:
        RESTIC_HOST: "sonarr"

      retention:
        before-backup: false
        after-backup: true
        keep-daily: 7
        keep-weekly: 4
        keep-monthly: 12
        keep-yearly: 1
        prune: true
        host: true

      backup:
        source:
          - "/backup"
        tag:
          - "sonarr"