Skip to content

Commit

Permalink
paperless: cleanup old backup files
Browse files Browse the repository at this point in the history
Signed-off-by: paulfantom <[email protected]>
  • Loading branch information
paulfantom committed Dec 1, 2024
1 parent 708942e commit 33fb29a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
31 changes: 21 additions & 10 deletions apps/paperless/jsonnet/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,27 @@ local all = {
spec+: {
template+: {
spec+: {
initContainers: [{
// init container to change permissions on the backup directory to 0777 due to bug in longhorn RWX support
command: ['sh', '-c', 'chmod 0777 /mnt/backups'],
image: 'busybox',
name: 'permissions',
volumeMounts: [{
mountPath: '/mnt/backups',
name: 'backups',
}],
}],
initContainers: [
{
// init container to change permissions on the backup directory to 0777 due to bug in longhorn RWX support
command: ['sh', '-c', 'chmod 0777 /mnt/backups'],
image: 'busybox',
name: 'permissions',
volumeMounts: [{
mountPath: '/mnt/backups',
name: 'backups',
}],
},{
// init container to remove old backups
command: ['sh', '-c', 'find /mnt/backups -mtime +20 -type f -delete'],
image: 'busybox',
name: 'cleanup',
volumeMounts: [{
mountPath: '/mnt/backups',
name: 'backups',
}],
}
],
},
},
},
Expand Down
9 changes: 9 additions & 0 deletions apps/paperless/manifests/web/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ spec:
volumeMounts:
- mountPath: /mnt/backups
name: backups
- command:
- sh
- -c
- find /mnt/backups -mtime +20 -type f -delete
image: busybox
name: cleanup
volumeMounts:
- mountPath: /mnt/backups
name: backups
restartPolicy: Never
serviceAccountName: paperless
volumes:
Expand Down

0 comments on commit 33fb29a

Please sign in to comment.