diff --git a/project.clj b/project.clj index 9798606..37a4209 100644 --- a/project.clj +++ b/project.clj @@ -3,9 +3,9 @@ :url "https://domaindrivenarchitecture.org" :license {:name "Apache License, Version 2.0" :url "https://www.apache.org/licenses/LICENSE-2.0.html"} - :dependencies [[org.clojure/clojure "1.11.3"] - [org.clojure/tools.reader "1.4.2"] - [org.domaindrivenarchitecture/c4k-common-clj "6.3.1"] + :dependencies [[org.clojure/clojure "1.12.0"] + [org.clojure/tools.reader "1.5.0"] + [org.domaindrivenarchitecture/c4k-common-clj "8.0.0"] [hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]] :target-path "target/%s/" :source-paths ["src/main/cljc" @@ -23,9 +23,9 @@ :main dda.c4k-nextcloud.uberjar :uberjar-name "c4k-nextcloud-standalone.jar" :dependencies [[org.clojure/tools.cli "1.1.230"] - [ch.qos.logback/logback-classic "1.5.6" + [ch.qos.logback/logback-classic "1.5.15" :exclusions [com.sun.mail/javax.mail]] - [org.slf4j/jcl-over-slf4j "2.0.13"] + [org.slf4j/jcl-over-slf4j "2.0.16"] [com.github.clj-easy/graal-build-time "1.0.5"]]}} :release-tasks [["test"] ["vcs" "assert-committed"] diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 6a69a18..8899f82 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -4,7 +4,7 @@ "src/test/cljc" "src/test/cljs" "src/test/resources"] - :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.3.1"] + :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "8.0.0"] [hickory "0.7.1"]] :builds {:frontend {:target :browser :modules {:main {:init-fn dda.c4k-nextcloud.browser/init}} diff --git a/src/main/clj/dda/c4k_nextcloud/uberjar.clj b/src/main/clj/dda/c4k_nextcloud/uberjar.clj index 368a49a..f4aa154 100644 --- a/src/main/clj/dda/c4k_nextcloud/uberjar.clj +++ b/src/main/clj/dda/c4k_nextcloud/uberjar.clj @@ -6,10 +6,11 @@ [dda.c4k-nextcloud.core :as core])) (defn -main [& cmd-args] - (uberjar/main-common + (uberjar/main-cm "c4k-nextcloud" nextcloud/config? nextcloud/auth? core/config-defaults - core/k8s-objects + core/config-objects + core/auth-objects cmd-args)) diff --git a/src/main/cljc/dda/c4k_nextcloud/core.cljc b/src/main/cljc/dda/c4k_nextcloud/core.cljc index 9d7cfdb..8b082b4 100644 --- a/src/main/cljc/dda/c4k_nextcloud/core.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/core.cljc @@ -16,7 +16,29 @@ :pvc-storage-class-name "hcloud-volumes-encrypted" :pv-storage-size-gb 200}) -(defn-spec k8s-objects cp/map-or-seq? +(defn-spec config-objects cp/map-or-seq? + [config nextcloud/config?] + (let [resolved-config (merge config-defaults config)] + (map yaml/to-string + (filter + #(not (nil? %)) + (cm/concat-vec + (ns/generate resolved-config) + (postgres/generate-config (merge resolved-config {:postgres-size :8gb + :db-name "cloud" + :pv-storage-size-gb 50})) + [(nextcloud/generate-pvc resolved-config) + (nextcloud/generate-deployment resolved-config) + (nextcloud/generate-service)] + (nextcloud/generate-ingress-and-cert resolved-config) + (when (:contains? resolved-config :restic-repository) + [(backup/generate-config resolved-config) + (backup/generate-cron) + (backup/generate-backup-restore-deployment resolved-config)]) + (when (:contains? resolved-config :mon-cfg) + (mon/generate-config))))))) + +(defn-spec auth-objects cp/map-or-seq? [config nextcloud/config? auth nextcloud/auth?] (let [resolved-config (merge config-defaults config)] @@ -24,20 +46,12 @@ (filter #(not (nil? %)) (cm/concat-vec - (ns/generate resolved-config) - (postgres/generate (merge resolved-config {:postgres-size :8gb - :db-name "cloud" - :pv-storage-size-gb 50}) - auth) - [(nextcloud/generate-secret auth) - (nextcloud/generate-pvc resolved-config) - (nextcloud/generate-deployment resolved-config) - (nextcloud/generate-service)] - (nextcloud/generate-ingress-and-cert resolved-config) + (postgres/generate-auth (merge resolved-config {:postgres-size :8gb + :db-name "cloud" + :pv-storage-size-gb 50}) + auth) + [(nextcloud/generate-secret auth)] (when (:contains? resolved-config :restic-repository) - [(backup/generate-config resolved-config) - (backup/generate-secret auth) - (backup/generate-cron) - (backup/generate-backup-restore-deployment resolved-config)]) + [(backup/generate-secret auth)]) (when (:contains? resolved-config :mon-cfg) - (mon/generate (:mon-cfg resolved-config) (:mon-auth auth)))))))) + (mon/generate-auth (:mon-cfg resolved-config) (:mon-auth auth)))))))) \ No newline at end of file