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

35 lines
1 KiB
Clojure
Executable file

#!/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"}))
(def cred-config (merge restic-repo
{:new-password-config {:new-password-file "new-pw"
:valid-from "2024-12-12 00:00:00"}}))
(def dry-run {:dry-run true :debug true})
(defn prepare!
[]
(spit "restic-pwd" "thePassword")
(spit "new-pw" "newPassword")
(tasks/shell "mkdir" "-p" "test-backup")
(spit "test-backup/file" "I was here")
(tasks/shell "mkdir" "-p" "test-restore"))
(defn restic-repo-init!
[]
(rc/init! restic-repo))
(prepare!)
(restic-repo-init!)
(cr/change-password! cred-config)