diff --git a/project.clj b/project.clj index ac6b3a7..90e0d00 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :url "https://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.10.3"] [org.clojure/tools.reader "1.3.6"] - [org.domaindrivenarchitecture/c4k-common-clj "0.4.0"] + [org.domaindrivenarchitecture/c4k-common-clj "1.0.0"] [hickory "0.7.1"]] :target-path "target/%s/" :source-paths ["src/main/cljc" diff --git a/src/main/cljc/dda/c4k_matomo/core.cljc b/src/main/cljc/dda/c4k_matomo/core.cljc index caee14b..0487759 100644 --- a/src/main/cljc/dda/c4k_matomo/core.cljc +++ b/src/main/cljc/dda/c4k_matomo/core.cljc @@ -11,14 +11,21 @@ (def config-defaults {:issuer :staging}) (def config? (s/keys :req-un [::matomo/fqdn] - :opt-un [])) + :opt-un [::matomo/issuer ::postgres/postgres-data-volume-path])) -(def auth? (s/keys :req-un [])) +(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password])) ;TODO add auth (defn k8s-objects [config] (into [] - (concat + (concat + [(yaml/to-string (postgres/generate-config :postgres-size :2gb :db-name "shynet")) + (yaml/to-string (postgres/generate-secret config))] + (when (contains? config :postgres-data-volume-path) + [(yaml/to-string (postgres/generate-persistent-volume config))]) + [(yaml/to-string (postgres/generate-pvc)) + (yaml/to-string (postgres/generate-deployment :postgres-image "postgres:14")) + (yaml/to-string (postgres/generate-service))] [(yaml/to-string (matomo/generate-webserver-deployment)) (yaml/to-string (matomo/generate-celeryworker-deployment)) (yaml/to-string (matomo/generate-ingress config)) diff --git a/src/main/cljc/dda/c4k_matomo/matomo.cljc b/src/main/cljc/dda/c4k_matomo/matomo.cljc index 9b05c85..87fa8f0 100644 --- a/src/main/cljc/dda/c4k_matomo/matomo.cljc +++ b/src/main/cljc/dda/c4k_matomo/matomo.cljc @@ -3,11 +3,11 @@ [clojure.spec.alpha :as s] #?(:cljs [shadow.resource :as rc]) [dda.c4k-common.yaml :as yaml] - [dda.c4k-common.common :as cm])) + [dda.c4k-common.common :as cm] + [dda.c4k-common.predicate :as pred])) -(s/def ::fqdn cm/fqdn-string?) -(s/def ::issuer cm/letsencrypt-issuer?) -(s/def ::matomo-data-volume-path string?) +(s/def ::fqdn pred/fqdn-string?) +(s/def ::issuer pred/letsencrypt-issuer?) #?(:cljs (defmethod yaml/load-resource :matomo [resource-name] diff --git a/valid-auth.edn b/valid-auth.edn new file mode 100644 index 0000000..dc90ecb --- /dev/null +++ b/valid-auth.edn @@ -0,0 +1,2 @@ +{:postgres-db-user "jira" + :postgres-db-password "jira-db-password"} diff --git a/valid-config.edn b/valid-config.edn new file mode 100644 index 0000000..fdf04df --- /dev/null +++ b/valid-config.edn @@ -0,0 +1,3 @@ +{:fqdn "shynet-test.test.meissa-gmbh.de" + :issuer :staging + :postgres-data-volume-path "/var/postgres"}