introduce-backup-metric #5
10 changed files with 36 additions and 16 deletions
1
build.py
1
build.py
|
@ -160,7 +160,6 @@ def inst(project):
|
|||
check=True,
|
||||
)
|
||||
package_native(project)
|
||||
|
||||
run(
|
||||
"sudo install -m=755 target/graalvm/" + project.name + " /usr/local/bin/" + project.name + "",
|
||||
shell=True,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM domaindrivenarchitecture/dda-backup:5.3.0
|
||||
FROM domaindrivenarchitecture/dda-backup:5.4.0
|
||||
|
||||
ADD resources /tmp
|
||||
RUN /tmp/install.bb
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
'[dda.backup.config :as cfg]
|
||||
'[dda.backup.restic :as rc]
|
||||
'[dda.backup.postgresql :as pg]
|
||||
'[dda.backup.monitoring :as mon]
|
||||
'[dda.backup.backup :as bak])
|
||||
|
||||
(def config (cfg/read-config "/usr/local/bin/config.edn"))
|
||||
|
@ -22,6 +23,11 @@
|
|||
[]
|
||||
(bak/backup-db! (:db-config config)))
|
||||
|
||||
(prepare!)
|
||||
(restic-repo-init!)
|
||||
(restic-backup!)
|
||||
(try
|
||||
(mon/backup-start-metrics! (:db-config config))
|
||||
(prepare!)
|
||||
(restic-repo-init!)
|
||||
(restic-backup!)
|
||||
(mon/backup-success-metrics! (:db-config config))
|
||||
(catch Exception e
|
||||
(mon/backup-fail-metrics! (:db-config config))))
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{:restic-repo {:password-file #env-or-file "RESTIC_PASSWORD_FILE"
|
||||
:restic-repository #env-or-file "RESTIC_REPOSITORY"}
|
||||
{:monitoring {:namespace "keycloak"}
|
||||
|
||||
:restic-repo #merge [#ref [:monitoring]
|
||||
{:password-file #env-or-file "RESTIC_PASSWORD_FILE"
|
||||
:restic-repository #env-or-file "RESTIC_REPOSITORY"}]
|
||||
|
||||
:db-config #merge [#ref [:restic-repo]
|
||||
{:backup-path "pg-database"
|
||||
|
@ -12,4 +15,5 @@
|
|||
:aws-config {:aws-access-key-id #env-or-file "AWS_ACCESS_KEY_ID"
|
||||
:aws-secret-access-key #env-or-file "AWS_SECRET_ACCESS_KEY"}
|
||||
|
||||
:dry-run {:dry-run true :debug true}}
|
||||
:dry-run {:dry-run true :debug true}
|
||||
}
|
|
@ -14,4 +14,5 @@
|
|||
(in/install! "list-snapshots.bb")
|
||||
(in/install! "change-password.bb")
|
||||
(in/install! "wait.bb")
|
||||
(in/install! "monitoring.bb")
|
||||
(ub/cleanup-container!)
|
11
infrastructure/backup/image/resources/monitoring.bb
Normal file
11
infrastructure/backup/image/resources/monitoring.bb
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bb
|
||||
|
||||
(require
|
||||
'[dda.backup.monitoring :as mon])
|
||||
|
||||
(def config {:metrics {:kube_job_status_active 0
|
||||
:kube_job_status_failed 1
|
||||
:kube_job_status_succeeded 0
|
||||
:kube_job_status_start_time (/ (System/currentTimeMillis) 1000)}})
|
||||
|
||||
(mon/send-metrics! config)
|
|
@ -4,8 +4,8 @@
|
|||
:license {:name "Apache License, Version 2.0"
|
||||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||
:dependencies [[org.clojure/clojure "1.12.0"]
|
||||
[org.clojure/tools.reader "1.5.1"]
|
||||
[org.domaindrivenarchitecture/c4k-common-clj "9.0.1"]]
|
||||
[org.clojure/tools.reader "1.5.2"]
|
||||
[org.domaindrivenarchitecture/c4k-common-clj "10.0.0"]]
|
||||
:target-path "target/%s/"
|
||||
:source-paths ["src/main/cljc"
|
||||
"src/main/clj"]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"src/test/cljc"
|
||||
"src/test/cljs"
|
||||
"src/test/resources"]
|
||||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "9.0.1"]
|
||||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "10.0.0"]
|
||||
[hickory "0.7.1"]]
|
||||
:builds {:frontend {:target :browser
|
||||
:modules {:main {:init-fn dda.c4k-keycloak.browser/init}}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
[dda.c4k-common.common :as cm]
|
||||
[dda.c4k-common.base64 :as b64]
|
||||
[dda.c4k-common.ingress :as ing]
|
||||
[dda.c4k-common.predicate :as cp]))
|
||||
[dda.c4k-common.predicate :as cp]
|
||||
[dda.c4k-common.namespace :as ns]))
|
||||
|
||||
(s/def ::fqdn cp/fqdn-string?)
|
||||
(s/def ::issuer cp/letsencrypt-issuer?)
|
||||
|
@ -35,9 +36,7 @@
|
|||
(defn-spec generate-configmap cp/map-or-seq?
|
||||
[config config?]
|
||||
(let [{:keys [namespace]} config]
|
||||
(->
|
||||
(yaml/load-as-edn "keycloak/configmap.yaml")
|
||||
(cm/replace-all-matching "NAMESPACE" namespace))))
|
||||
(ns/load-and-adjust-namespace "keycloak/configmap.yaml" namespace)))
|
||||
|
||||
(defn-spec generate-service-headless cp/map-or-seq?
|
||||
[config config?]
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
(is (not (s/valid? cut/auth? (yaml/load-as-edn "keycloak-test/invalid-auth.yaml")))))
|
||||
|
||||
(deftest test-whole-generation
|
||||
(is (= 29
|
||||
(is (= 32
|
||||
(count
|
||||
(cut/config-objects
|
||||
(yaml/load-as-edn "keycloak-test/valid-config.yaml")))))
|
||||
|
|
Loading…
Add table
Reference in a new issue