dda-backup/infrastructure/backup/image/resources2/test.bb

36 lines
1 KiB
BlitzBasic
Raw Normal View History

2024-11-29 14:14:01 +00:00
#!/usr/bin/env bb
(require '[babashka.tasks :as tasks]
'[dda.backup.cred-rot :as cr]
'[dda.backup.restic :as rc]
'[dda.backup.postgresql :as pg])
(def restic-repo {:password-file "restic-pwd"
:restic-repository "restic-repo"})
(def file-config (merge restic-repo {:backup-path "files"
:files ["test-backup"]
:restore-target-directory "test-restore"}))
2024-12-11 09:43:44 +00:00
(def cred-config (merge restic-repo
{:new-password-config {:new-password-file "new-pw"
:valid-from "2024-12-12 00:00:00"}}))
2024-11-29 14:14:01 +00:00
(def dry-run {:dry-run true :debug true})
(defn prepare!
[]
2024-12-11 09:43:44 +00:00
(spit "restic-pwd" "thePassword")
(spit "new-pw" "newPassword")
2024-11-29 14:14:01 +00:00
(tasks/shell "mkdir" "-p" "test-backup")
(spit "test-backup/file" "I was here")
2024-12-11 09:43:44 +00:00
(tasks/shell "mkdir" "-p" "test-restore"))
2024-11-29 14:14:01 +00:00
(defn restic-repo-init!
[]
(rc/init! restic-repo))
(prepare!)
(restic-repo-init!)
2024-12-11 09:43:44 +00:00
(cr/change-password! cred-config)