From c2e75c24e9af0e8949972b2d7394281e25453503 Mon Sep 17 00:00:00 2001 From: see Date: Fri, 21 Jan 2022 13:54:54 +0100 Subject: [PATCH] added webserverconfig --- .gitignore | 3 ++ src/main/cljc/dda/c4k_matomo/matomo.cljc | 20 +++---- .../matomo/deployments-template.yaml | 52 +++++++++++++++++++ .../{statefulsets.yaml => statefulset.yaml} | 0 4 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 .gitignore create mode 100644 src/main/resources/matomo/deployments-template.yaml rename src/main/resources/matomo/{statefulsets.yaml => statefulset.yaml} (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8263f5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.clj-kondo/ +.lsp/ +target/ diff --git a/src/main/cljc/dda/c4k_matomo/matomo.cljc b/src/main/cljc/dda/c4k_matomo/matomo.cljc index ae6a3a2..8b66c1d 100644 --- a/src/main/cljc/dda/c4k_matomo/matomo.cljc +++ b/src/main/cljc/dda/c4k_matomo/matomo.cljc @@ -12,12 +12,11 @@ #?(:cljs (defmethod yaml/load-resource :matomo [resource-name] (case resource-name - ;"matomo/certificate.yaml" (rc/inline "matomo/certificate.yaml") - ;"matomo/deployment.yaml" (rc/inline "matomo/deployment.yaml") - ;"matomo/ingress.yaml" (rc/inline "matomo/ingress.yaml") - ;"matomo/persistent-volume.yaml" (rc/inline "matomo/persistent-volume.yaml") - ;"matomo/pvc.yaml" (rc/inline "matomo/pvc.yaml") - ;"matomo/service.yaml" (rc/inline "matomo/service.yaml") + "matomo/certificate.yaml" (rc/inline "matomo/certificate.yaml") + "matomo/deployments.yaml" (rc/inline "matomo/deployments.yaml") + "matomo/ingress.yaml" (rc/inline "matomo/ingress.yaml") + "matomo/services.yaml" (rc/inline "matomo/services.yaml") + "matomo/statefulset.yaml" (rc/inline "matomo/statefulset.yaml") (throw (js/Error. "Undefined Resource!"))))) (defn generate-certificate [config] @@ -29,10 +28,11 @@ (assoc-in [:spec :dnsNames] [fqdn]) (assoc-in [:spec :issuerRef :name] letsencrypt-issuer)))) -(defn generate-deployment [config] - (let [{:keys [fqdn]} config] - (-> (yaml/from-string (yaml/load-resource "matomo/deployment.yaml")) - (cm/replace-named-value "FQDN" fqdn)))) +(defn generate-webserver-deployment [] + (let [shynet-application "shynet-webserver"] + (-> (yaml/from-string (yaml/load-resource "matomo/deployments-template.yaml")) + (cm/replace-named-value "shynet-application" shynet-application) + (dissoc [:spec :template :spec :containers 0] :command)))) (defn generate-ingress [config] (let [{:keys [fqdn issuer] diff --git a/src/main/resources/matomo/deployments-template.yaml b/src/main/resources/matomo/deployments-template.yaml new file mode 100644 index 0000000..5d1d776 --- /dev/null +++ b/src/main/resources/matomo/deployments-template.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: shynet-webserver + namespace: default + labels: + app: shynet-webserver +spec: + selector: + matchLabels: + app: shynet-webserver + strategy: + type: Recreate + replicas: 1 + template: + metadata: + labels: + app: shynet-webserver + spec: + containers: + - name: shynet-webserver + image: milesmcc/shynet:edge + imagePullPolicy: IfNotPresent + envFrom: + - secretRef: + name: shynet-settings +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: shynet-celeryworker + namespace: default + labels: + app: shynet-celeryworker +spec: + selector: + matchLabels: + app: shynet-celeryworker + replicas: 1 + template: + metadata: + labels: + app: shynet-celeryworker + spec: + containers: + - name: shynet-celeryworker + image: milesmcc/shynet:edge + command: ["./celeryworker.sh"] + imagePullPolicy: IfNotPresent + envFrom: + - secretRef: + name: shynet-settings diff --git a/src/main/resources/matomo/statefulsets.yaml b/src/main/resources/matomo/statefulset.yaml similarity index 100% rename from src/main/resources/matomo/statefulsets.yaml rename to src/main/resources/matomo/statefulset.yaml