Use nextcloud instead of jitsi

merge-requests/6/head
bom 1 year ago
parent 88a077e776
commit 91d88d2a68

@ -2,14 +2,14 @@
(:gen-class) (:gen-class)
(:require (:require
[dda.c4k-common.uberjar :as uberjar] [dda.c4k-common.uberjar :as uberjar]
[dda.c4k-nextcloud.jitsi :as jitsi] [dda.c4k-nextcloud.nextcloud :as nextcloud]
[dda.c4k-nextcloud.core :as core])) [dda.c4k-nextcloud.core :as core]))
(defn -main [& cmd-args] (defn -main [& cmd-args]
(uberjar/main-common (uberjar/main-common
"c4k-nextcloud" "c4k-nextcloud"
jitsi/config? nextcloud/config?
jitsi/auth? nextcloud/auth?
core/config-defaults core/config-defaults
core/generate core/generate
cmd-args)) cmd-args))

@ -17,25 +17,24 @@
[config (s/merge nextcloud/config? nextcloud/auth?)] [config (s/merge nextcloud/config? nextcloud/auth?)]
(let [nextcloud-default-storage-config {:pvc-storage-class-name default-storage-class (let [nextcloud-default-storage-config {:pvc-storage-class-name default-storage-class
:pv-storage-size-gb 200}] :pv-storage-size-gb 200}]
(into (map yaml/to-string
[] [(postgres/generate-config {:postgres-size :8gb})
(concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb})) (postgres/generate-secret config)
(yaml/to-string (postgres/generate-secret config)) (postgres/generate-pvc {:pv-storage-size-gb 50
(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 50 :pvc-storage-class-name default-storage-class})
:pvc-storage-class-name default-storage-class})) (postgres/generate-deployment)
(yaml/to-string (postgres/generate-deployment)) (postgres/generate-service)
(yaml/to-string (postgres/generate-service)) (nextcloud/generate-secret config)
(yaml/to-string (nextcloud/generate-secret config)) (nextcloud/generate-pvc (merge nextcloud-default-storage-config config))
(yaml/to-string (nextcloud/generate-pvc (merge nextcloud-default-storage-config config))) (nextcloud/generate-deployment config)
(yaml/to-string (nextcloud/generate-deployment config)) (nextcloud/generate-service)
(yaml/to-string (nextcloud/generate-service)) (nextcloud/generate-certificate config)
(yaml/to-string (nextcloud/generate-certificate config)) (nextcloud/generate-ingress config)]
(yaml/to-string (nextcloud/generate-ingress config))] (when (:contains? config :restic-repository)
(when (contains? config :restic-repository) [(backup/generate-config config)
[(yaml/to-string (backup/generate-config config)) (backup/generate-secret config)
(yaml/to-string (backup/generate-secret config)) (backup/generate-cron)
(yaml/to-string (backup/generate-cron)) (backup/generate-backup-restore-deployment config)]))))
(yaml/to-string (backup/generate-backup-restore-deployment config))])))))
(defn-spec generate any? (defn-spec generate any?
[my-config nextcloud/config? [my-config nextcloud/config?

@ -2,54 +2,21 @@
(:require (:require
#?(:clj [clojure.test :refer [deftest is are testing run-tests]] #?(:clj [clojure.test :refer [deftest is are testing run-tests]]
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) :cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
[clojure.string :as st] #?(:cljs [shadow-resource :as rc])
[dda.c4k-nextcloud.core :as cut] [clojure.spec.alpha :as s]
)) [dda.c4k-common.yaml :as yaml]
[dda.c4k-nextcloud.core :as cut]))
(deftest should-k8s-objects #?(:cljs
(is (= 15 (defmethod yaml/load-resource :nextcloud-test [resource-name]
(count (cut/k8s-objects {:fqdn "nextcloud-neu.prod.meissa-gmbh.de" (case resource-name
:postgres-db-user "nextcloud" "nextcloud-test/valid-auth.yaml" (rc/inline "nextcloud-test/valid-auth.yaml")
:postgres-db-password "nextcloud-db-password" "nextcloud-test/valid-config.yaml" (rc/inline "nextcloud-test/valid-config.yaml")
:nextcloud-admin-user "cloudadmin" "nextcloud-test/invalid-auth.yaml" (rc/inline "nextcloud-test/invalid-auth.yaml")
:nextcloud-admin-password "cloudpassword" "nextcloud-test/invalid-config.yaml" (rc/inline "nextcloud-test/invalid-config.yaml"))))
:issuer "prod"
:aws-access-key-id "aws-id" (deftest validate-valid-resources
:aws-secret-access-key "aws-secret" (is (s/valid? cut/config? (yaml/load-as-edn "nextcloud-test/valid-config.yaml")))
:restic-password "restic-pw" (is (s/valid? cut/auth? (yaml/load-as-edn "nextcloud-test/valid-auth.yaml")))
:restic-repository "restic-repository"})))) (is (not (s/valid? cut/config? (yaml/load-as-edn "nextcloud-test/invalid-config.yaml"))))
(is (= 11 (is (not (s/valid? cut/auth? (yaml/load-as-edn "nextcloud-test/invalid-auth.yaml")))))
(count (cut/k8s-objects {:fqdn "nextcloud-neu.prod.meissa-gmbh.de"
:postgres-db-user "nextcloud"
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer "prod"
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"}))))
(is (st/includes?
(get-in (cut/k8s-objects {:fqdn "nextcloud-neu.prod.meissa-gmbh.de"
:postgres-db-user "nextcloud"
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer "prod"
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"})
[0])
"max_connections = 700"))
(is (st/includes?
(get-in (cut/k8s-objects {:fqdn "nextcloud-neu.prod.meissa-gmbh.de"
:postgres-db-user "nextcloud"
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer "prod"
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"})
[6])
"storageClassName: local-path"))
)

Loading…
Cancel
Save