diff --git a/infrastructure/c4k-website-build/image/Dockerfile b/infrastructure/c4k-website-build/image/Dockerfile index 02615d1..4d3289b 100644 --- a/infrastructure/c4k-website-build/image/Dockerfile +++ b/infrastructure/c4k-website-build/image/Dockerfile @@ -3,9 +3,9 @@ FROM clojure:lein # Prepare Entrypoint Script ADD resources /tmp -ENV SOURCEDIR="/etc/websitesource" ENV BUILDDIR="/etc/website" +ENV SOURCEDIR="/etc/websitesource" ENV WEBSITEROOT="/var/www/html/website/" -ENV HASHFILEDIR="/data/hashfiles" +ENV HASHFILEDIR="/var/hashfile.d" RUN /tmp/install.sh diff --git a/infrastructure/c4k-website-build/image/resources/entrypoint.sh b/infrastructure/c4k-website-build/image/resources/entrypoint.sh index 6d8e90a..75cbe2d 100755 --- a/infrastructure/c4k-website-build/image/resources/entrypoint.sh +++ b/infrastructure/c4k-website-build/image/resources/entrypoint.sh @@ -1,8 +1,8 @@ #!/bin/bash +# curl -s -H "Authorization: token d92668fff6e005582dcb09c6590982a39b2523fc" https://repo.prod.meissa.de/api/v1/repos/meissa-intern/meissa-io/git/commits/HEAD | jq '.' mkdir $BUILDDIR mkdir $SOURCEDIR -mkdir -p $HASHFILEDIR set -o nounset set -o xtrace @@ -14,8 +14,8 @@ source /usr/local/bin/functions.sh filename="website.zip" hashfilename="hashfile" -# create empty hashfile # download website data +# create empty hashfile # compare current hash to hashfile # same? # do nothing diff --git a/src/main/cljc/dda/c4k_website/website.cljc b/src/main/cljc/dda/c4k_website/website.cljc index c82cad2..446cba1 100644 --- a/src/main/cljc/dda/c4k_website/website.cljc +++ b/src/main/cljc/dda/c4k_website/website.cljc @@ -185,6 +185,10 @@ (replace-common-data "website/website-content-volume.yaml" config) (cm/replace-all-matching-values-by-new-value "WEBSITESTORAGESIZE" (str volume-size "Gi"))))) +(defn-spec generate-hashfile-volume pred/map-or-seq? + [config flattened-and-reduced-config?] + (replace-common-data "website/website-content-volume.yaml" config)) + (defn-spec generate-website-build-cron pred/map-or-seq? [config flattened-and-reduced-config?] (replace-build-data "website/website-build-cron.yaml" config)) @@ -204,4 +208,5 @@ gitea-host gitea-repo username - branchname)))))) \ No newline at end of file + branchname)))))) + diff --git a/src/main/resources/website/hashfile-volume.yaml b/src/main/resources/website/hashfile-volume.yaml new file mode 100644 index 0000000..99f35db --- /dev/null +++ b/src/main/resources/website/hashfile-volume.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: NAME-hashfile-volume + namespace: default + labels: + app: NAME-nginx + app.kubernetes.part-of: NAME-website +spec: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 16Mi + \ No newline at end of file diff --git a/src/main/resources/website/nginx-deployment.yaml b/src/main/resources/website/nginx-deployment.yaml index 234bc7e..9133cd2 100644 --- a/src/main/resources/website/nginx-deployment.yaml +++ b/src/main/resources/website/nginx-deployment.yaml @@ -52,6 +52,8 @@ spec: volumeMounts: - name: content-volume mountPath: /var/www/html/website + - name: hashfile-volume + mountPath: /var/hashfile.d volumes: - name: nginx-config-volume configMap: @@ -68,4 +70,7 @@ spec: - name: content-volume persistentVolumeClaim: claimName: NAME-content-volume + - name: hashfile-volume + persistentVolumeClaim: + claimName: NAME-hashfile-volume \ No newline at end of file diff --git a/src/main/resources/website/website-build-cron.yaml b/src/main/resources/website/website-build-cron.yaml index 371444c..c6cb277 100644 --- a/src/main/resources/website/website-build-cron.yaml +++ b/src/main/resources/website/website-build-cron.yaml @@ -35,9 +35,14 @@ spec: volumeMounts: - name: content-volume mountPath: /var/www/html/website + - name: hashfile-volume + mountPath: /var/hashfile.d volumes: - name: content-volume persistentVolumeClaim: claimName: NAME-content-volume + - name: hashfile-volume + persistentVolumeClaim: + claimName: NAME-hashfile-volume restartPolicy: OnFailure \ No newline at end of file