rename everything from shynet to jitsi

This commit is contained in:
bom 2022-02-09 10:49:45 +01:00
parent 532e611e68
commit bac553135d
21 changed files with 150 additions and 150 deletions

View file

@ -47,7 +47,7 @@ test-schema:
stage: build_and_test stage: build_and_test
script: script:
- lein uberjar - lein uberjar
- java -jar target/uberjar/c4k-shynet-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate - - java -jar target/uberjar/c4k-jitsi-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate -
artifacts: artifacts:
paths: paths:
- target/uberjar - target/uberjar
@ -68,9 +68,9 @@ package-frontend:
script: script:
- mkdir -p target/frontend-build - mkdir -p target/frontend-build
- shadow-cljs release frontend - shadow-cljs release frontend
- cp public/js/main.js target/frontend-build/c4k-shynet.js - cp public/js/main.js target/frontend-build/c4k-jitsi.js
- sha256sum target/frontend-build/c4k-shynet.js > target/frontend-build/c4k-shynet.js.sha256 - sha256sum target/frontend-build/c4k-jitsi.js > target/frontend-build/c4k-jitsi.js.sha256
- sha512sum target/frontend-build/c4k-shynet.js > target/frontend-build/c4k-shynet.js.sha512 - sha512sum target/frontend-build/c4k-jitsi.js > target/frontend-build/c4k-jitsi.js.sha512
artifacts: artifacts:
paths: paths:
- target/frontend-build - target/frontend-build
@ -79,8 +79,8 @@ package-uberjar:
<<: *clj <<: *clj
stage: package stage: package
script: script:
- sha256sum target/uberjar/c4k-shynet-standalone.jar > target/uberjar/c4k-shynet-standalone.jar.sha256 - sha256sum target/uberjar/c4k-jitsi-standalone.jar > target/uberjar/c4k-jitsi-standalone.jar.sha256
- sha512sum target/uberjar/c4k-shynet-standalone.jar > target/uberjar/c4k-shynet-standalone.jar.sha512 - sha512sum target/uberjar/c4k-jitsi-standalone.jar > target/uberjar/c4k-jitsi-standalone.jar.sha512
artifacts: artifacts:
paths: paths:
- target/uberjar - target/uberjar
@ -117,9 +117,9 @@ release:
- apk --no-cache add curl - apk --no-cache add curl
- | - |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"c4k-shynet-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-shynet/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-shynet-standalone.jar\"}" \ --assets-link "{\"name\":\"c4k-jitsi-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-jitsi-standalone.jar\"}" \
--assets-link "{\"name\":\"c4k-shynet-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-shynet/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-shynet-standalone.jar.sha256\"}" \ --assets-link "{\"name\":\"c4k-jitsi-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-jitsi-standalone.jar.sha256\"}" \
--assets-link "{\"name\":\"c4k-shynet-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-shynet/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-shynet-standalone.jar.sha512\"}" \ --assets-link "{\"name\":\"c4k-jitsi-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-jitsi-standalone.jar.sha512\"}" \
--assets-link "{\"name\":\"c4k-shynet.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-shynet/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-shynet.js\"}" \ --assets-link "{\"name\":\"c4k-jitsi.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-jitsi.js\"}" \
--assets-link "{\"name\":\"c4k-shynet.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-shynet/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-shynet.js.sha256\"}" \ --assets-link "{\"name\":\"c4k-jitsi.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-jitsi.js.sha256\"}" \
--assets-link "{\"name\":\"c4k-shynet.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-shynet/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-shynet.js.sha512\"}" \ --assets-link "{\"name\":\"c4k-jitsi.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-jitsi.js.sha512\"}" \

View file

@ -1,12 +1,12 @@
# convention 4 kubernetes: c4k-shynet # convention 4 kubernetes: c4k-jitsi
[![Clojars Project](https://img.shields.io/clojars/v/org.domaindrivenarchitecture/c4k-shynet.svg)](https://clojars.org/org.domaindrivenarchitecture/c4k-shynet) [![pipeline status](https://gitlab.com/domaindrivenarchitecture/c4k-shynet/badges/master/pipeline.svg)](https://gitlab.com/domaindrivenarchitecture/c4k-shynet/-/commits/main) [![Clojars Project](https://img.shields.io/clojars/v/org.domaindrivenarchitecture/c4k-jitsi.svg)](https://clojars.org/org.domaindrivenarchitecture/c4k-jitsi) [![pipeline status](https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/badges/master/pipeline.svg)](https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/commits/main)
[<img src="https://domaindrivenarchitecture.org/img/delta-chat.svg" width=20 alt="DeltaChat"> chat over e-mail](mailto:buero@meissa-gmbh.de?subject=community-chat) | [<img src="https://meissa-gmbh.de/img/community/Mastodon_Logotype.svg" width=20 alt="team@social.meissa-gmbh.de"> team@social.meissa-gmbh.de](https://social.meissa-gmbh.de/@team) | [Website & Blog](https://domaindrivenarchitecture.org) [<img src="https://domaindrivenarchitecture.org/img/delta-chat.svg" width=20 alt="DeltaChat"> chat over e-mail](mailto:buero@meissa-gmbh.de?subject=community-chat) | [<img src="https://meissa-gmbh.de/img/community/Mastodon_Logotype.svg" width=20 alt="team@social.meissa-gmbh.de"> team@social.meissa-gmbh.de](https://social.meissa-gmbh.de/@team) | [Website & Blog](https://domaindrivenarchitecture.org)
## Purpose ## Purpose
c4k-shynet provides a k8s deployment for shynet containing: c4k-jitsi provides a k8s deployment for jitsi containing:
* shynet * jitsi
* ingress having a letsencrypt managed certificate * ingress having a letsencrypt managed certificate
* postgres database * postgres database
@ -20,14 +20,14 @@ Stable - we use this setup on production.
Click on the image to try out live in your browser: Click on the image to try out live in your browser:
[![Try it out](doc/tryItOut.png "Try out yourself")](https://domaindrivenarchitecture.org/pages/dda-provision/c4k-shynet/) [![Try it out](doc/tryItOut.png "Try out yourself")](https://domaindrivenarchitecture.org/pages/dda-provision/c4k-jitsi/)
Your input will stay in your browser. No server interaction is required. Your input will stay in your browser. No server interaction is required.
You will also be able to try out on cli: You will also be able to try out on cli:
``` ```
target/graalvm/c4k-shynet src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubeval - target/graalvm/c4k-jitsi src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubeval -
target/graalvm/c4k-shynet src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubectl apply -f - target/graalvm/c4k-jitsi src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubectl apply -f -
``` ```
## Documentation ## Documentation

View file

@ -58,15 +58,15 @@ sudo ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin
sudo apt-get install build-essential libz-dev zlib1g-dev sudo apt-get install build-essential libz-dev zlib1g-dev
# build # build
cd ~/repo/dda/c4k-shynet cd ~/repo/dda/c4k-jitsi
lein uberjar lein uberjar
mkdir -p target/graalvm mkdir -p target/graalvm
lein native lein native
# execute # execute
./target/graalvm/c4k-shynet -h ./target/graalvm/c4k-jitsi -h
./target/graalvm/c4k-shynet src/test/resources/valid-config.edn src/test/resources/valid-auth.edn ./target/graalvm/c4k-jitsi src/test/resources/valid-config.edn src/test/resources/valid-auth.edn
./target/graalvm/c4k-shynet src/test/resources/invalid-config.edn src/test/resources/invalid-auth.edn ./target/graalvm/c4k-jitsi src/test/resources/invalid-config.edn src/test/resources/invalid-auth.edn
``` ```
## c4k-setup ## c4k-setup
@ -102,9 +102,9 @@ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@devops.test
kubectl get pods kubectl get pods
``` ```
### deploy shynet ### deploy jitsi
``` ```
java -jar target/uberjar/c4k-shynet-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate - java -jar target/uberjar/c4k-jitsi-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate -
java -jar target/uberjar/c4k-shynet-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f - java -jar target/uberjar/c4k-jitsi-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f -
``` ```

View file

@ -17,7 +17,7 @@ resource "aws_s3_bucket" "backup" {
} }
} }
resource "hcloud_server" "shynet_09_2021" { resource "hcloud_server" "jitsi_09_2021" {
name = "the name" name = "the name"
image = "ubuntu-20.04" image = "ubuntu-20.04"
server_type = "cx31" server_type = "cx31"
@ -31,14 +31,14 @@ resource "hcloud_server" "shynet_09_2021" {
resource "aws_route53_record" "v4_neu" { resource "aws_route53_record" "v4_neu" {
zone_id = the_dns_zone zone_id = the_dns_zone
name = "shynet-neu" name = "jitsi-neu"
type = "A" type = "A"
ttl = "300" ttl = "300"
records = [hcloud_server.shynet_09_2021.ipv4_address] records = [hcloud_server.jitsi_09_2021.ipv4_address]
} }
output "ipv4" { output "ipv4" {
value = hcloud_server.shynet_09_2021.ipv4_address value = hcloud_server.jitsi_09_2021.ipv4_address
} }
``` ```
@ -56,12 +56,12 @@ For k8s installation we use our [dda-k8s-crate](https://github.com/DomainDrivenA
} }
``` ```
## kubectl apply c4k-shynet ## kubectl apply c4k-jitsi
The last step for applying the shynet deployment is The last step for applying the jitsi deployment is
``` ```
c4k-shynet config.edn auth.edn | kubectl apply -f - c4k-jitsi config.edn auth.edn | kubectl apply -f -
``` ```
with the following config.edn: with the following config.edn:

View file

@ -1,18 +1,18 @@
{ {
"name": "c4k-shynet", "name": "c4k-jitsi",
"description": "Generate c4k yaml for a shynet deployment.", "description": "Generate c4k yaml for a jitsi deployment.",
"author": "meissa GmbH", "author": "meissa GmbH",
"version": "1.0.0-SNAPSHOT", "version": "1.0.0-SNAPSHOT",
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet#readme", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-jitsi#readme",
"repository": "https://www.npmjs.com/package/c4k-shynet", "repository": "https://www.npmjs.com/package/c4k-jitsi",
"license": "APACHE2", "license": "APACHE2",
"main": "c4k-shynet.js", "main": "c4k-jitsi.js",
"bin": { "bin": {
"c4k-shynet": "./c4k-shynet.js" "c4k-jitsi": "./c4k-jitsi.js"
}, },
"keywords": [ "keywords": [
"cljs", "cljs",
"shynet", "jitsi",
"k8s", "k8s",
"c4k", "c4k",
"deployment", "deployment",
@ -20,7 +20,7 @@
"convention4kubernetes" "convention4kubernetes"
], ],
"bugs": { "bugs": {
"url": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet/issues" "url": "https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/issues"
}, },
"dependencies": { "dependencies": {
"js-base64": "^3.6.1", "js-base64": "^3.6.1",

View file

@ -1,5 +1,5 @@
(defproject org.domaindrivenarchitecture/c4k-shynet "1.0.0-SNAPSHOT" (defproject org.domaindrivenarchitecture/c4k-jitsi "1.0.0-SNAPSHOT"
:description "shynet c4k-installation package" :description "jitsi c4k-installation package"
:url "https://domaindrivenarchitecture.org" :url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0" :license {:name "Apache License, Version 2.0"
:url "https://www.apache.org/licenses/LICENSE-2.0.html"} :url "https://www.apache.org/licenses/LICENSE-2.0.html"}
@ -20,8 +20,8 @@
:dependencies [[dda/data-test "0.1.1"]]} :dependencies [[dda/data-test "0.1.1"]]}
:dev {:plugins [[lein-shell "0.5.0"]]} :dev {:plugins [[lein-shell "0.5.0"]]}
:uberjar {:aot :all :uberjar {:aot :all
:main dda.c4k-shynet.uberjar :main dda.c4k-jitsi.uberjar
:uberjar-name "c4k-shynet-standalone.jar" :uberjar-name "c4k-jitsi-standalone.jar"
:dependencies [[org.clojure/tools.cli "1.0.206"] :dependencies [[org.clojure/tools.cli "1.0.206"]
[ch.qos.logback/logback-classic "1.3.0-alpha4" [ch.qos.logback/logback-classic "1.3.0-alpha4"
:exclusions [com.sun.mail/javax.mail]] :exclusions [com.sun.mail/javax.mail]]
@ -36,7 +36,7 @@
"native-image" "native-image"
"--report-unsupported-elements-at-runtime" "--report-unsupported-elements-at-runtime"
"--initialize-at-build-time" "--initialize-at-build-time"
"-jar" "target/uberjar/c4k-shynet-standalone.jar" "-jar" "target/uberjar/c4k-jitsi-standalone.jar"
"-H:ResourceConfigurationFiles=graalvm-resource-config.json" "-H:ResourceConfigurationFiles=graalvm-resource-config.json"
"-H:Log=registerResource" "-H:Log=registerResource"
"-H:Name=target/graalvm/${:name}"]}) "-H:Name=target/graalvm/${:name}"]})

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>c4k-shynet</title> <title>c4k-jitsi</title>
<link href="https://domaindrivenarchitecture.org/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="https://domaindrivenarchitecture.org/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://domaindrivenarchitecture.org/css/fonts/fontawesome/fontawesome.css" rel="stylesheet" <link href="https://domaindrivenarchitecture.org/css/fonts/fontawesome/fontawesome.css" rel="stylesheet"
type="text/css" /> type="text/css" />

View file

@ -7,7 +7,7 @@
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "1.0.0"] :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "1.0.0"]
[hickory "0.7.1"]] [hickory "0.7.1"]]
:builds {:frontend {:target :browser :builds {:frontend {:target :browser
:modules {:main {:init-fn dda.c4k-shynet.browser/init}} :modules {:main {:init-fn dda.c4k-jitsi.browser/init}}
:release {} :release {}
:compiler-options {:optimizations :advanced}} :compiler-options {:optimizations :advanced}}
:test {:target :node-test :test {:target :node-test

View file

@ -1,16 +1,16 @@
(ns dda.c4k-shynet.uberjar (ns dda.c4k-jitsi.uberjar
(:gen-class) (:gen-class)
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.string :as cs] [clojure.string :as cs]
[clojure.tools.reader.edn :as edn] [clojure.tools.reader.edn :as edn]
[expound.alpha :as expound] [expound.alpha :as expound]
[dda.c4k-shynet.core :as core])) [dda.c4k-jitsi.core :as core]))
(def usage (def usage
"usage: "usage:
c4k-shynet {your configuraton file} {your authorization file}") c4k-jitsi {your configuraton file} {your authorization file}")
(s/def ::options (s/* #{"-h"})) (s/def ::options (s/* #{"-h"}))
(s/def ::filename (s/and string? (s/def ::filename (s/and string?

View file

@ -1,4 +1,4 @@
(ns dda.c4k-shynet.core (ns dda.c4k-jitsi.core
(:require (:require
[clojure.string :as cs] [clojure.string :as cs]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
@ -6,34 +6,34 @@
:cljs [orchestra.core :refer-macros [defn-spec]]) :cljs [orchestra.core :refer-macros [defn-spec]])
[dda.c4k-common.yaml :as yaml] [dda.c4k-common.yaml :as yaml]
[dda.c4k-common.postgres :as postgres] [dda.c4k-common.postgres :as postgres]
[dda.c4k-shynet.shynet :as shynet])) [dda.c4k-jitsi.jitsi :as jitsi]))
(def config-defaults {:issuer :staging}) (def config-defaults {:issuer :staging})
(def config? (s/keys :req-un [::shynet/fqdn] (def config? (s/keys :req-un [::jitsi/fqdn]
:opt-un [::shynet/issuer ::shynet/ingress-type])) :opt-un [::jitsi/issuer ::jitsi/ingress-type]))
(def auth? (s/keys :req-un [::shynet/django-secret-key (def auth? (s/keys :req-un [::jitsi/django-secret-key
::postgres/postgres-db-user ::postgres/postgres-db-password])) ::postgres/postgres-db-user ::postgres/postgres-db-password]))
(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-config {:postgres-size :2gb :db-name "jitsi"}))
(yaml/to-string (postgres/generate-secret config)) (yaml/to-string (postgres/generate-secret config))
(yaml/to-string (postgres/generate-persistent-volume {:postgres-data-volume-path "/var/postgres"})) (yaml/to-string (postgres/generate-persistent-volume {:postgres-data-volume-path "/var/postgres"}))
(yaml/to-string (postgres/generate-pvc)) (yaml/to-string (postgres/generate-pvc))
(yaml/to-string (postgres/generate-deployment :postgres-image "postgres:14")) (yaml/to-string (postgres/generate-deployment :postgres-image "postgres:14"))
(yaml/to-string (postgres/generate-service))] (yaml/to-string (postgres/generate-service))]
[(yaml/to-string (shynet/generate-secret config)) [(yaml/to-string (jitsi/generate-secret config))
(yaml/to-string (shynet/generate-webserver-deployment)) (yaml/to-string (jitsi/generate-webserver-deployment))
(yaml/to-string (shynet/generate-celeryworker-deployment)) (yaml/to-string (jitsi/generate-celeryworker-deployment))
(yaml/to-string (shynet/generate-ingress config)) (yaml/to-string (jitsi/generate-ingress config))
(yaml/to-string (shynet/generate-certificate config)) (yaml/to-string (jitsi/generate-certificate config))
(yaml/to-string (shynet/generate-service-redis)) (yaml/to-string (jitsi/generate-service-redis))
(yaml/to-string (shynet/generate-service-webserver)) (yaml/to-string (jitsi/generate-service-webserver))
(yaml/to-string (shynet/generate-statefulset))]))) (yaml/to-string (jitsi/generate-statefulset))])))
(defn-spec generate any? (defn-spec generate any?
[my-config config? [my-config config?

View file

@ -1,4 +1,4 @@
(ns dda.c4k-shynet.shynet (ns dda.c4k-jitsi.jitsi
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
#?(:cljs [shadow.resource :as rc]) #?(:cljs [shadow.resource :as rc])
@ -17,21 +17,21 @@
(s/def ::ingress-type ingress-type?) (s/def ::ingress-type ingress-type?)
#?(:cljs #?(:cljs
(defmethod yaml/load-resource :shynet [resource-name] (defmethod yaml/load-resource :jitsi [resource-name]
(case resource-name (case resource-name
"shynet/secret.yaml" (rc/inline "shynet/secret.yaml") "jitsi/secret.yaml" (rc/inline "jitsi/secret.yaml")
"shynet/certificate.yaml" (rc/inline "shynet/certificate.yaml") "jitsi/certificate.yaml" (rc/inline "jitsi/certificate.yaml")
"shynet/deployments.yaml" (rc/inline "shynet/deployments.yaml") "jitsi/deployments.yaml" (rc/inline "jitsi/deployments.yaml")
"shynet/ingress.yaml" (rc/inline "shynet/ingress.yaml") "jitsi/ingress.yaml" (rc/inline "jitsi/ingress.yaml")
"shynet/service-redis.yaml" (rc/inline "shynet/service-redis.yaml") "jitsi/service-redis.yaml" (rc/inline "jitsi/service-redis.yaml")
"shynet/service-webserver.yaml" (rc/inline "shynet/service-webserver.yaml") "jitsi/service-webserver.yaml" (rc/inline "jitsi/service-webserver.yaml")
"shynet/statefulset.yaml" (rc/inline "shynet/statefulset.yaml") "jitsi/statefulset.yaml" (rc/inline "jitsi/statefulset.yaml")
(throw (js/Error. "Undefined Resource!"))))) (throw (js/Error. "Undefined Resource!")))))
(defn generate-secret [config] (defn generate-secret [config]
(let [{:keys [fqdn django-secret-key postgres-db-user postgres-db-password]} config] (let [{:keys [fqdn django-secret-key postgres-db-user postgres-db-password]} config]
(-> (->
(yaml/from-string (yaml/load-resource "shynet/secret.yaml")) (yaml/from-string (yaml/load-resource "jitsi/secret.yaml"))
; See comment in secret.yaml ; See comment in secret.yaml
;(assoc-in [:stringData :ALLOWED_HOSTS] fqdn) ;(assoc-in [:stringData :ALLOWED_HOSTS] fqdn)
(assoc-in [:stringData :DJANGO_SECRET_KEY] django-secret-key) (assoc-in [:stringData :DJANGO_SECRET_KEY] django-secret-key)
@ -42,21 +42,21 @@
(let [{:keys [fqdn issuer]} config (let [{:keys [fqdn issuer]} config
letsencrypt-issuer (str "letsencrypt-" (name issuer) "-issuer")] letsencrypt-issuer (str "letsencrypt-" (name issuer) "-issuer")]
(-> (->
(yaml/from-string (yaml/load-resource "shynet/certificate.yaml")) (yaml/from-string (yaml/load-resource "jitsi/certificate.yaml"))
(assoc-in [:spec :commonName] fqdn) (assoc-in [:spec :commonName] fqdn)
(assoc-in [:spec :dnsNames] [fqdn]) (assoc-in [:spec :dnsNames] [fqdn])
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer)))) (assoc-in [:spec :issuerRef :name] letsencrypt-issuer))))
(defn generate-webserver-deployment [] (defn generate-webserver-deployment []
(let [shynet-application "shynet-webserver"] (let [jitsi-application "jitsi-webserver"]
(-> (yaml/from-string (yaml/load-resource "shynet/deployments.yaml")) (-> (yaml/from-string (yaml/load-resource "jitsi/deployments.yaml"))
(cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application) (cm/replace-all-matching-values-by-new-value "jitsi-application" jitsi-application)
(update-in [:spec :template :spec :containers 0] dissoc :command)))) (update-in [:spec :template :spec :containers 0] dissoc :command))))
(defn generate-celeryworker-deployment [] (defn generate-celeryworker-deployment []
(let [shynet-application "shynet-celeryworker"] (let [jitsi-application "jitsi-celeryworker"]
(-> (yaml/from-string (yaml/load-resource "shynet/deployments.yaml")) (-> (yaml/from-string (yaml/load-resource "jitsi/deployments.yaml"))
(cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application)))) (cm/replace-all-matching-values-by-new-value "jitsi-application" jitsi-application))))
(defn generate-ingress [config] (defn generate-ingress [config]
(let [{:keys [fqdn issuer ingress-type] (let [{:keys [fqdn issuer ingress-type]
@ -64,16 +64,16 @@
letsencrypt-issuer (str "letsencrypt-" (name issuer) "-issuer") letsencrypt-issuer (str "letsencrypt-" (name issuer) "-issuer")
ingress-kind (if (= :default ingress-type) "" (name ingress-type))] ingress-kind (if (= :default ingress-type) "" (name ingress-type))]
(-> (->
(yaml/from-string (yaml/load-resource "shynet/ingress.yaml")) (yaml/from-string (yaml/load-resource "jitsi/ingress.yaml"))
(assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer) (assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer)
(assoc-in [:metadata :annotations :kubernetes.io/ingress.class] ingress-kind) (assoc-in [:metadata :annotations :kubernetes.io/ingress.class] ingress-kind)
(cm/replace-all-matching-values-by-new-value "fqdn" fqdn)))) (cm/replace-all-matching-values-by-new-value "fqdn" fqdn))))
(defn generate-statefulset [] (defn generate-statefulset []
(yaml/from-string (yaml/load-resource "shynet/statefulset.yaml"))) (yaml/from-string (yaml/load-resource "jitsi/statefulset.yaml")))
(defn generate-service-redis [] (defn generate-service-redis []
(yaml/from-string (yaml/load-resource "shynet/service-redis.yaml"))) (yaml/from-string (yaml/load-resource "jitsi/service-redis.yaml")))
(defn generate-service-webserver [] (defn generate-service-webserver []
(yaml/from-string (yaml/load-resource "shynet/service-webserver.yaml"))) (yaml/from-string (yaml/load-resource "jitsi/service-webserver.yaml")))

View file

@ -1,25 +1,25 @@
(ns dda.c4k-shynet.browser (ns dda.c4k-jitsi.browser
(:require (:require
[clojure.tools.reader.edn :as edn] [clojure.tools.reader.edn :as edn]
[dda.c4k-shynet.core :as core] [dda.c4k-jitsi.core :as core]
[dda.c4k-shynet.shynet :as shynet] [dda.c4k-jitsi.jitsi :as jitsi]
[dda.c4k-common.browser :as br] [dda.c4k-common.browser :as br]
[dda.c4k-common.postgres :as pgc])) [dda.c4k-common.postgres :as pgc]))
(defn generate-content (defn generate-content
[] []
(into [] (concat [(assoc (br/generate-needs-validation) :content (into [] (concat [(assoc (br/generate-needs-validation) :content
(into [] (concat (br/generate-input-field "fqdn" "Your fqdn:" "shynet.prod.meissa-gmbh.de") (into [] (concat (br/generate-input-field "fqdn" "Your fqdn:" "jitsi.prod.meissa-gmbh.de")
(br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres") (br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres")
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "") (br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")
[(br/generate-br)] [(br/generate-br)]
(br/generate-text-area "auth" "Your auth.edn:" "{:postgres-db-user \"shynet\" (br/generate-text-area "auth" "Your auth.edn:" "{:postgres-db-user \"jitsi\"
:postgres-db-password \"shynet-db-password\" :postgres-db-password \"jitsi-db-password\"
:django-secret-key \"djangosecretkey\"}" :django-secret-key \"djangosecretkey\"}"
"5") "5")
[(br/generate-br)] [(br/generate-br)]
(br/generate-button "generate-button" "Generate c4k yaml"))))] (br/generate-button "generate-button" "Generate c4k yaml"))))]
(br/generate-output "c4k-shynet-output" "Your c4k deployment.yaml:" "25")))) (br/generate-output "c4k-jitsi-output" "Your c4k deployment.yaml:" "25"))))
(defn generate-content-div (defn generate-content-div
[] []
@ -40,9 +40,9 @@
))) )))
(defn validate-all! [] (defn validate-all! []
(br/validate! "fqdn" ::shynet/fqdn) (br/validate! "fqdn" ::jitsi/fqdn)
(br/validate! "postgres-data-volume-path" ::pgc/postgres-data-volume-path :optional true) (br/validate! "postgres-data-volume-path" ::pgc/postgres-data-volume-path :optional true)
(br/validate! "issuer" ::shynet/issuer :optional true :deserializer keyword) (br/validate! "issuer" ::jitsi/issuer :optional true :deserializer keyword)
(br/validate! "auth" core/auth? :deserializer edn/read-string) (br/validate! "auth" core/auth? :deserializer edn/read-string)
(br/set-validated!)) (br/set-validated!))

View file

@ -1,10 +1,10 @@
apiVersion: cert-manager.io/v1 apiVersion: cert-manager.io/v1
kind: Certificate kind: Certificate
metadata: metadata:
name: shynet-cert name: jitsi-cert
namespace: default namespace: default
spec: spec:
secretName: shynet-secret secretName: jitsi-secret
commonName: fqdn commonName: fqdn
dnsNames: dnsNames:
- fqdn - fqdn

View file

@ -1,27 +1,27 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: shynet-application name: jitsi-application
namespace: default namespace: default
labels: labels:
app: shynet-application app: jitsi-application
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: shynet-application app: jitsi-application
strategy: strategy:
type: Recreate type: Recreate
replicas: 1 replicas: 1
template: template:
metadata: metadata:
labels: labels:
app: shynet-application app: jitsi-application
spec: spec:
containers: containers:
- name: shynet-application - name: jitsi-application
image: milesmcc/shynet:v0.12.0 image: milesmcc/jitsi:v0.12.0
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
command: ["./celeryworker.sh"] command: ["./celeryworker.sh"]
envFrom: envFrom:
- secretRef: - secretRef:
name: shynet-settings name: jitsi-settings

View file

@ -1,7 +1,7 @@
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: shynet-webserver-ingress name: jitsi-webserver-ingress
annotations: annotations:
cert-manager.io/cluster-issuer: letsencrypt-staging-issuer cert-manager.io/cluster-issuer: letsencrypt-staging-issuer
nginx.ingress.kubernetes.io/proxy-body-size: "256m" nginx.ingress.kubernetes.io/proxy-body-size: "256m"
@ -14,14 +14,14 @@ spec:
tls: tls:
- hosts: - hosts:
- fqdn - fqdn
secretName: shynet-secret secretName: jitsi-secret
rules: rules:
- host: fqdn - host: fqdn
http: http:
paths: paths:
- backend: - backend:
service: service:
name: shynet-webserver-service name: jitsi-webserver-service
port: port:
number: 8080 number: 8080
path: / path: /

View file

@ -1,14 +1,14 @@
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: shynet-settings name: jitsi-settings
type: Opaque type: Opaque
stringData: stringData:
# Django settings # Django settings
DEBUG: "False" DEBUG: "False"
# This is hidden behind ingress and (presumably) only works if it has access to # This is hidden behind ingress and (presumably) only works if it has access to
# all shynet pods and services # all jitsi pods and services
# If this is not set to '*' there is 404 on every webpage # If this is not set to '*' there is 404 on every webpage
ALLOWED_HOSTS: "*" # For better security, set this to your deployment's domain. Comma separated. ALLOWED_HOSTS: "*" # For better security, set this to your deployment's domain. Comma separated.
DJANGO_SECRET_KEY: django-secret-key DJANGO_SECRET_KEY: django-secret-key
@ -16,11 +16,11 @@ stringData:
TIME_ZONE: "America/New_York" TIME_ZONE: "America/New_York"
# Redis configuration (if you use the default Kubernetes config, this will work) # Redis configuration (if you use the default Kubernetes config, this will work)
REDIS_CACHE_LOCATION: "redis://shynet-redis.default.svc.cluster.local/0" REDIS_CACHE_LOCATION: "redis://jitsi-redis.default.svc.cluster.local/0"
CELERY_BROKER_URL: "redis://shynet-redis.default.svc.cluster.local/1" CELERY_BROKER_URL: "redis://jitsi-redis.default.svc.cluster.local/1"
# PostgreSQL settings # PostgreSQL settings
DB_NAME: "shynet" DB_NAME: "jitsi"
DB_USER: postgres-db-user DB_USER: postgres-db-user
DB_PASSWORD: postgres-db-password DB_PASSWORD: postgres-db-password
DB_HOST: "postgresql-service" DB_HOST: "postgresql-service"
@ -29,4 +29,4 @@ stringData:
EMAIL_HOST_USER: "" EMAIL_HOST_USER: ""
EMAIL_HOST_PASSWORD: "" EMAIL_HOST_PASSWORD: ""
EMAIL_HOST: "" EMAIL_HOST: ""
SERVER_EMAIL: "Shynet <noreply@shynet.example.com>" SERVER_EMAIL: "jitsi <noreply@jitsi.example.com>"

View file

@ -1,11 +1,11 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: shynet-redis name: jitsi-redis
spec: spec:
ports: ports:
- port: 6379 - port: 6379
name: redis name: redis
clusterIP: None clusterIP: None
selector: selector:
app: shynet-redis app: jitsi-redis

View file

@ -1,10 +1,10 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: shynet-webserver-service name: jitsi-webserver-service
spec: spec:
type: ClusterIP type: ClusterIP
ports: ports:
- port: 8080 - port: 8080
selector: selector:
app: shynet-webserver app: jitsi-webserver

View file

@ -1,20 +1,20 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: shynet-redis name: jitsi-redis
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: shynet-redis app: jitsi-redis
serviceName: shynet-redis serviceName: jitsi-redis
replicas: 1 replicas: 1
template: template:
metadata: metadata:
labels: labels:
app: shynet-redis app: jitsi-redis
spec: spec:
containers: containers:
- name: shynet-redis - name: jitsi-redis
image: redis:6.2.6 image: redis:6.2.6
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:

View file

@ -1,59 +1,59 @@
(ns dda.c4k-shynet.shynet-test (ns dda.c4k-jitsi.jitsi-test
(: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]])
[dda.c4k-shynet.shynet :as cut])) [dda.c4k-jitsi.jitsi :as cut]))
(deftest should-generate-webserver-deployment (deftest should-generate-webserver-deployment
(is (= {:apiVersion "apps/v1" (is (= {:apiVersion "apps/v1"
:kind "Deployment" :kind "Deployment"
:metadata :metadata
{:name "shynet-webserver" {:name "jitsi-webserver"
:namespace "default" :namespace "default"
:labels {:app "shynet-webserver"}} :labels {:app "jitsi-webserver"}}
:spec :spec
{:selector {:matchLabels {:app "shynet-webserver"}} {:selector {:matchLabels {:app "jitsi-webserver"}}
:strategy {:type "Recreate"} :strategy {:type "Recreate"}
:replicas 1 :replicas 1
:template :template
{:metadata {:labels {:app "shynet-webserver"}} {:metadata {:labels {:app "jitsi-webserver"}}
:spec :spec
{:containers {:containers
[{:name "shynet-webserver" [{:name "jitsi-webserver"
:image "milesmcc/shynet:v0.12.0" :image "milesmcc/jitsi:v0.12.0"
:imagePullPolicy "IfNotPresent" :imagePullPolicy "IfNotPresent"
:envFrom [{:secretRef {:name "shynet-settings"}}]}]}}}} :envFrom [{:secretRef {:name "jitsi-settings"}}]}]}}}}
(cut/generate-webserver-deployment)))) (cut/generate-webserver-deployment))))
(deftest should-generate-celeryworker-deployment (deftest should-generate-celeryworker-deployment
(is (= {:apiVersion "apps/v1" (is (= {:apiVersion "apps/v1"
:kind "Deployment" :kind "Deployment"
:metadata :metadata
{:name "shynet-celeryworker" {:name "jitsi-celeryworker"
:namespace "default" :namespace "default"
:labels {:app "shynet-celeryworker"}} :labels {:app "jitsi-celeryworker"}}
:spec :spec
{:selector {:matchLabels {:app "shynet-celeryworker"}} {:selector {:matchLabels {:app "jitsi-celeryworker"}}
:strategy {:type "Recreate"} :strategy {:type "Recreate"}
:replicas 1 :replicas 1
:template :template
{:metadata {:labels {:app "shynet-celeryworker"}} {:metadata {:labels {:app "jitsi-celeryworker"}}
:spec :spec
{:containers {:containers
[{:name "shynet-celeryworker" [{:name "jitsi-celeryworker"
:image "milesmcc/shynet:v0.12.0" :image "milesmcc/jitsi:v0.12.0"
:imagePullPolicy "IfNotPresent" :imagePullPolicy "IfNotPresent"
:command ["./celeryworker.sh"] :command ["./celeryworker.sh"]
:envFrom [{:secretRef {:name "shynet-settings"}}]}]}}}} :envFrom [{:secretRef {:name "jitsi-settings"}}]}]}}}}
(cut/generate-celeryworker-deployment)))) (cut/generate-celeryworker-deployment))))
(deftest should-generate-certificate (deftest should-generate-certificate
(is (= {:apiVersion "cert-manager.io/v1" (is (= {:apiVersion "cert-manager.io/v1"
:kind "Certificate" :kind "Certificate"
:metadata {:name "shynet-cert", :namespace "default"} :metadata {:name "jitsi-cert", :namespace "default"}
:spec :spec
{:secretName "shynet-secret" {:secretName "jitsi-secret"
:commonName "test.com" :commonName "test.com"
:dnsNames ["test.com"] :dnsNames ["test.com"]
:issuerRef {:name "letsencrypt-staging-issuer", :kind "ClusterIssuer"}}} :issuerRef {:name "letsencrypt-staging-issuer", :kind "ClusterIssuer"}}}
@ -63,7 +63,7 @@
(is (= {:apiVersion "networking.k8s.io/v1" (is (= {:apiVersion "networking.k8s.io/v1"
:kind "Ingress" :kind "Ingress"
:metadata :metadata
{:name "shynet-webserver-ingress" {:name "jitsi-webserver-ingress"
:annotations :annotations
{:cert-manager.io/cluster-issuer "letsencrypt-staging-issuer" {:cert-manager.io/cluster-issuer "letsencrypt-staging-issuer"
:nginx.ingress.kubernetes.io/proxy-body-size "256m" :nginx.ingress.kubernetes.io/proxy-body-size "256m"
@ -73,17 +73,17 @@
:nginx.ingress.kubernetes.io/proxy-send-timeout "300" :nginx.ingress.kubernetes.io/proxy-send-timeout "300"
:nginx.ingress.kubernetes.io/proxy-read-timeout "300"}} :nginx.ingress.kubernetes.io/proxy-read-timeout "300"}}
:spec :spec
{:tls [{:hosts ["test.com"], :secretName "shynet-secret"}] {:tls [{:hosts ["test.com"], :secretName "jitsi-secret"}]
:rules :rules
[{:host "test.com" [{:host "test.com"
:http {:paths [{:backend {:service :http {:paths [{:backend {:service
{:name "shynet-webserver-service" :port {:number 8080}}}, :path "/", :pathType "Prefix"}]}}]}} {:name "jitsi-webserver-service" :port {:number 8080}}}, :path "/", :pathType "Prefix"}]}}]}}
(cut/generate-ingress {:fqdn "test.com" :issuer :staging})))) (cut/generate-ingress {:fqdn "test.com" :issuer :staging}))))
(deftest should-generate-secret (deftest should-generate-secret
(is (= {:apiVersion "v1" (is (= {:apiVersion "v1"
:kind "Secret" :kind "Secret"
:metadata {:name "shynet-settings"} :metadata {:name "jitsi-settings"}
:type "Opaque" :type "Opaque"
:stringData :stringData
{:DEBUG "False" {:DEBUG "False"
@ -92,16 +92,16 @@
:ACCOUNT_SIGNUPS_ENABLED "False" :ACCOUNT_SIGNUPS_ENABLED "False"
:TIME_ZONE "America/New_York" :TIME_ZONE "America/New_York"
:REDIS_CACHE_LOCATION :REDIS_CACHE_LOCATION
"redis://shynet-redis.default.svc.cluster.local/0" "redis://jitsi-redis.default.svc.cluster.local/0"
:CELERY_BROKER_URL :CELERY_BROKER_URL
"redis://shynet-redis.default.svc.cluster.local/1" "redis://jitsi-redis.default.svc.cluster.local/1"
:DB_NAME "shynet" :DB_NAME "jitsi"
:DB_USER "postgres-user" :DB_USER "postgres-user"
:DB_PASSWORD "postgres-pw" :DB_PASSWORD "postgres-pw"
:DB_HOST "postgresql-service" :DB_HOST "postgresql-service"
:EMAIL_HOST_USER "" :EMAIL_HOST_USER ""
:EMAIL_HOST_PASSWORD "" :EMAIL_HOST_PASSWORD ""
:EMAIL_HOST "" :EMAIL_HOST ""
:SERVER_EMAIL "Shynet <noreply@shynet.example.com>"}} :SERVER_EMAIL "jitsi <noreply@jitsi.example.com>"}}
(cut/generate-secret {:fqdn "test.com" :django-secret-key "django-pw" (cut/generate-secret {:fqdn "test.com" :django-secret-key "django-pw"
:postgres-db-user "postgres-user" :postgres-db-password "postgres-pw"})))) :postgres-db-user "postgres-user" :postgres-db-password "postgres-pw"}))))

View file

@ -1,3 +1,3 @@
{:django-secret-key "django" {:django-secret-key "django"
:postgres-db-user "shynet" :postgres-db-user "jitsi"
:postgres-db-password "shynet-db-password"} :postgres-db-password "jitsi-db-password"}