rename everything from shynet to jitsi
This commit is contained in:
parent
532e611e68
commit
bac553135d
21 changed files with 150 additions and 150 deletions
|
@ -47,7 +47,7 @@ test-schema:
|
|||
stage: build_and_test
|
||||
script:
|
||||
- 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:
|
||||
paths:
|
||||
- target/uberjar
|
||||
|
@ -68,9 +68,9 @@ package-frontend:
|
|||
script:
|
||||
- mkdir -p target/frontend-build
|
||||
- shadow-cljs release frontend
|
||||
- cp public/js/main.js target/frontend-build/c4k-shynet.js
|
||||
- sha256sum target/frontend-build/c4k-shynet.js > target/frontend-build/c4k-shynet.js.sha256
|
||||
- sha512sum target/frontend-build/c4k-shynet.js > target/frontend-build/c4k-shynet.js.sha512
|
||||
- cp public/js/main.js target/frontend-build/c4k-jitsi.js
|
||||
- sha256sum target/frontend-build/c4k-jitsi.js > target/frontend-build/c4k-jitsi.js.sha256
|
||||
- sha512sum target/frontend-build/c4k-jitsi.js > target/frontend-build/c4k-jitsi.js.sha512
|
||||
artifacts:
|
||||
paths:
|
||||
- target/frontend-build
|
||||
|
@ -79,8 +79,8 @@ package-uberjar:
|
|||
<<: *clj
|
||||
stage: package
|
||||
script:
|
||||
- sha256sum target/uberjar/c4k-shynet-standalone.jar > target/uberjar/c4k-shynet-standalone.jar.sha256
|
||||
- sha512sum target/uberjar/c4k-shynet-standalone.jar > target/uberjar/c4k-shynet-standalone.jar.sha512
|
||||
- sha256sum target/uberjar/c4k-jitsi-standalone.jar > target/uberjar/c4k-jitsi-standalone.jar.sha256
|
||||
- sha512sum target/uberjar/c4k-jitsi-standalone.jar > target/uberjar/c4k-jitsi-standalone.jar.sha512
|
||||
artifacts:
|
||||
paths:
|
||||
- target/uberjar
|
||||
|
@ -117,9 +117,9 @@ release:
|
|||
- apk --no-cache add curl
|
||||
- |
|
||||
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-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-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-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-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-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-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-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-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-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-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-jitsi.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-jitsi.js.sha512\"}" \
|
||||
|
|
14
README.md
14
README.md
|
@ -1,12 +1,12 @@
|
|||
# convention 4 kubernetes: c4k-shynet
|
||||
[![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)
|
||||
# convention 4 kubernetes: c4k-jitsi
|
||||
[![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)
|
||||
|
||||
## Purpose
|
||||
|
||||
c4k-shynet provides a k8s deployment for shynet containing:
|
||||
* shynet
|
||||
c4k-jitsi provides a k8s deployment for jitsi containing:
|
||||
* jitsi
|
||||
* ingress having a letsencrypt managed certificate
|
||||
* postgres database
|
||||
|
||||
|
@ -20,14 +20,14 @@ Stable - we use this setup on production.
|
|||
|
||||
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.
|
||||
|
||||
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-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 | kubeval -
|
||||
target/graalvm/c4k-jitsi src/test/resources/valid-config.edn src/test/resources/valid-auth.edn | kubectl apply -f -
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
|
|
@ -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
|
||||
|
||||
# build
|
||||
cd ~/repo/dda/c4k-shynet
|
||||
cd ~/repo/dda/c4k-jitsi
|
||||
lein uberjar
|
||||
mkdir -p target/graalvm
|
||||
lein native
|
||||
|
||||
# execute
|
||||
./target/graalvm/c4k-shynet -h
|
||||
./target/graalvm/c4k-shynet 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 -h
|
||||
./target/graalvm/c4k-jitsi src/test/resources/valid-config.edn src/test/resources/valid-auth.edn
|
||||
./target/graalvm/c4k-jitsi src/test/resources/invalid-config.edn src/test/resources/invalid-auth.edn
|
||||
```
|
||||
|
||||
## c4k-setup
|
||||
|
@ -102,9 +102,9 @@ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@devops.test
|
|||
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-shynet-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f -
|
||||
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-jitsi-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f -
|
||||
```
|
||||
|
|
|
@ -17,7 +17,7 @@ resource "aws_s3_bucket" "backup" {
|
|||
}
|
||||
}
|
||||
|
||||
resource "hcloud_server" "shynet_09_2021" {
|
||||
resource "hcloud_server" "jitsi_09_2021" {
|
||||
name = "the name"
|
||||
image = "ubuntu-20.04"
|
||||
server_type = "cx31"
|
||||
|
@ -31,14 +31,14 @@ resource "hcloud_server" "shynet_09_2021" {
|
|||
|
||||
resource "aws_route53_record" "v4_neu" {
|
||||
zone_id = the_dns_zone
|
||||
name = "shynet-neu"
|
||||
name = "jitsi-neu"
|
||||
type = "A"
|
||||
ttl = "300"
|
||||
records = [hcloud_server.shynet_09_2021.ipv4_address]
|
||||
records = [hcloud_server.jitsi_09_2021.ipv4_address]
|
||||
}
|
||||
|
||||
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:
|
||||
|
|
16
package.json
16
package.json
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"name": "c4k-shynet",
|
||||
"description": "Generate c4k yaml for a shynet deployment.",
|
||||
"name": "c4k-jitsi",
|
||||
"description": "Generate c4k yaml for a jitsi deployment.",
|
||||
"author": "meissa GmbH",
|
||||
"version": "1.0.0-SNAPSHOT",
|
||||
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet#readme",
|
||||
"repository": "https://www.npmjs.com/package/c4k-shynet",
|
||||
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-jitsi#readme",
|
||||
"repository": "https://www.npmjs.com/package/c4k-jitsi",
|
||||
"license": "APACHE2",
|
||||
"main": "c4k-shynet.js",
|
||||
"main": "c4k-jitsi.js",
|
||||
"bin": {
|
||||
"c4k-shynet": "./c4k-shynet.js"
|
||||
"c4k-jitsi": "./c4k-jitsi.js"
|
||||
},
|
||||
"keywords": [
|
||||
"cljs",
|
||||
"shynet",
|
||||
"jitsi",
|
||||
"k8s",
|
||||
"c4k",
|
||||
"deployment",
|
||||
|
@ -20,7 +20,7 @@
|
|||
"convention4kubernetes"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/domaindrivenarchitecture/c4k-shynet/issues"
|
||||
"url": "https://gitlab.com/domaindrivenarchitecture/c4k-jitsi/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"js-base64": "^3.6.1",
|
||||
|
|
10
project.clj
10
project.clj
|
@ -1,5 +1,5 @@
|
|||
(defproject org.domaindrivenarchitecture/c4k-shynet "1.0.0-SNAPSHOT"
|
||||
:description "shynet c4k-installation package"
|
||||
(defproject org.domaindrivenarchitecture/c4k-jitsi "1.0.0-SNAPSHOT"
|
||||
:description "jitsi c4k-installation package"
|
||||
:url "https://domaindrivenarchitecture.org"
|
||||
:license {:name "Apache License, Version 2.0"
|
||||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||
|
@ -20,8 +20,8 @@
|
|||
:dependencies [[dda/data-test "0.1.1"]]}
|
||||
:dev {:plugins [[lein-shell "0.5.0"]]}
|
||||
:uberjar {:aot :all
|
||||
:main dda.c4k-shynet.uberjar
|
||||
:uberjar-name "c4k-shynet-standalone.jar"
|
||||
:main dda.c4k-jitsi.uberjar
|
||||
:uberjar-name "c4k-jitsi-standalone.jar"
|
||||
:dependencies [[org.clojure/tools.cli "1.0.206"]
|
||||
[ch.qos.logback/logback-classic "1.3.0-alpha4"
|
||||
:exclusions [com.sun.mail/javax.mail]]
|
||||
|
@ -36,7 +36,7 @@
|
|||
"native-image"
|
||||
"--report-unsupported-elements-at-runtime"
|
||||
"--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:Log=registerResource"
|
||||
"-H:Name=target/graalvm/${:name}"]})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<head>
|
||||
<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/fonts/fontawesome/fontawesome.css" rel="stylesheet"
|
||||
type="text/css" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "1.0.0"]
|
||||
[hickory "0.7.1"]]
|
||||
:builds {:frontend {:target :browser
|
||||
:modules {:main {:init-fn dda.c4k-shynet.browser/init}}
|
||||
:modules {:main {:init-fn dda.c4k-jitsi.browser/init}}
|
||||
:release {}
|
||||
:compiler-options {:optimizations :advanced}}
|
||||
:test {:target :node-test
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
(ns dda.c4k-shynet.uberjar
|
||||
(ns dda.c4k-jitsi.uberjar
|
||||
(:gen-class)
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as cs]
|
||||
[clojure.tools.reader.edn :as edn]
|
||||
[expound.alpha :as expound]
|
||||
[dda.c4k-shynet.core :as core]))
|
||||
[dda.c4k-jitsi.core :as core]))
|
||||
|
||||
(def 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 ::filename (s/and string?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(ns dda.c4k-shynet.core
|
||||
(ns dda.c4k-jitsi.core
|
||||
(:require
|
||||
[clojure.string :as cs]
|
||||
[clojure.spec.alpha :as s]
|
||||
|
@ -6,34 +6,34 @@
|
|||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||
[dda.c4k-common.yaml :as yaml]
|
||||
[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? (s/keys :req-un [::shynet/fqdn]
|
||||
:opt-un [::shynet/issuer ::shynet/ingress-type]))
|
||||
(def config? (s/keys :req-un [::jitsi/fqdn]
|
||||
: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]))
|
||||
|
||||
(defn k8s-objects [config]
|
||||
(into
|
||||
[]
|
||||
(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-persistent-volume {:postgres-data-volume-path "/var/postgres"}))
|
||||
(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 (shynet/generate-secret config))
|
||||
(yaml/to-string (shynet/generate-webserver-deployment))
|
||||
(yaml/to-string (shynet/generate-celeryworker-deployment))
|
||||
(yaml/to-string (shynet/generate-ingress config))
|
||||
(yaml/to-string (shynet/generate-certificate config))
|
||||
(yaml/to-string (shynet/generate-service-redis))
|
||||
(yaml/to-string (shynet/generate-service-webserver))
|
||||
(yaml/to-string (shynet/generate-statefulset))])))
|
||||
[(yaml/to-string (jitsi/generate-secret config))
|
||||
(yaml/to-string (jitsi/generate-webserver-deployment))
|
||||
(yaml/to-string (jitsi/generate-celeryworker-deployment))
|
||||
(yaml/to-string (jitsi/generate-ingress config))
|
||||
(yaml/to-string (jitsi/generate-certificate config))
|
||||
(yaml/to-string (jitsi/generate-service-redis))
|
||||
(yaml/to-string (jitsi/generate-service-webserver))
|
||||
(yaml/to-string (jitsi/generate-statefulset))])))
|
||||
|
||||
(defn-spec generate any?
|
||||
[my-config config?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(ns dda.c4k-shynet.shynet
|
||||
(ns dda.c4k-jitsi.jitsi
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
#?(:cljs [shadow.resource :as rc])
|
||||
|
@ -17,21 +17,21 @@
|
|||
(s/def ::ingress-type ingress-type?)
|
||||
|
||||
#?(:cljs
|
||||
(defmethod yaml/load-resource :shynet [resource-name]
|
||||
(defmethod yaml/load-resource :jitsi [resource-name]
|
||||
(case resource-name
|
||||
"shynet/secret.yaml" (rc/inline "shynet/secret.yaml")
|
||||
"shynet/certificate.yaml" (rc/inline "shynet/certificate.yaml")
|
||||
"shynet/deployments.yaml" (rc/inline "shynet/deployments.yaml")
|
||||
"shynet/ingress.yaml" (rc/inline "shynet/ingress.yaml")
|
||||
"shynet/service-redis.yaml" (rc/inline "shynet/service-redis.yaml")
|
||||
"shynet/service-webserver.yaml" (rc/inline "shynet/service-webserver.yaml")
|
||||
"shynet/statefulset.yaml" (rc/inline "shynet/statefulset.yaml")
|
||||
"jitsi/secret.yaml" (rc/inline "jitsi/secret.yaml")
|
||||
"jitsi/certificate.yaml" (rc/inline "jitsi/certificate.yaml")
|
||||
"jitsi/deployments.yaml" (rc/inline "jitsi/deployments.yaml")
|
||||
"jitsi/ingress.yaml" (rc/inline "jitsi/ingress.yaml")
|
||||
"jitsi/service-redis.yaml" (rc/inline "jitsi/service-redis.yaml")
|
||||
"jitsi/service-webserver.yaml" (rc/inline "jitsi/service-webserver.yaml")
|
||||
"jitsi/statefulset.yaml" (rc/inline "jitsi/statefulset.yaml")
|
||||
(throw (js/Error. "Undefined Resource!")))))
|
||||
|
||||
(defn generate-secret [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
|
||||
;(assoc-in [:stringData :ALLOWED_HOSTS] fqdn)
|
||||
(assoc-in [:stringData :DJANGO_SECRET_KEY] django-secret-key)
|
||||
|
@ -42,21 +42,21 @@
|
|||
(let [{:keys [fqdn issuer]} config
|
||||
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 :dnsNames] [fqdn])
|
||||
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer))))
|
||||
|
||||
(defn generate-webserver-deployment []
|
||||
(let [shynet-application "shynet-webserver"]
|
||||
(-> (yaml/from-string (yaml/load-resource "shynet/deployments.yaml"))
|
||||
(cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application)
|
||||
(let [jitsi-application "jitsi-webserver"]
|
||||
(-> (yaml/from-string (yaml/load-resource "jitsi/deployments.yaml"))
|
||||
(cm/replace-all-matching-values-by-new-value "jitsi-application" jitsi-application)
|
||||
(update-in [:spec :template :spec :containers 0] dissoc :command))))
|
||||
|
||||
(defn generate-celeryworker-deployment []
|
||||
(let [shynet-application "shynet-celeryworker"]
|
||||
(-> (yaml/from-string (yaml/load-resource "shynet/deployments.yaml"))
|
||||
(cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application))))
|
||||
(let [jitsi-application "jitsi-celeryworker"]
|
||||
(-> (yaml/from-string (yaml/load-resource "jitsi/deployments.yaml"))
|
||||
(cm/replace-all-matching-values-by-new-value "jitsi-application" jitsi-application))))
|
||||
|
||||
(defn generate-ingress [config]
|
||||
(let [{:keys [fqdn issuer ingress-type]
|
||||
|
@ -64,16 +64,16 @@
|
|||
letsencrypt-issuer (str "letsencrypt-" (name issuer) "-issuer")
|
||||
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 :kubernetes.io/ingress.class] ingress-kind)
|
||||
(cm/replace-all-matching-values-by-new-value "fqdn" fqdn))))
|
||||
|
||||
(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 []
|
||||
(yaml/from-string (yaml/load-resource "shynet/service-redis.yaml")))
|
||||
(yaml/from-string (yaml/load-resource "jitsi/service-redis.yaml")))
|
||||
|
||||
(defn generate-service-webserver []
|
||||
(yaml/from-string (yaml/load-resource "shynet/service-webserver.yaml")))
|
||||
(yaml/from-string (yaml/load-resource "jitsi/service-webserver.yaml")))
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
(ns dda.c4k-shynet.browser
|
||||
(ns dda.c4k-jitsi.browser
|
||||
(:require
|
||||
[clojure.tools.reader.edn :as edn]
|
||||
[dda.c4k-shynet.core :as core]
|
||||
[dda.c4k-shynet.shynet :as shynet]
|
||||
[dda.c4k-jitsi.core :as core]
|
||||
[dda.c4k-jitsi.jitsi :as jitsi]
|
||||
[dda.c4k-common.browser :as br]
|
||||
[dda.c4k-common.postgres :as pgc]))
|
||||
|
||||
(defn generate-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 "issuer" "(Optional) Your issuer prod/staging:" "")
|
||||
[(br/generate-br)]
|
||||
(br/generate-text-area "auth" "Your auth.edn:" "{:postgres-db-user \"shynet\"
|
||||
:postgres-db-password \"shynet-db-password\"
|
||||
(br/generate-text-area "auth" "Your auth.edn:" "{:postgres-db-user \"jitsi\"
|
||||
:postgres-db-password \"jitsi-db-password\"
|
||||
:django-secret-key \"djangosecretkey\"}"
|
||||
"5")
|
||||
[(br/generate-br)]
|
||||
(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
|
||||
[]
|
||||
|
@ -40,9 +40,9 @@
|
|||
)))
|
||||
|
||||
(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! "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/set-validated!))
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: shynet-cert
|
||||
name: jitsi-cert
|
||||
namespace: default
|
||||
spec:
|
||||
secretName: shynet-secret
|
||||
secretName: jitsi-secret
|
||||
commonName: fqdn
|
||||
dnsNames:
|
||||
- fqdn
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: shynet-application
|
||||
name: jitsi-application
|
||||
namespace: default
|
||||
labels:
|
||||
app: shynet-application
|
||||
app: jitsi-application
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: shynet-application
|
||||
app: jitsi-application
|
||||
strategy:
|
||||
type: Recreate
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: shynet-application
|
||||
app: jitsi-application
|
||||
spec:
|
||||
containers:
|
||||
- name: shynet-application
|
||||
image: milesmcc/shynet:v0.12.0
|
||||
- name: jitsi-application
|
||||
image: milesmcc/jitsi:v0.12.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ["./celeryworker.sh"]
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: shynet-settings
|
||||
name: jitsi-settings
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: shynet-webserver-ingress
|
||||
name: jitsi-webserver-ingress
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt-staging-issuer
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: "256m"
|
||||
|
@ -14,14 +14,14 @@ spec:
|
|||
tls:
|
||||
- hosts:
|
||||
- fqdn
|
||||
secretName: shynet-secret
|
||||
secretName: jitsi-secret
|
||||
rules:
|
||||
- host: fqdn
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: shynet-webserver-service
|
||||
name: jitsi-webserver-service
|
||||
port:
|
||||
number: 8080
|
||||
path: /
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: shynet-settings
|
||||
name: jitsi-settings
|
||||
type: Opaque
|
||||
stringData:
|
||||
# Django settings
|
||||
DEBUG: "False"
|
||||
|
||||
# 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
|
||||
ALLOWED_HOSTS: "*" # For better security, set this to your deployment's domain. Comma separated.
|
||||
DJANGO_SECRET_KEY: django-secret-key
|
||||
|
@ -16,11 +16,11 @@ stringData:
|
|||
TIME_ZONE: "America/New_York"
|
||||
|
||||
# Redis configuration (if you use the default Kubernetes config, this will work)
|
||||
REDIS_CACHE_LOCATION: "redis://shynet-redis.default.svc.cluster.local/0"
|
||||
CELERY_BROKER_URL: "redis://shynet-redis.default.svc.cluster.local/1"
|
||||
REDIS_CACHE_LOCATION: "redis://jitsi-redis.default.svc.cluster.local/0"
|
||||
CELERY_BROKER_URL: "redis://jitsi-redis.default.svc.cluster.local/1"
|
||||
|
||||
# PostgreSQL settings
|
||||
DB_NAME: "shynet"
|
||||
DB_NAME: "jitsi"
|
||||
DB_USER: postgres-db-user
|
||||
DB_PASSWORD: postgres-db-password
|
||||
DB_HOST: "postgresql-service"
|
||||
|
@ -29,4 +29,4 @@ stringData:
|
|||
EMAIL_HOST_USER: ""
|
||||
EMAIL_HOST_PASSWORD: ""
|
||||
EMAIL_HOST: ""
|
||||
SERVER_EMAIL: "Shynet <noreply@shynet.example.com>"
|
||||
SERVER_EMAIL: "jitsi <noreply@jitsi.example.com>"
|
|
@ -1,11 +1,11 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: shynet-redis
|
||||
name: jitsi-redis
|
||||
spec:
|
||||
ports:
|
||||
- port: 6379
|
||||
name: redis
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: shynet-redis
|
||||
app: jitsi-redis
|
|
@ -1,10 +1,10 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: shynet-webserver-service
|
||||
name: jitsi-webserver-service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 8080
|
||||
selector:
|
||||
app: shynet-webserver
|
||||
app: jitsi-webserver
|
|
@ -1,20 +1,20 @@
|
|||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: shynet-redis
|
||||
name: jitsi-redis
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: shynet-redis
|
||||
serviceName: shynet-redis
|
||||
app: jitsi-redis
|
||||
serviceName: jitsi-redis
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: shynet-redis
|
||||
app: jitsi-redis
|
||||
spec:
|
||||
containers:
|
||||
- name: shynet-redis
|
||||
- name: jitsi-redis
|
||||
image: redis:6.2.6
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
(ns dda.c4k-shynet.shynet-test
|
||||
(ns dda.c4k-jitsi.jitsi-test
|
||||
(:require
|
||||
#?(:clj [clojure.test :refer [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
|
||||
(is (= {:apiVersion "apps/v1"
|
||||
:kind "Deployment"
|
||||
:metadata
|
||||
{:name "shynet-webserver"
|
||||
{:name "jitsi-webserver"
|
||||
:namespace "default"
|
||||
:labels {:app "shynet-webserver"}}
|
||||
:labels {:app "jitsi-webserver"}}
|
||||
:spec
|
||||
{:selector {:matchLabels {:app "shynet-webserver"}}
|
||||
{:selector {:matchLabels {:app "jitsi-webserver"}}
|
||||
:strategy {:type "Recreate"}
|
||||
:replicas 1
|
||||
:template
|
||||
{:metadata {:labels {:app "shynet-webserver"}}
|
||||
{:metadata {:labels {:app "jitsi-webserver"}}
|
||||
:spec
|
||||
{:containers
|
||||
[{:name "shynet-webserver"
|
||||
:image "milesmcc/shynet:v0.12.0"
|
||||
[{:name "jitsi-webserver"
|
||||
:image "milesmcc/jitsi:v0.12.0"
|
||||
:imagePullPolicy "IfNotPresent"
|
||||
:envFrom [{:secretRef {:name "shynet-settings"}}]}]}}}}
|
||||
:envFrom [{:secretRef {:name "jitsi-settings"}}]}]}}}}
|
||||
(cut/generate-webserver-deployment))))
|
||||
|
||||
(deftest should-generate-celeryworker-deployment
|
||||
(is (= {:apiVersion "apps/v1"
|
||||
:kind "Deployment"
|
||||
:metadata
|
||||
{:name "shynet-celeryworker"
|
||||
{:name "jitsi-celeryworker"
|
||||
:namespace "default"
|
||||
:labels {:app "shynet-celeryworker"}}
|
||||
:labels {:app "jitsi-celeryworker"}}
|
||||
:spec
|
||||
{:selector {:matchLabels {:app "shynet-celeryworker"}}
|
||||
{:selector {:matchLabels {:app "jitsi-celeryworker"}}
|
||||
:strategy {:type "Recreate"}
|
||||
:replicas 1
|
||||
:template
|
||||
{:metadata {:labels {:app "shynet-celeryworker"}}
|
||||
{:metadata {:labels {:app "jitsi-celeryworker"}}
|
||||
:spec
|
||||
{:containers
|
||||
[{:name "shynet-celeryworker"
|
||||
:image "milesmcc/shynet:v0.12.0"
|
||||
[{:name "jitsi-celeryworker"
|
||||
:image "milesmcc/jitsi:v0.12.0"
|
||||
:imagePullPolicy "IfNotPresent"
|
||||
:command ["./celeryworker.sh"]
|
||||
:envFrom [{:secretRef {:name "shynet-settings"}}]}]}}}}
|
||||
:envFrom [{:secretRef {:name "jitsi-settings"}}]}]}}}}
|
||||
(cut/generate-celeryworker-deployment))))
|
||||
|
||||
(deftest should-generate-certificate
|
||||
(is (= {:apiVersion "cert-manager.io/v1"
|
||||
:kind "Certificate"
|
||||
:metadata {:name "shynet-cert", :namespace "default"}
|
||||
:metadata {:name "jitsi-cert", :namespace "default"}
|
||||
:spec
|
||||
{:secretName "shynet-secret"
|
||||
{:secretName "jitsi-secret"
|
||||
:commonName "test.com"
|
||||
:dnsNames ["test.com"]
|
||||
:issuerRef {:name "letsencrypt-staging-issuer", :kind "ClusterIssuer"}}}
|
||||
|
@ -63,7 +63,7 @@
|
|||
(is (= {:apiVersion "networking.k8s.io/v1"
|
||||
:kind "Ingress"
|
||||
:metadata
|
||||
{:name "shynet-webserver-ingress"
|
||||
{:name "jitsi-webserver-ingress"
|
||||
:annotations
|
||||
{:cert-manager.io/cluster-issuer "letsencrypt-staging-issuer"
|
||||
: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-read-timeout "300"}}
|
||||
:spec
|
||||
{:tls [{:hosts ["test.com"], :secretName "shynet-secret"}]
|
||||
{:tls [{:hosts ["test.com"], :secretName "jitsi-secret"}]
|
||||
:rules
|
||||
[{:host "test.com"
|
||||
: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}))))
|
||||
|
||||
(deftest should-generate-secret
|
||||
(is (= {:apiVersion "v1"
|
||||
:kind "Secret"
|
||||
:metadata {:name "shynet-settings"}
|
||||
:metadata {:name "jitsi-settings"}
|
||||
:type "Opaque"
|
||||
:stringData
|
||||
{:DEBUG "False"
|
||||
|
@ -92,16 +92,16 @@
|
|||
:ACCOUNT_SIGNUPS_ENABLED "False"
|
||||
:TIME_ZONE "America/New_York"
|
||||
:REDIS_CACHE_LOCATION
|
||||
"redis://shynet-redis.default.svc.cluster.local/0"
|
||||
"redis://jitsi-redis.default.svc.cluster.local/0"
|
||||
:CELERY_BROKER_URL
|
||||
"redis://shynet-redis.default.svc.cluster.local/1"
|
||||
:DB_NAME "shynet"
|
||||
"redis://jitsi-redis.default.svc.cluster.local/1"
|
||||
:DB_NAME "jitsi"
|
||||
:DB_USER "postgres-user"
|
||||
:DB_PASSWORD "postgres-pw"
|
||||
:DB_HOST "postgresql-service"
|
||||
:EMAIL_HOST_USER ""
|
||||
:EMAIL_HOST_PASSWORD ""
|
||||
: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"
|
||||
:postgres-db-user "postgres-user" :postgres-db-password "postgres-pw"}))))
|
|
@ -1,3 +1,3 @@
|
|||
{:django-secret-key "django"
|
||||
:postgres-db-user "shynet"
|
||||
:postgres-db-password "shynet-db-password"}
|
||||
:postgres-db-user "jitsi"
|
||||
:postgres-db-password "jitsi-db-password"}
|
||||
|
|
Loading…
Reference in a new issue