Use nextcloud instead of jitsi

This commit is contained in:
bom 2023-02-03 10:14:34 +01:00
parent 88a077e776
commit 91d88d2a68
3 changed files with 38 additions and 72 deletions

View file

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

View file

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

View file

@ -2,54 +2,21 @@
(:require
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
[clojure.string :as st]
[dda.c4k-nextcloud.core :as cut]
))
#?(:cljs [shadow-resource :as rc])
[clojure.spec.alpha :as s]
[dda.c4k-common.yaml :as yaml]
[dda.c4k-nextcloud.core :as cut]))
(deftest should-k8s-objects
(is (= 15
(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"
:restic-repository "restic-repository"}))))
(is (= 11
(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"))
)
#?(:cljs
(defmethod yaml/load-resource :nextcloud-test [resource-name]
(case resource-name
"nextcloud-test/valid-auth.yaml" (rc/inline "nextcloud-test/valid-auth.yaml")
"nextcloud-test/valid-config.yaml" (rc/inline "nextcloud-test/valid-config.yaml")
"nextcloud-test/invalid-auth.yaml" (rc/inline "nextcloud-test/invalid-auth.yaml")
"nextcloud-test/invalid-config.yaml" (rc/inline "nextcloud-test/invalid-config.yaml"))))
(deftest validate-valid-resources
(is (s/valid? cut/config? (yaml/load-as-edn "nextcloud-test/valid-config.yaml")))
(is (s/valid? cut/auth? (yaml/load-as-edn "nextcloud-test/valid-auth.yaml")))
(is (not (s/valid? cut/config? (yaml/load-as-edn "nextcloud-test/invalid-config.yaml"))))
(is (not (s/valid? cut/auth? (yaml/load-as-edn "nextcloud-test/invalid-auth.yaml")))))