diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c5433c921..085fedb18 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,179 +1,62 @@ version: 2 updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" + # open-pull-requests-limit: 10 + # ignore: + - package-ecosystem: npm directory: "/" schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: cypress - versions: - - 6.3.0 - - 6.4.0 - - 6.5.0 - - 6.6.0 - - 6.7.1 - - 6.8.0 - - 7.0.0 - - 7.0.1 - - 7.1.0 - - dependency-name: cypress-cucumber-preprocessor - versions: - - 4.0.0 - - 4.0.1 - - 4.0.3 - - dependency-name: date-fns - versions: - - 2.16.1 - - 2.17.0 - - 2.18.0 - - 2.19.0 - - 2.20.0 - - 2.20.1 - - 2.20.2 - - 2.20.3 - - 2.21.0 - - dependency-name: cypress-file-upload - versions: - - 5.0.2 - - 5.0.3 - - 5.0.4 - - 5.0.5 - - dependency-name: neo4j-driver - versions: - - 4.2.2 + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" - package-ecosystem: npm directory: "/backend" schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: y18n - versions: - - 4.0.1 - - 4.0.2 - - dependency-name: metascraper-publisher - versions: - - 5.16.16 - - 5.18.1 - - 5.18.12 - - 5.18.2 - - 5.18.4 - - 5.18.5 - - 5.18.6 - - 5.18.9 - - 5.20.0 - - 5.21.0 - - 5.21.2 - - 5.21.3 - - 5.21.4 - - 5.21.5 - - dependency-name: metascraper-author - versions: - - 5.16.16 - - 5.18.1 - - 5.18.12 - - 5.18.2 - - 5.18.4 - - 5.18.5 - - 5.18.6 - - 5.18.9 - - 5.20.0 - - 5.21.0 - - 5.21.2 - - 5.21.3 - - 5.21.4 - - 5.21.5 - - dependency-name: neo4j-driver - versions: - - 4.2.2 - - dependency-name: neo4j-graphql-js - versions: - - 2.19.1 - - dependency-name: mustache - versions: - - 4.1.0 + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" - package-ecosystem: npm directory: "/webapp" schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: nuxt - versions: - - 2.14.12 - - 2.15.0 - - 2.15.1 - - 2.15.2 - - 2.15.3 - - dependency-name: v-tooltip - versions: - - 2.1.2 - - dependency-name: "@vue/server-test-utils" - versions: - - 1.1.2 - - 1.1.3 - - dependency-name: node-notifier - versions: - - 8.0.1 -- package-ecosystem: docker - directory: "/webapp" - schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: node - versions: - - ">= 15.5.a, < 15.6" - - dependency-name: node - versions: - - 15.10.0.pre.alpine3.10 - - 15.11.0.pre.alpine3.10 - - 15.12.0.pre.alpine3.10 - - 15.13.0.pre.alpine3.10 - - 15.7.0.pre.alpine3.10 - - 15.8.0.pre.alpine3.10 - - 15.9.0.pre.alpine3.10 + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" + - package-ecosystem: docker directory: "/backend" schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: node - versions: - - ">= 15.4.a, < 15.5" - - dependency-name: node - versions: - - ">= 15.5.a, < 15.6" - - dependency-name: node - versions: - - 15.10.0.pre.alpine3.10 - - 15.11.0.pre.alpine3.10 - - 15.12.0.pre.alpine3.10 - - 15.13.0.pre.alpine3.10 - - 15.7.0.pre.alpine3.10 - - 15.8.0.pre.alpine3.10 - - 15.9.0.pre.alpine3.10 + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" +- package-ecosystem: docker + directory: "/webapp" + schedule: + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" - package-ecosystem: docker directory: "/neo4j" schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: neo4j - versions: - - 4.2.3 - - 4.2.4 + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" - package-ecosystem: docker - directory: "/deployment/legacy-migration/maintenance-worker" + directory: "/deployment/src/docker" schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 + interval: weekly + day: "saturday" + timezone: "Europe/Berlin" + time: "03:00" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 71b24d389..46d80241f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -168,6 +168,8 @@ jobs: name: Unit tests - backend runs-on: ubuntu-latest needs: [build_test_neo4j,build_test_backend] + permissions: + checks: write steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -225,6 +227,8 @@ jobs: name: Unit tests - webapp runs-on: ubuntu-latest needs: [build_test_webapp] + permissions: + checks: write steps: ########################################################################## # CHECKOUT CODE ########################################################## diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 0653d58f3..a0dda4dc0 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -7,6 +7,7 @@ services: dockerfile: ../webapp/Dockerfile context: ../webapp target: base + command: sleep 0 webapp-code: image: ocelotsocialnetwork/webapp:local-code @@ -14,10 +15,11 @@ services: dockerfile: ../webapp/Dockerfile context: ../webapp target: code + command: sleep 0 webapp: image: ocelotsocialnetwork/webapp-branded:local-${CONFIGURATION} - container_name: webapp + container_name: webapp-branded build: dockerfile: src/docker/webapp.Dockerfile target: branded @@ -51,6 +53,7 @@ services: dockerfile: ../backend/Dockerfile context: ../backend target: base + command: sleep 0 backend-code: image: ocelotsocialnetwork/backend:local-code @@ -58,13 +61,14 @@ services: dockerfile: ../backend/Dockerfile context: ../backend target: code + command: sleep 0 backend: image: ocelotsocialnetwork/backend-branded:local-${CONFIGURATION} container_name: backend build: dockerfile: src/docker/backend.Dockerfile - target: branded + target: branded-branded context: . args: - CONFIGURATION=$CONFIGURATION @@ -106,6 +110,7 @@ services: dockerfile: ../webapp/Dockerfile.maintenance context: ../webapp target: base + command: sleep 0 maintenance-code: image: ocelotsocialnetwork/maintenance:local-code @@ -113,11 +118,12 @@ services: dockerfile: ../webapp/Dockerfile.maintenance context: ../webapp target: code + command: sleep 0 maintenance: # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there image: ocelotsocialnetwork/maintenance-branded:local-${CONFIGURATION} - container_name: maintenance + container_name: maintenance-branded build: # TODO: Separate from webapp, this must be independent dockerfile: src/docker/maintenance.Dockerfile @@ -152,7 +158,7 @@ services: mailserver: image: djfarrelly/maildev - container_name: mailserver + container_name: mailserver-branded ports: - 1080:80 networks: diff --git a/deployment/scripts/cluster.maintenance.sh b/deployment/scripts/cluster.maintenance.sh new file mode 100755 index 000000000..3a558d7bb --- /dev/null +++ b/deployment/scripts/cluster.maintenance.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# base setup +SCRIPT_PATH=$(realpath $0) +SCRIPT_DIR=$(dirname $SCRIPT_PATH) + +# configuration +CONFIGURATION=${CONFIGURATION:-"example"} +KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeconfig.yaml} + +case $1 in + on) + kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.on.yaml + ;; + off) + kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.off.yaml + ;; + *) + echo -e "Run this script with first argument either 'on' or 'off'" + exit + ;; +esac diff --git a/deployment/src/docker/maintenance.Dockerfile b/deployment/src/docker/maintenance.Dockerfile index 1df6c551b..b699e7f20 100644 --- a/deployment/src/docker/maintenance.Dockerfile +++ b/deployment/src/docker/maintenance.Dockerfile @@ -14,7 +14,12 @@ ARG CONFIGURATION=example # copy public constants into the Docker image to brand it COPY configurations/${CONFIGURATION}/branding/static/ static/ COPY configurations/${CONFIGURATION}/branding/constants/ constants/ -COPY configurations/${CONFIGURATION}/branding/locales/ locales/ + +# locales +COPY configurations/${CONFIGURATION}/branding/locales/*.json locales/tmp/ +COPY src/tools/ tools/ +RUN apk add --no-cache bash jq +RUN tools/merge-locales.sh ################################################################################## # BUILD ########################################################################## diff --git a/deployment/src/docker/webapp.Dockerfile b/deployment/src/docker/webapp.Dockerfile index ad5b7c769..f0c75e392 100644 --- a/deployment/src/docker/webapp.Dockerfile +++ b/deployment/src/docker/webapp.Dockerfile @@ -12,17 +12,16 @@ FROM $APP_IMAGE_CODE as code ARG CONFIGURATION=example # copy public constants into the Docker image to brand it -COPY src/tools/ tools/ COPY configurations/${CONFIGURATION}/branding/static/ static/ COPY configurations/${CONFIGURATION}/branding/constants/ constants/ COPY configurations/${CONFIGURATION}/branding/locales/html/ locales/html/ -# COPY configurations/${CONFIGURATION}/branding/locales/index.js locales/index.js -COPY configurations/${CONFIGURATION}/branding/locales/*.json locales/tmp/ COPY configurations/${CONFIGURATION}/branding/assets/styles/imports/ assets/styles/imports/ COPY configurations/${CONFIGURATION}/branding/assets/fonts/ assets/fonts/ +# locales +COPY configurations/${CONFIGURATION}/branding/locales/*.json locales/tmp/ +COPY src/tools/ tools/ RUN apk add --no-cache bash jq - RUN tools/merge-locales.sh ################################################################################## diff --git a/deployment/src/kubernetes/patches/patch.ingress.maintenance.off.yaml b/deployment/src/kubernetes/patches/patch.ingress.maintenance.off.yaml new file mode 100644 index 000000000..c01745d0a --- /dev/null +++ b/deployment/src/kubernetes/patches/patch.ingress.maintenance.off.yaml @@ -0,0 +1,12 @@ +spec: + rules: + - host: + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: ocelot-webapp + port: + number: 3000 \ No newline at end of file diff --git a/deployment/src/kubernetes/patches/patch.ingress.maintenance.on.yaml b/deployment/src/kubernetes/patches/patch.ingress.maintenance.on.yaml new file mode 100644 index 000000000..8a2c5d45f --- /dev/null +++ b/deployment/src/kubernetes/patches/patch.ingress.maintenance.on.yaml @@ -0,0 +1,12 @@ +spec: + rules: + - host: + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: ocelot-maintenance + port: + number: 80 \ No newline at end of file diff --git a/webapp/plugins/i18n.js b/webapp/plugins/i18n.js index f162408f6..1382c2728 100644 --- a/webapp/plugins/i18n.js +++ b/webapp/plugins/i18n.js @@ -36,7 +36,7 @@ export default ({ app, req, cookie, store }) => { } const expires = new Date() - expires.setDate(expires.getDate() + app.$env.COOKIE_EXPIRE_TIME) + expires.setDate(expires.getDate() + app.$env && app.$env.COOKIE_EXPIRE_TIME) app.$cookies.set(key, localeInStore, { expires, // maxAge: app.$env.COOKIE_EXPIRE_TIME * 60 * 60 * 24, // days to seconds