added postgres

This commit is contained in:
see 2022-01-27 15:43:23 +01:00
parent 8c0bf1243e
commit 3b6570e6fb
5 changed files with 20 additions and 8 deletions

View file

@ -5,7 +5,7 @@
:url "https://www.apache.org/licenses/LICENSE-2.0.html"} :url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"] :dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/tools.reader "1.3.6"] [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"]] [hickory "0.7.1"]]
:target-path "target/%s/" :target-path "target/%s/"
:source-paths ["src/main/cljc" :source-paths ["src/main/cljc"

View file

@ -11,14 +11,21 @@
(def config-defaults {:issuer :staging}) (def config-defaults {:issuer :staging})
(def config? (s/keys :req-un [::matomo/fqdn] (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] (defn k8s-objects [config]
(into (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-webserver-deployment))
(yaml/to-string (matomo/generate-celeryworker-deployment)) (yaml/to-string (matomo/generate-celeryworker-deployment))
(yaml/to-string (matomo/generate-ingress config)) (yaml/to-string (matomo/generate-ingress config))

View file

@ -3,11 +3,11 @@
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
#?(:cljs [shadow.resource :as rc]) #?(:cljs [shadow.resource :as rc])
[dda.c4k-common.yaml :as yaml] [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 ::fqdn pred/fqdn-string?)
(s/def ::issuer cm/letsencrypt-issuer?) (s/def ::issuer pred/letsencrypt-issuer?)
(s/def ::matomo-data-volume-path string?)
#?(:cljs #?(:cljs
(defmethod yaml/load-resource :matomo [resource-name] (defmethod yaml/load-resource :matomo [resource-name]

2
valid-auth.edn Normal file
View file

@ -0,0 +1,2 @@
{:postgres-db-user "jira"
:postgres-db-password "jira-db-password"}

3
valid-config.edn Normal file
View file

@ -0,0 +1,3 @@
{:fqdn "shynet-test.test.meissa-gmbh.de"
:issuer :staging
:postgres-data-volume-path "/var/postgres"}