test the integration

This commit is contained in:
Michael Jerger 2024-08-23 11:39:59 +02:00
parent a12a421bbf
commit 23ec2c6106
2 changed files with 33 additions and 7 deletions

View file

@ -1,9 +1,11 @@
#!/usr/bin/env bb #!/usr/bin/env bb
(require '[dda.backup.core :as bc] (require
'[dda.backup.restic :as rc] '[babashka.tasks :as tasks]
'[dda.backup.postgresql :as pg] '[dda.backup.core :as bc]
'[dda.backup.backup :as bak]) '[dda.backup.restic :as rc]
'[dda.backup.postgresql :as pg]
'[dda.backup.backup :as bak])
(def restic-repo {:password-file (bc/env-or-file "RESTIC_PASSWORD_FILE") (def restic-repo {:password-file (bc/env-or-file "RESTIC_PASSWORD_FILE")
:restic-repository (bc/env-or-file "RESTIC_REPOSITORY")}) :restic-repository (bc/env-or-file "RESTIC_REPOSITORY")})
@ -23,7 +25,15 @@
(defn prepare! (defn prepare!
[] []
(pg/create-pg-pass! db-config)) (tasks/shell ["mkdir" "/root/.aws"])
(spit "/root/.aws/credentials"
(str "[default]\n"
"aws_access_key_id=" (bc/env-or-file "AWS_ACCESS_KEY_ID") "\n"
"aws_secret_access_key=" (bc/env-or-file "AWS_SECRET_ACCESS_KEY")))
(tasks/shell ["chmod" "0600" "/root/.aws/credentials"])
(tasks/shell ["chmod" "0600" "/root/.pgpass"]
(pg/create-pg-pass! db-config)
(tasks/shell ["export" "TEST=hallo"]))
(defn restic-repo-init! (defn restic-repo-init!
[] []

View file

@ -1,14 +1,30 @@
#!/usr/bin/env bb #!/usr/bin/env bb
(require '[dda.backup.core :as bc] (require
'[dda.backup.restic :as rc]) '[babashka.tasks :as tasks]
'[dda.backup.core :as bc]
'[dda.backup.restic :as rc])
(def restic-repo {:password-file (bc/env-or-file "RESTIC_PASSWORD_FILE") (def restic-repo {:password-file (bc/env-or-file "RESTIC_PASSWORD_FILE")
:restic-repository (bc/env-or-file "RESTIC_REPOSITORY")}) :restic-repository (bc/env-or-file "RESTIC_REPOSITORY")})
(def file-config (merge restic-repo {:backup-path "files"}))
(def db-config (merge restic-repo {:backup-path "pg-database"}))
(defn prepare!
[]
(tasks/shell ["mkdir" "-p" "/root/.aws"])
(spit "/root/.aws/credentials"
(str "[default]\n"
"aws_access_key_id=" (bc/env-or-file "AWS_ACCESS_KEY_ID") "\n"
"aws_secret_access_key=" (bc/env-or-file "AWS_SECRET_ACCESS_KEY") "\n")))
(defn list-snapshots! (defn list-snapshots!
[] []
(rc/list-snapshots! file-config) (rc/list-snapshots! file-config)
(rc/list-snapshots! db-config)) (rc/list-snapshots! db-config))
(prepare!)
(list-snapshots!) (list-snapshots!)