Merge branch 'main' of ssh://repo.prod.meissa.de:2222/meissa/c4k-forgejo

This commit is contained in:
Michael Jerger 2024-08-23 15:44:54 +02:00
commit 22199ba2ac
3 changed files with 14 additions and 17 deletions

View file

@ -1,7 +1,6 @@
#!/usr/bin/env bb #!/usr/bin/env bb
(require (require
'[babashka.tasks :as tasks]
'[dda.backup.core :as bc] '[dda.backup.core :as bc]
'[dda.backup.restic :as rc] '[dda.backup.restic :as rc]
'[dda.backup.postgresql :as pg] '[dda.backup.postgresql :as pg]
@ -22,19 +21,15 @@
:pg-user (bc/env-or-file "POSTGRES_USER") :pg-user (bc/env-or-file "POSTGRES_USER")
:pg-password (bc/env-or-file "POSTGRES_PASSWORD")})) :pg-password (bc/env-or-file "POSTGRES_PASSWORD")}))
(def aws-config {:aws-access-key-id (bc/env-or-file "AWS_ACCESS_KEY_ID")
:aws-secret-access-key (bc/env-or-file "AWS_SECRET_ACCESS_KEY")})
(def dry-run {:dry-run true :debug true}) (def dry-run {:dry-run true :debug true})
(defn prepare! (defn prepare!
[] []
(tasks/shell ["mkdir" "/root/.aws"]) (bc/create-aws-credentials! aws-config)
(spit "/root/.aws/credentials" (pg/create-pg-pass! db-config))
(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,7 +1,6 @@
#!/usr/bin/env bb #!/usr/bin/env bb
(require (require
'[babashka.tasks :as tasks]
'[dda.backup.core :as bc] '[dda.backup.core :as bc]
'[dda.backup.restic :as rc]) '[dda.backup.restic :as rc])
@ -13,13 +12,12 @@
(def db-config (merge restic-repo {:backup-path "pg-database"})) (def db-config (merge restic-repo {:backup-path "pg-database"}))
(def aws-config {:aws-access-key-id (bc/env-or-file "AWS_ACCESS_KEY_ID")
:aws-secret-access-key (bc/env-or-file "AWS_SECRET_ACCESS_KEY")})
(defn prepare! (defn prepare!
[] []
(tasks/shell ["mkdir" "-p" "/root/.aws"]) (bc/create-aws-credentials! aws-config))
(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!
[] []

View file

@ -21,11 +21,15 @@
:pg-password (bc/env-or-file "POSTGRES_PASSWORD") :pg-password (bc/env-or-file "POSTGRES_PASSWORD")
:snapshot-id "latest"})) :snapshot-id "latest"}))
(def aws-config {:aws-access-key-id (bc/env-or-file "AWS_ACCESS_KEY_ID")
:aws-secret-access-key (bc/env-or-file "AWS_SECRET_ACCESS_KEY")})
(def dry-run {:dry-run true :debug true}) (def dry-run {:dry-run true :debug true})
(defn prepare! (defn prepare!
[] []
(pg/create-pg-pass! db-config)) (pg/create-pg-pass! db-config)
(bc/create-aws-credentials! aws-config))
(defn restic-restore! (defn restic-restore!
[] []