From 2a7f34d4e7c838be95bb8558fa666e737df60901 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Wed, 27 Nov 2024 22:03:07 +0100 Subject: [PATCH 01/27] add workflow --- .../workflows/build-and-push-docker-image.yml | 103 ++++++++++++++++++ .../application-server/.nixpacks/Dockerfile | 30 +++++ server/application-server/.nixpacks/build.sh | 1 + ...dc10b5a6f2a592af36375c68fda41246794b86.nix | 21 ++++ 4 files changed, 155 insertions(+) create mode 100644 .github/workflows/build-and-push-docker-image.yml create mode 100644 server/application-server/.nixpacks/Dockerfile create mode 100644 server/application-server/.nixpacks/build.sh create mode 100644 server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml new file mode 100644 index 00000000..c4523f2c --- /dev/null +++ b/.github/workflows/build-and-push-docker-image.yml @@ -0,0 +1,103 @@ +name: Build and Push Docker Image + +on: + workflow_call: + inputs: + image-name: + type: string + default: ${{ github.repository }} + description: "The name for the docker image (Default: Repository name)" + docker-file: + type: string + default: Dockerfile + description: "The path to the Dockerfile (Default: ./Dockerfile)" + docker-context: + type: string + default: . + description: "The context for the Docker build (Default: .)" + build-args: + type: string + description: "List of additional build contexts (e.g., name=path)" + required: false + platforms: + type: string + description: "List of platforms for which to build the image" + default: linux/amd64,linux/arm64 + registry: + type: string + default: ghcr.io + description: "The registry to push the image to (Default: ghcr.io)" + + secrets: + registry-user: + required: false + registry-password: + required: false + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - dockerfile: ./webapp/Dockerfile + image: ghcr.io/ls1intum/Hephaestus/hephaestus-webapp + context: ./webapp + path: webapp + - dockerfile: ./server/intelligence-service/Dockerfile + image: ghcr.io/ls1intum/Hephaestus/hephaestus-intelligence-service + context: ./server/intelligence-service + path: server/intelligence-service + - dockerfile: ./server/webhook-ingest/Dockerfile + image: ghcr.io/ls1intum/Hephaestus/hephaestus-webhook-ingest + context: ./server/webhook-ingest + path: server/webhook-ingest + - build_method: nixpacks + dockerfile: ./server/application-server/.nixpacks/Dockerfile + image: ghcr.io/ls1intum/Hephaestus/hephaestus-application-server + context: ./server/application-server + path: server/application-server + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: Install Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ inputs.registry }} + username: ${{ secrets.registry-user || github.actor }} + password: ${{ secrets.registry-password || secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ inputs.registry }}/${{ inputs.image-name }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=branch + type=ref,event=pr + + - name: Build and push Docker Image + if: matrix.build_method == 'dockerfile' + uses: docker/build-push-action@v6 + with: + context: ${{ inputs.docker-context }} + file: ${{ inputs.docker-file }} + platforms: ${{ inputs.platforms }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: ${{ inputs.build-args }} + push: true \ No newline at end of file diff --git a/server/application-server/.nixpacks/Dockerfile b/server/application-server/.nixpacks/Dockerfile new file mode 100644 index 00000000..b3ff38f6 --- /dev/null +++ b/server/application-server/.nixpacks/Dockerfile @@ -0,0 +1,30 @@ +FROM ghcr.io/railwayapp/nixpacks:ubuntu-1722297819 + +ENTRYPOINT ["/bin/bash", "-l", "-c"] +WORKDIR /app/ + + +COPY .nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix .nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix +RUN nix-env -if .nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix && nix-collect-garbage -d +RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends wget + +ARG NIXPACKS_JDK_VERSION=21 +ARG NIXPACKS_METADATA=java + +ENV NIXPACKS_JDK_VERSION=$NIXPACKS_JDK_VERSION NIXPACKS_METADATA=$NIXPACKS_METADATA + +# setup phase +# noop + +# build phase +COPY . /app/. +RUN --mount=type=cache,id=xE0e05wx0-m2/repository,target=/app/.m2/repository chmod +x ./mvnw +RUN --mount=type=cache,id=xE0e05wx0-m2/repository,target=/app/.m2/repository ./mvnw -DskipTests clean package + + + + +# start +COPY . /app +CMD ["java -Dserver.port=$PORT $JAVA_OPTS -jar target/*jar"] + diff --git a/server/application-server/.nixpacks/build.sh b/server/application-server/.nixpacks/build.sh new file mode 100644 index 00000000..5709198b --- /dev/null +++ b/server/application-server/.nixpacks/build.sh @@ -0,0 +1 @@ +docker build server/application-server -f server/application-server/.nixpacks/Dockerfile -t hephaestus-application-server --build-arg NIXPACKS_JDK_VERSION=21 --build-arg NIXPACKS_METADATA=java \ No newline at end of file diff --git a/server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix b/server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix new file mode 100644 index 00000000..d31882a4 --- /dev/null +++ b/server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix @@ -0,0 +1,21 @@ +{ }: + +let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/59dc10b5a6f2a592af36375c68fda41246794b86.tar.gz") { overlays = [ ]; }; +in with pkgs; + let + APPEND_LIBRARY_PATH = "${lib.makeLibraryPath [ ] }"; + myLibraries = writeText "libraries" '' + export LD_LIBRARY_PATH="${APPEND_LIBRARY_PATH}:$LD_LIBRARY_PATH" + + ''; + in + buildEnv { + name = "59dc10b5a6f2a592af36375c68fda41246794b86-env"; + paths = [ + (runCommand "59dc10b5a6f2a592af36375c68fda41246794b86-env" { } '' + mkdir -p $out/etc/profile.d + cp ${myLibraries} $out/etc/profile.d/59dc10b5a6f2a592af36375c68fda41246794b86-env.sh + '') + jdk21 maven + ]; + } From 27d5d4596fd987687a78f612b15c8a06fb47c38b Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Wed, 27 Nov 2024 22:06:53 +0100 Subject: [PATCH 02/27] add dev workflow --- .github/workflows/dev.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/dev.yml diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 00000000..1e55a63a --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,10 @@ +name: Build and Deploy to Dev + +on: + pull_request: + branches: [main] + +jobs: + build-dev-container: + uses: ./.github/workflows/build-and-push-docker-image.yml + secrets: inherit \ No newline at end of file From 1811290e3adc4a15296171fd4e876da39edaed99 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Wed, 27 Nov 2024 22:10:13 +0100 Subject: [PATCH 03/27] update dev --- .github/workflows/dev.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 1e55a63a..7f740eb5 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -2,7 +2,17 @@ name: Build and Deploy to Dev on: pull_request: - branches: [main] + paths-ignore: + - 'README.md' + - 'CODE_OF_CONDUCT.md' + - 'CONTRIBUTING.md' + - 'LICENSE' + - 'SECURITY.md' + - 'docs/**' + - 'keycloakify/**' + - '.github/**' + - '!.github/workflows/build-and-push-docker-image.yml' + - '!.github/workflows/dev.yml' jobs: build-dev-container: From a0e08f0ddd927431cb43aca0599810bd6e85269c Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Wed, 27 Nov 2024 22:17:36 +0100 Subject: [PATCH 04/27] whoops --- .github/workflows/build-and-push-docker-image.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index c4523f2c..805929db 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -53,8 +53,7 @@ jobs: image: ghcr.io/ls1intum/Hephaestus/hephaestus-webhook-ingest context: ./server/webhook-ingest path: server/webhook-ingest - - build_method: nixpacks - dockerfile: ./server/application-server/.nixpacks/Dockerfile + - dockerfile: ./server/application-server/.nixpacks/Dockerfile image: ghcr.io/ls1intum/Hephaestus/hephaestus-application-server context: ./server/application-server path: server/application-server @@ -91,7 +90,6 @@ jobs: type=ref,event=pr - name: Build and push Docker Image - if: matrix.build_method == 'dockerfile' uses: docker/build-push-action@v6 with: context: ${{ inputs.docker-context }} From f98b7e1178213bcf6109e81c3f9543bbe5ef11c7 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Wed, 27 Nov 2024 22:22:56 +0100 Subject: [PATCH 05/27] fix workflow --- .../workflows/build-and-push-docker-image.yml | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index 805929db..0efb2ded 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -3,22 +3,6 @@ name: Build and Push Docker Image on: workflow_call: inputs: - image-name: - type: string - default: ${{ github.repository }} - description: "The name for the docker image (Default: Repository name)" - docker-file: - type: string - default: Dockerfile - description: "The path to the Dockerfile (Default: ./Dockerfile)" - docker-context: - type: string - default: . - description: "The context for the Docker build (Default: .)" - build-args: - type: string - description: "List of additional build contexts (e.g., name=path)" - required: false platforms: type: string description: "List of platforms for which to build the image" @@ -83,7 +67,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ inputs.registry }}/${{ inputs.image-name }} + images: ${{ inputs.registry }}/${{ matrix.image }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch @@ -92,10 +76,9 @@ jobs: - name: Build and push Docker Image uses: docker/build-push-action@v6 with: - context: ${{ inputs.docker-context }} - file: ${{ inputs.docker-file }} + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} platforms: ${{ inputs.platforms }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: ${{ inputs.build-args }} push: true \ No newline at end of file From 2a0ac41c0089a84a23337c641289eff4c918027b Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Thu, 28 Nov 2024 21:28:59 +0100 Subject: [PATCH 06/27] switch to dockerfile on application server --- build_images.sh | 1 - compose.yaml | 8 +++-- .../application-server/.nixpacks/Dockerfile | 30 ------------------- server/application-server/.nixpacks/build.sh | 1 - ...dc10b5a6f2a592af36375c68fda41246794b86.nix | 21 ------------- server/application-server/Dockerfile | 26 ++++++++++++++++ server/application-server/nixpacks.toml | 8 ----- 7 files changed, 32 insertions(+), 63 deletions(-) delete mode 100644 build_images.sh delete mode 100644 server/application-server/.nixpacks/Dockerfile delete mode 100644 server/application-server/.nixpacks/build.sh delete mode 100644 server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix create mode 100644 server/application-server/Dockerfile delete mode 100644 server/application-server/nixpacks.toml diff --git a/build_images.sh b/build_images.sh deleted file mode 100644 index d9fd3383..00000000 --- a/build_images.sh +++ /dev/null @@ -1 +0,0 @@ -nixpacks build -n hephaestus-application-server server/application-server \ No newline at end of file diff --git a/compose.yaml b/compose.yaml index 8add96b2..0f09a9ef 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,7 @@ services: application-server: - image: hephaestus-application-server + build: + context: ./server/application-server ports: - '8080' environment: @@ -43,4 +44,7 @@ services: networks: app-network: - driver: bridge` \ No newline at end of file + driver: bridge + +volumes: + postgresql-data: \ No newline at end of file diff --git a/server/application-server/.nixpacks/Dockerfile b/server/application-server/.nixpacks/Dockerfile deleted file mode 100644 index b3ff38f6..00000000 --- a/server/application-server/.nixpacks/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM ghcr.io/railwayapp/nixpacks:ubuntu-1722297819 - -ENTRYPOINT ["/bin/bash", "-l", "-c"] -WORKDIR /app/ - - -COPY .nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix .nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix -RUN nix-env -if .nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix && nix-collect-garbage -d -RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends wget - -ARG NIXPACKS_JDK_VERSION=21 -ARG NIXPACKS_METADATA=java - -ENV NIXPACKS_JDK_VERSION=$NIXPACKS_JDK_VERSION NIXPACKS_METADATA=$NIXPACKS_METADATA - -# setup phase -# noop - -# build phase -COPY . /app/. -RUN --mount=type=cache,id=xE0e05wx0-m2/repository,target=/app/.m2/repository chmod +x ./mvnw -RUN --mount=type=cache,id=xE0e05wx0-m2/repository,target=/app/.m2/repository ./mvnw -DskipTests clean package - - - - -# start -COPY . /app -CMD ["java -Dserver.port=$PORT $JAVA_OPTS -jar target/*jar"] - diff --git a/server/application-server/.nixpacks/build.sh b/server/application-server/.nixpacks/build.sh deleted file mode 100644 index 5709198b..00000000 --- a/server/application-server/.nixpacks/build.sh +++ /dev/null @@ -1 +0,0 @@ -docker build server/application-server -f server/application-server/.nixpacks/Dockerfile -t hephaestus-application-server --build-arg NIXPACKS_JDK_VERSION=21 --build-arg NIXPACKS_METADATA=java \ No newline at end of file diff --git a/server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix b/server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix deleted file mode 100644 index d31882a4..00000000 --- a/server/application-server/.nixpacks/nixpkgs-59dc10b5a6f2a592af36375c68fda41246794b86.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ }: - -let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/59dc10b5a6f2a592af36375c68fda41246794b86.tar.gz") { overlays = [ ]; }; -in with pkgs; - let - APPEND_LIBRARY_PATH = "${lib.makeLibraryPath [ ] }"; - myLibraries = writeText "libraries" '' - export LD_LIBRARY_PATH="${APPEND_LIBRARY_PATH}:$LD_LIBRARY_PATH" - - ''; - in - buildEnv { - name = "59dc10b5a6f2a592af36375c68fda41246794b86-env"; - paths = [ - (runCommand "59dc10b5a6f2a592af36375c68fda41246794b86-env" { } '' - mkdir -p $out/etc/profile.d - cp ${myLibraries} $out/etc/profile.d/59dc10b5a6f2a592af36375c68fda41246794b86-env.sh - '') - jdk21 maven - ]; - } diff --git a/server/application-server/Dockerfile b/server/application-server/Dockerfile new file mode 100644 index 00000000..19dcd62b --- /dev/null +++ b/server/application-server/Dockerfile @@ -0,0 +1,26 @@ +FROM maven:3.9.8-eclipse-temurin-21 AS build + +WORKDIR /app + +COPY pom.xml . + +# This step is to cache dependencies, avoiding re-downloading them every time +RUN mvn dependency:go-offline + +COPY src ./src + +RUN mvn clean package -DskipTests + +FROM eclipse-temurin:21 + +WORKDIR /app + +COPY --from=build /app/target/*.jar /app/server.jar + +RUN addgroup --system spring && adduser --system spring --ingroup spring + +USER spring:spring + +EXPOSE 8080 + +ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app/server.jar"] \ No newline at end of file diff --git a/server/application-server/nixpacks.toml b/server/application-server/nixpacks.toml deleted file mode 100644 index c7cd6ac8..00000000 --- a/server/application-server/nixpacks.toml +++ /dev/null @@ -1,8 +0,0 @@ -[variables] -NIXPACKS_JDK_VERSION = '21' - -[phases.setup] -aptPkgs = ["...", "wget"] - -[phases.build] -cmds = ["chmod +x ./mvnw", "./mvnw -DskipTests clean package"] \ No newline at end of file From 554adc4c39590f59e5d63befe968c2c9acc265d7 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Thu, 28 Nov 2024 21:29:58 +0100 Subject: [PATCH 07/27] fix path --- .github/workflows/build-and-push-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index 0efb2ded..0c426a15 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -37,7 +37,7 @@ jobs: image: ghcr.io/ls1intum/Hephaestus/hephaestus-webhook-ingest context: ./server/webhook-ingest path: server/webhook-ingest - - dockerfile: ./server/application-server/.nixpacks/Dockerfile + - dockerfile: ./server/application-server/Dockerfile image: ghcr.io/ls1intum/Hephaestus/hephaestus-application-server context: ./server/application-server path: server/application-server From fe3fa5f80fb7905d0831884e507313c51d69dbeb Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Thu, 28 Nov 2024 21:37:35 +0100 Subject: [PATCH 08/27] Trigger Build From 79788741cb04183ce910dc41802e0ab32217c9b5 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Thu, 28 Nov 2024 21:45:22 +0100 Subject: [PATCH 09/27] cache layers --- .github/workflows/build-and-push-docker-image.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index 0c426a15..dec47a28 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -81,4 +81,6 @@ jobs: platforms: ${{ inputs.platforms }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - push: true \ No newline at end of file + push: true + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file From 779fc3f479785a6c19f713fc2e87c498c77c65ae Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Thu, 28 Nov 2024 21:52:27 +0100 Subject: [PATCH 10/27] Trigger Build From 4b7e857c4f0624871d19238a02163cd064b91e5f Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Thu, 28 Nov 2024 22:01:24 +0100 Subject: [PATCH 11/27] optimize webapp --- webapp/Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 2b45d02b..77c317ae 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -1,8 +1,12 @@ -FROM node:latest as build +FROM node:22 as build WORKDIR /app -COPY ./ /app/ +COPY package.json package-lock.json ./ + +RUN npm install + +COPY . ./ # Ensure .env file exists RUN mv .env* .env || true @@ -43,13 +47,14 @@ export const environment = { }; EOF -RUN npm install RUN npm run build -FROM nginx:latest +FROM nginx:stable-alpine COPY --from=build /app/dist/webapp/browser /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] From 256f7c51078d1a29b70c8b9d77c354ef9f6526ce Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Thu, 28 Nov 2024 22:07:15 +0100 Subject: [PATCH 12/27] Trigger Build From 6ce51c136135470b7969855c54023e6d9a45f606 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 19:35:16 +0100 Subject: [PATCH 13/27] fix webapp env --- webapp/Dockerfile | 59 +++++++------------ webapp/angular.json | 6 -- webapp/generate_config.sh | 27 +++++++++ webapp/package-lock.json | 19 +++--- webapp/package.json | 1 + webapp/public/environment.json | 20 +++++++ webapp/src/app/analytics.service.ts | 14 +++-- webapp/src/app/app.config.ts | 15 +++-- .../src/app/core/header/header.component.ts | 12 ++-- .../src/app/core/security/keycloak.service.ts | 14 +++-- webapp/src/app/environment.service.ts | 48 +++++++++++++++ webapp/src/app/home/home.component.ts | 4 +- .../filter/timeframe/timeframe.component.ts | 4 +- webapp/src/app/legal/imprint.component.ts | 7 ++- webapp/src/app/legal/privacy.component.ts | 7 ++- .../src/app/user/header/header.component.ts | 4 +- webapp/src/app/user/header/header.stories.ts | 2 +- .../user/issue-card/issue-card.component.ts | 2 +- .../review-activity-card.component.ts | 4 +- .../review-activity-card.stories.ts | 2 +- webapp/src/environments/environment.prod.ts | 20 ------- webapp/src/environments/environment.ts | 20 ------- webapp/tsconfig.app.json | 2 +- webapp/tsconfig.json | 1 + 24 files changed, 181 insertions(+), 133 deletions(-) create mode 100644 webapp/generate_config.sh create mode 100644 webapp/public/environment.json create mode 100644 webapp/src/app/environment.service.ts delete mode 100644 webapp/src/environments/environment.prod.ts delete mode 100644 webapp/src/environments/environment.ts diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 77c317ae..e2b127af 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -8,53 +8,34 @@ RUN npm install COPY . ./ -# Ensure .env file exists -RUN mv .env* .env || true -RUN touch .env -RUN cat .env - -# Fix buggy replacement of COOLIFY_URL in .env -RUN COOLIFY_URL_VALUE=$(grep '^COOLIFY_URL=' .env | cut -d '=' -f2) && \ - sed -i "s|\$COOLIFY_URL|$COOLIFY_URL_VALUE|g" .env - -# Export environment variables from .env -# This assumes that .env contains lines like VARIABLE=value -# and does not contain spaces around the '=' -RUN set -a && \ - . /app/.env && \ - set +a && \ - echo "Generating environment.prod.ts" && \ - cat > src/environments/environment.prod.ts < /usr/share/nginx/html/environment.json +{ + "clientUrl": "${APPLICATION_CLIENT_URL}", + "serverUrl": "${APPLICATION_SERVER_URL}", + "keycloak": { + "url": "${KEYCLOAK_URL}", + "realm": "${KEYCLOAK_REALM}", + "clientId": "${KEYCLOAK_CLIENT_ID}", + "skipLoginPage": ${KEYCLOAK_SKIP_LOGIN} + }, + "umami": { + "enabled": ${UMAMI_ENABLED}, + "scriptUrl": "${UMAMI_SCRIPT_URL}", + "websiteId": "${UMAMI_WEBSITE_ID}", + "domains": "${UMAMI_DOMAINS}" + }, + "legal": { + "imprintHtml": "$(echo "${LEGAL_IMPRINT_HTML}" | sed 's/"/\\"/g')", + "privacyHtml": "$(echo "${LEGAL_PRIVACY_HTML}" | sed 's/"/\\"/g')" + } +} +EOF + +exec "$@" diff --git a/webapp/package-lock.json b/webapp/package-lock.json index 19f24322..ed06a5a0 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -80,6 +80,7 @@ "@storybook/test": "8.3.4", "@tailwindcss/typography": "0.5.15", "@types/jasmine": "5.1.4", + "@types/node": "22.10.1", "@typescript-eslint/eslint-plugin": "8.2.0", "@typescript-eslint/parser": "8.2.0", "chromatic": "11.7.1", @@ -8374,12 +8375,13 @@ } }, "node_modules/@types/node": { - "version": "22.7.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", - "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", + "version": "22.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", + "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", "devOptional": true, + "license": "MIT", "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.20.0" } }, "node_modules/@types/node-forge": { @@ -21996,10 +21998,11 @@ } }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "devOptional": true + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "devOptional": true, + "license": "MIT" }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.1", diff --git a/webapp/package.json b/webapp/package.json index 1aa1854f..89eb8672 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -92,6 +92,7 @@ "@storybook/test": "8.3.4", "@tailwindcss/typography": "0.5.15", "@types/jasmine": "5.1.4", + "@types/node": "22.10.1", "@typescript-eslint/eslint-plugin": "8.2.0", "@typescript-eslint/parser": "8.2.0", "chromatic": "11.7.1", diff --git a/webapp/public/environment.json b/webapp/public/environment.json new file mode 100644 index 00000000..d90af7dd --- /dev/null +++ b/webapp/public/environment.json @@ -0,0 +1,20 @@ +{ + "clientUrl": "http://localhost:4200", + "serverUrl": "http://localhost:8080", + "keycloak": { + "url": "http://localhost:8081", + "realm": "hephaestus", + "clientId": "hephaestus", + "skipLoginPage": false + }, + "umami": { + "enabled": false, + "scriptUrl": "", + "websiteId": "", + "domains": "" + }, + "legal": { + "imprintHtml": "

This is the imprint.

", + "privacyHtml": "

This is the privacy policy.

" + } +} diff --git a/webapp/src/app/analytics.service.ts b/webapp/src/app/analytics.service.ts index b74d050e..b4194805 100644 --- a/webapp/src/app/analytics.service.ts +++ b/webapp/src/app/analytics.service.ts @@ -1,14 +1,16 @@ -import { Injectable } from '@angular/core'; -import { environment } from 'environments/environment'; +import { inject, Injectable } from '@angular/core'; +import { EnvironmentService } from './environment.service'; @Injectable({ providedIn: 'root' }) export class AnalyticsService { + private environmentService = inject(EnvironmentService); + private scriptLoaded = false; initialize(): void { - if (environment.umami.enabled) { + if (this.environmentService.env.umami.enabled) { this.loadUmamiScript(); } } @@ -20,9 +22,9 @@ export class AnalyticsService { const script = document.createElement('script'); script.defer = true; - script.src = environment.umami.scriptUrl; - script.setAttribute('data-website-id', environment.umami.websiteId); - script.setAttribute('data-domains', environment.umami.domains); + script.src = this.environmentService.env.umami.scriptUrl; + script.setAttribute('data-website-id', this.environmentService.env.umami.websiteId); + script.setAttribute('data-domains', this.environmentService.env.umami.domains); script.onload = () => { console.log('Umami analytics script loaded successfully.'); diff --git a/webapp/src/app/app.config.ts b/webapp/src/app/app.config.ts index 4e64ab39..597c30af 100644 --- a/webapp/src/app/app.config.ts +++ b/webapp/src/app/app.config.ts @@ -1,16 +1,17 @@ -import { APP_INITIALIZER, ApplicationConfig, provideExperimentalZonelessChangeDetection } from '@angular/core'; +import { APP_INITIALIZER, ApplicationConfig, inject, provideExperimentalZonelessChangeDetection } from '@angular/core'; import { provideRouter } from '@angular/router'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import { provideHttpClient, withInterceptors } from '@angular/common/http'; import { provideAngularQuery, QueryClient } from '@tanstack/angular-query-experimental'; -import { environment } from 'environments/environment'; import { BASE_PATH } from 'app/core/modules/openapi'; import { routes } from 'app/app.routes'; import { AnalyticsService } from './analytics.service'; import { securityInterceptor } from './core/security/security-interceptor'; +import { EnvironmentService } from './environment.service'; -function initializeAnalytics(analyticsService: AnalyticsService): () => void { +function initializeApp(environmentService: EnvironmentService, analyticsService: AnalyticsService) { return () => { + environmentService.loadEnv(); analyticsService.initialize(); }; } @@ -22,7 +23,11 @@ export const appConfig: ApplicationConfig = { provideAngularQuery(new QueryClient()), provideHttpClient(withInterceptors([securityInterceptor])), provideAnimationsAsync(), - { provide: BASE_PATH, useValue: environment.serverUrl }, - { provide: APP_INITIALIZER, useFactory: initializeAnalytics, multi: true, deps: [AnalyticsService] } + { provide: APP_INITIALIZER, useFactory: initializeApp, multi: true, deps: [EnvironmentService, AnalyticsService] }, + { + provide: BASE_PATH, + useFactory: (environmentService: EnvironmentService) => environmentService.env.serverUrl, + deps: [EnvironmentService] + } ] }; diff --git a/webapp/src/app/core/header/header.component.ts b/webapp/src/app/core/header/header.component.ts index d48ce032..3f851ec0 100644 --- a/webapp/src/app/core/header/header.component.ts +++ b/webapp/src/app/core/header/header.component.ts @@ -9,9 +9,9 @@ import { BrnMenuTriggerDirective } from '@spartan-ng/ui-menu-brain'; import { SecurityStore } from '@app/core/security/security-store.service'; import { ThemeSwitcherComponent } from '@app/core/theme/theme-switcher.component'; import { RequestFeatureComponent } from './request-feature/request-feature.component'; -import { environment } from 'environments/environment'; import { lucideUser, lucideLogOut, lucideSettings } from '@ng-icons/lucide'; import { provideIcons } from '@ng-icons/core'; +import { EnvironmentService } from '@app/environment.service'; @Component({ selector: 'app-header', @@ -38,6 +38,8 @@ import { provideIcons } from '@ng-icons/core'; ] }) export class HeaderComponent { + private environmentService = inject(EnvironmentService); + protected Hammer = Hammer; securityStore = inject(SecurityStore); @@ -49,11 +51,11 @@ export class HeaderComponent { } protected signIn() { - if (environment.keycloak.skipLoginPage) { + if (this.environmentService.env.keycloak.skipLoginPage) { const authUrl = - `${environment.keycloak.url}/realms/${environment.keycloak.realm}/protocol/openid-connect/auth` + - `?client_id=${encodeURIComponent(environment.keycloak.clientId)}` + - `&redirect_uri=${encodeURIComponent(environment.clientUrl)}` + + `${this.environmentService.env.keycloak.url}/realms/${this.environmentService.env.keycloak.realm}/protocol/openid-connect/auth` + + `?client_id=${encodeURIComponent(this.environmentService.env.keycloak.clientId)}` + + `&redirect_uri=${encodeURIComponent(this.environmentService.env.clientUrl)}` + `&response_type=code` + `&scope=openid` + `&kc_idp_hint=${encodeURIComponent('github')}`; diff --git a/webapp/src/app/core/security/keycloak.service.ts b/webapp/src/app/core/security/keycloak.service.ts index cfd61d7c..055eb34b 100644 --- a/webapp/src/app/core/security/keycloak.service.ts +++ b/webapp/src/app/core/security/keycloak.service.ts @@ -1,5 +1,5 @@ -import { Injectable } from '@angular/core'; -import { environment } from 'environments/environment'; +import { inject, Injectable } from '@angular/core'; +import { EnvironmentService } from '@app/environment.service'; import Keycloak from 'keycloak-js'; export interface UserProfile { @@ -17,6 +17,8 @@ export interface UserProfile { @Injectable({ providedIn: 'root' }) export class KeycloakService { + private environmentService = inject(EnvironmentService); + _keycloak: Keycloak | undefined; profile: UserProfile | undefined; tokenRefreshInterval = 60; // in seconds @@ -24,9 +26,9 @@ export class KeycloakService { get keycloak() { if (!this._keycloak) { this._keycloak = new Keycloak({ - url: environment.keycloak.url, - realm: environment.keycloak.realm, - clientId: environment.keycloak.clientId + url: this.environmentService.env.keycloak.url, + realm: this.environmentService.env.keycloak.realm, + clientId: this.environmentService.env.keycloak.clientId }); } return this._keycloak; @@ -73,6 +75,6 @@ export class KeycloakService { } logout() { - return this.keycloak.logout({ redirectUri: environment.clientUrl }); + return this.keycloak.logout({ redirectUri: this.environmentService.env.clientUrl }); } } diff --git a/webapp/src/app/environment.service.ts b/webapp/src/app/environment.service.ts new file mode 100644 index 00000000..32281f50 --- /dev/null +++ b/webapp/src/app/environment.service.ts @@ -0,0 +1,48 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { lastValueFrom } from 'rxjs'; + +export interface Environment { + clientUrl: string; + serverUrl: string; + keycloak: { + url: string; + realm: string; + clientId: string; + skipLoginPage: boolean; + }; + umami: { + enabled: boolean; + scriptUrl: string; + websiteId: string; + domains: string; + }; + legal: { + imprintHtml: string; + privacyHtml: string; + }; +} + +@Injectable({ + providedIn: 'root' +}) +export class EnvironmentService { + private config!: Environment; + + constructor(private http: HttpClient) {} + + loadEnv() { + return lastValueFrom(this.http.get('/environment.json')) + .then((config) => { + this.config = config; + console.log('Config loaded successfully.', this.config); + }) + .catch((error) => { + console.error('Error loading config.', error); + }); + } + + get env(): Environment { + return this.config; + } +} diff --git a/webapp/src/app/home/home.component.ts b/webapp/src/app/home/home.component.ts index 8a884ab1..eee831f9 100644 --- a/webapp/src/app/home/home.component.ts +++ b/webapp/src/app/home/home.component.ts @@ -1,5 +1,5 @@ -import dayjs from 'dayjs'; -import isoWeek from 'dayjs/plugin/isoWeek'; +import dayjs from 'dayjs/esm'; +import isoWeek from 'dayjs/esm/plugin/isoWeek'; import { lastValueFrom } from 'rxjs'; import { Component, computed, inject } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; diff --git a/webapp/src/app/home/leaderboard/filter/timeframe/timeframe.component.ts b/webapp/src/app/home/leaderboard/filter/timeframe/timeframe.component.ts index 39f7ba44..fe74151e 100644 --- a/webapp/src/app/home/leaderboard/filter/timeframe/timeframe.component.ts +++ b/webapp/src/app/home/leaderboard/filter/timeframe/timeframe.component.ts @@ -1,8 +1,8 @@ import { Component, computed, effect, inject, signal } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import dayjs from 'dayjs'; -import isoWeek from 'dayjs/plugin/isoWeek'; +import dayjs from 'dayjs/esm'; +import isoWeek from 'dayjs/esm/plugin/isoWeek'; import { BrnSelectModule } from '@spartan-ng/ui-select-brain'; import { HlmSelectModule } from '@spartan-ng/ui-select-helm'; import { HlmLabelModule } from '@spartan-ng/ui-label-helm'; diff --git a/webapp/src/app/legal/imprint.component.ts b/webapp/src/app/legal/imprint.component.ts index 1337b3d7..a07d84f8 100644 --- a/webapp/src/app/legal/imprint.component.ts +++ b/webapp/src/app/legal/imprint.component.ts @@ -1,5 +1,5 @@ -import { Component } from '@angular/core'; -import { environment } from 'environments/environment'; +import { Component, inject } from '@angular/core'; +import { EnvironmentService } from '@app/environment.service'; @Component({ selector: 'app-imprint', @@ -12,5 +12,6 @@ import { environment } from 'environments/environment'; ` }) export class ImprintComponent { - imprintHtml = environment.legal.imprintHtml; + private environmentService = inject(EnvironmentService); + imprintHtml = this.environmentService.env.legal.imprintHtml; } diff --git a/webapp/src/app/legal/privacy.component.ts b/webapp/src/app/legal/privacy.component.ts index 18a1d61b..1b1128c5 100644 --- a/webapp/src/app/legal/privacy.component.ts +++ b/webapp/src/app/legal/privacy.component.ts @@ -1,5 +1,5 @@ -import { Component } from '@angular/core'; -import { environment } from 'environments/environment'; +import { Component, inject } from '@angular/core'; +import { EnvironmentService } from '@app/environment.service'; @Component({ selector: 'app-privacy', @@ -12,5 +12,6 @@ import { environment } from 'environments/environment'; ` }) export class PrivacyComponent { - imprintHtml = environment.legal.privacyHtml; + private environmentService = inject(EnvironmentService); + imprintHtml = this.environmentService.env.legal.privacyHtml; } diff --git a/webapp/src/app/user/header/header.component.ts b/webapp/src/app/user/header/header.component.ts index f232a8a5..07243d27 100644 --- a/webapp/src/app/user/header/header.component.ts +++ b/webapp/src/app/user/header/header.component.ts @@ -7,8 +7,8 @@ import { HlmIconModule } from 'libs/ui/ui-icon-helm/src/index'; import { BrnTooltipContentDirective } from '@spartan-ng/ui-tooltip-brain'; import { HlmTooltipComponent, HlmTooltipTriggerDirective } from '@spartan-ng/ui-tooltip-helm'; import { HlmButtonModule } from '@spartan-ng/ui-button-helm'; -import dayjs from 'dayjs'; -import advancedFormat from 'dayjs/plugin/advancedFormat'; +import dayjs from 'dayjs/esm'; +import advancedFormat from 'dayjs/esm/plugin/advancedFormat'; import { RepositoryInfo, UserInfo } from '@app/core/modules/openapi'; dayjs.extend(advancedFormat); diff --git a/webapp/src/app/user/header/header.stories.ts b/webapp/src/app/user/header/header.stories.ts index 31656f02..660b1315 100644 --- a/webapp/src/app/user/header/header.stories.ts +++ b/webapp/src/app/user/header/header.stories.ts @@ -1,5 +1,5 @@ import { argsToTemplate, Meta, StoryObj } from '@storybook/angular'; -import dayjs from 'dayjs'; +import dayjs from 'dayjs/esm'; import { UserHeaderComponent } from './header.component'; type FlatArgs = { diff --git a/webapp/src/app/user/issue-card/issue-card.component.ts b/webapp/src/app/user/issue-card/issue-card.component.ts index a4b93fbb..3d200831 100644 --- a/webapp/src/app/user/issue-card/issue-card.component.ts +++ b/webapp/src/app/user/issue-card/issue-card.component.ts @@ -5,7 +5,7 @@ import { octCheck, octComment, octFileDiff, octGitPullRequest, octGitPullRequest import { HlmCardModule } from '@spartan-ng/ui-card-helm'; import { HlmSkeletonComponent } from '@spartan-ng/ui-skeleton-helm'; import { GithubLabelComponent } from '@app/ui/github-label/github-label.component'; -import dayjs from 'dayjs'; +import dayjs from 'dayjs/esm'; import { cn } from '@app/utils'; @Component({ diff --git a/webapp/src/app/user/review-activity-card/review-activity-card.component.ts b/webapp/src/app/user/review-activity-card/review-activity-card.component.ts index 241e5c90..abe52943 100644 --- a/webapp/src/app/user/review-activity-card/review-activity-card.component.ts +++ b/webapp/src/app/user/review-activity-card/review-activity-card.component.ts @@ -7,8 +7,8 @@ import { HlmSkeletonComponent } from '@spartan-ng/ui-skeleton-helm'; import { HlmIconComponent } from '@spartan-ng/ui-icon-helm'; import { HlmTooltipTriggerDirective } from '@spartan-ng/ui-tooltip-helm'; import { HlmButtonModule } from '@spartan-ng/ui-button-helm'; -import dayjs from 'dayjs'; -import relativeTime from 'dayjs/plugin/relativeTime'; +import dayjs from 'dayjs/esm'; +import relativeTime from 'dayjs/esm/plugin/relativeTime'; import { lucideAward } from '@ng-icons/lucide'; dayjs.extend(relativeTime); diff --git a/webapp/src/app/user/review-activity-card/review-activity-card.stories.ts b/webapp/src/app/user/review-activity-card/review-activity-card.stories.ts index 93884e71..d7eb743c 100644 --- a/webapp/src/app/user/review-activity-card/review-activity-card.stories.ts +++ b/webapp/src/app/user/review-activity-card/review-activity-card.stories.ts @@ -1,6 +1,6 @@ import { argsToTemplate, Meta, StoryObj } from '@storybook/angular'; import { ReviewActivityCardComponent } from './review-activity-card.component'; -import dayjs from 'dayjs'; +import dayjs from 'dayjs/esm'; type FlatArgs = { isLoading: boolean; diff --git a/webapp/src/environments/environment.prod.ts b/webapp/src/environments/environment.prod.ts deleted file mode 100644 index c7e2ad97..00000000 --- a/webapp/src/environments/environment.prod.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const environment = { - clientUrl: 'http://localhost:4200', - serverUrl: 'http://localhost:8080', - keycloak: { - url: 'http://localhost:8081', - realm: 'hephaestus', - clientId: 'hephaestus', - skipLoginPage: false // If true, it will directly use github IDP for login - }, - umami: { - enabled: false, - scriptUrl: '', - websiteId: '', - domains: '' - }, - legal: { - imprintHtml: '

This is the imprint.

', - privacyHtml: '

This is the privacy policy.

' - } -}; diff --git a/webapp/src/environments/environment.ts b/webapp/src/environments/environment.ts deleted file mode 100644 index c7e2ad97..00000000 --- a/webapp/src/environments/environment.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const environment = { - clientUrl: 'http://localhost:4200', - serverUrl: 'http://localhost:8080', - keycloak: { - url: 'http://localhost:8081', - realm: 'hephaestus', - clientId: 'hephaestus', - skipLoginPage: false // If true, it will directly use github IDP for login - }, - umami: { - enabled: false, - scriptUrl: '', - websiteId: '', - domains: '' - }, - legal: { - imprintHtml: '

This is the imprint.

', - privacyHtml: '

This is the privacy policy.

' - } -}; diff --git a/webapp/tsconfig.app.json b/webapp/tsconfig.app.json index 3775b37e..e2722e2f 100644 --- a/webapp/tsconfig.app.json +++ b/webapp/tsconfig.app.json @@ -4,7 +4,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", - "types": [] + "types": ["node"] }, "files": [ "src/main.ts" diff --git a/webapp/tsconfig.json b/webapp/tsconfig.json index 90dcda75..4f92768e 100644 --- a/webapp/tsconfig.json +++ b/webapp/tsconfig.json @@ -2,6 +2,7 @@ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", + "types": ["node"], "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, From 7f7f07f0c18925ec9133393988c72e32c7aa20c0 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 19:39:31 +0100 Subject: [PATCH 14/27] fix caching --- .github/workflows/build-and-push-docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index dec47a28..ce986628 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -82,5 +82,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} push: true - cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-from: type=gha,scope=${{ matrix.path }} + cache-to: type=gha,scope=${{ matrix.path }},mode=max \ No newline at end of file From 98a71738a989dad6ee4c37a93c41c6c67d4cd3c7 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 19:43:20 +0100 Subject: [PATCH 15/27] fix cache --- .github/workflows/build-and-push-docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index ce986628..5db9ddb8 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -82,5 +82,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} push: true - cache-from: type=gha,scope=${{ matrix.path }} - cache-to: type=gha,scope=${{ matrix.path }},mode=max \ No newline at end of file + cache-from: type=gha,ref=${{ matrix.image }}:buildcache + cache-to: type=gha,ref=${{ matrix.image }}:buildcache,mode=max \ No newline at end of file From 5bb99fb84f469d0de2aa4d1762821693a4ab8083 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 19:49:48 +0100 Subject: [PATCH 16/27] fix workflow --- ...er-image.yml => build-and-push-docker.yml} | 51 +++++++++---------- .github/workflows/dev.yml | 20 -------- 2 files changed, 25 insertions(+), 46 deletions(-) rename .github/workflows/{build-and-push-docker-image.yml => build-and-push-docker.yml} (63%) delete mode 100644 .github/workflows/dev.yml diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker.yml similarity index 63% rename from .github/workflows/build-and-push-docker-image.yml rename to .github/workflows/build-and-push-docker.yml index 5db9ddb8..2475bf44 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -1,22 +1,21 @@ -name: Build and Push Docker Image +name: Build and Push Docker Images on: - workflow_call: - inputs: - platforms: - type: string - description: "List of platforms for which to build the image" - default: linux/amd64,linux/arm64 - registry: - type: string - default: ghcr.io - description: "The registry to push the image to (Default: ghcr.io)" - - secrets: - registry-user: - required: false - registry-password: - required: false + pull_request: + paths-ignore: + - 'README.md' + - 'CODE_OF_CONDUCT.md' + - 'CONTRIBUTING.md' + - 'LICENSE' + - 'SECURITY.md' + - 'docs/**' + - 'keycloakify/**' + - '.github/**' + - '!.github/workflows/build-and-push-docker-image.yml' + - '!.github/workflows/dev.yml' + push: + branches: + - develop jobs: build: @@ -26,19 +25,19 @@ jobs: matrix: include: - dockerfile: ./webapp/Dockerfile - image: ghcr.io/ls1intum/Hephaestus/hephaestus-webapp + image: ls1intum/Hephaestus/hephaestus-webapp context: ./webapp path: webapp - dockerfile: ./server/intelligence-service/Dockerfile - image: ghcr.io/ls1intum/Hephaestus/hephaestus-intelligence-service + image: ls1intum/Hephaestus/hephaestus-intelligence-service context: ./server/intelligence-service path: server/intelligence-service - dockerfile: ./server/webhook-ingest/Dockerfile - image: ghcr.io/ls1intum/Hephaestus/hephaestus-webhook-ingest + image: ls1intum/Hephaestus/hephaestus-webhook-ingest context: ./server/webhook-ingest path: server/webhook-ingest - dockerfile: ./server/application-server/Dockerfile - image: ghcr.io/ls1intum/Hephaestus/hephaestus-application-server + image: ls1intum/Hephaestus/hephaestus-application-server context: ./server/application-server path: server/application-server @@ -59,15 +58,15 @@ jobs: - name: Log in to the Container registry uses: docker/login-action@v3 with: - registry: ${{ inputs.registry }} - username: ${{ secrets.registry-user || github.actor }} - password: ${{ secrets.registry-password || secrets.GITHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: - images: ${{ inputs.registry }}/${{ matrix.image }} + images: ghcr.io/${{ matrix.image }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch @@ -78,7 +77,7 @@ jobs: with: context: ${{ matrix.context }} file: ${{ matrix.dockerfile }} - platforms: ${{ inputs.platforms }} + platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} push: true diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml deleted file mode 100644 index 7f740eb5..00000000 --- a/.github/workflows/dev.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Build and Deploy to Dev - -on: - pull_request: - paths-ignore: - - 'README.md' - - 'CODE_OF_CONDUCT.md' - - 'CONTRIBUTING.md' - - 'LICENSE' - - 'SECURITY.md' - - 'docs/**' - - 'keycloakify/**' - - '.github/**' - - '!.github/workflows/build-and-push-docker-image.yml' - - '!.github/workflows/dev.yml' - -jobs: - build-dev-container: - uses: ./.github/workflows/build-and-push-docker-image.yml - secrets: inherit \ No newline at end of file From af4bed54ea9b4f367eefc3db9049de1da3ecdfe1 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 19:54:48 +0100 Subject: [PATCH 17/27] scope caches? --- .github/workflows/build-and-push-docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index 2475bf44..393cbb24 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -81,5 +81,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} push: true - cache-from: type=gha,ref=${{ matrix.image }}:buildcache - cache-to: type=gha,ref=${{ matrix.image }}:buildcache,mode=max \ No newline at end of file + cache-from: type=gha,scope=${{ matrix.image }} + cache-to: type=gha,scope=${{ matrix.image }},mode=max \ No newline at end of file From a203ef232c86a17781718801a73b255006bfefc8 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 20:03:19 +0100 Subject: [PATCH 18/27] fix stuff --- .github/workflows/build-and-push-docker.yml | 7 ++++--- webapp/src/app/app.config.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index 393cbb24..8cb928a1 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -19,6 +19,7 @@ on: jobs: build: + name: ${{ matrix.path }} runs-on: ubuntu-latest strategy: fail-fast: false @@ -31,15 +32,15 @@ jobs: - dockerfile: ./server/intelligence-service/Dockerfile image: ls1intum/Hephaestus/hephaestus-intelligence-service context: ./server/intelligence-service - path: server/intelligence-service + path: intelligence-service - dockerfile: ./server/webhook-ingest/Dockerfile image: ls1intum/Hephaestus/hephaestus-webhook-ingest context: ./server/webhook-ingest - path: server/webhook-ingest + path: webhook-ingest - dockerfile: ./server/application-server/Dockerfile image: ls1intum/Hephaestus/hephaestus-application-server context: ./server/application-server - path: server/application-server + path: application-server steps: - name: Checkout diff --git a/webapp/src/app/app.config.ts b/webapp/src/app/app.config.ts index 597c30af..a0e6580e 100644 --- a/webapp/src/app/app.config.ts +++ b/webapp/src/app/app.config.ts @@ -1,4 +1,4 @@ -import { APP_INITIALIZER, ApplicationConfig, inject, provideExperimentalZonelessChangeDetection } from '@angular/core'; +import { APP_INITIALIZER, ApplicationConfig, provideExperimentalZonelessChangeDetection } from '@angular/core'; import { provideRouter } from '@angular/router'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import { provideHttpClient, withInterceptors } from '@angular/common/http'; From d3e6f084dd5da8a7a81e0a8e8cf4a1a9f1f2dc37 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 20:24:51 +0100 Subject: [PATCH 19/27] add debug tags --- .github/workflows/build-and-push-docker.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index 8cb928a1..cc503675 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -26,19 +26,19 @@ jobs: matrix: include: - dockerfile: ./webapp/Dockerfile - image: ls1intum/Hephaestus/hephaestus-webapp + image: ls1intum/Hephaestus/webapp context: ./webapp path: webapp - dockerfile: ./server/intelligence-service/Dockerfile - image: ls1intum/Hephaestus/hephaestus-intelligence-service + image: ls1intum/Hephaestus/intelligence-service context: ./server/intelligence-service path: intelligence-service - dockerfile: ./server/webhook-ingest/Dockerfile - image: ls1intum/Hephaestus/hephaestus-webhook-ingest + image: ls1intum/Hephaestus/webhook-ingest context: ./server/webhook-ingest path: webhook-ingest - dockerfile: ./server/application-server/Dockerfile - image: ls1intum/Hephaestus/hephaestus-application-server + image: ls1intum/Hephaestus/application-server context: ./server/application-server path: application-server @@ -72,6 +72,7 @@ jobs: type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch type=ref,event=pr + type=semver,pattern={{version}} - name: Build and push Docker Image uses: docker/build-push-action@v6 @@ -83,4 +84,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} push: true cache-from: type=gha,scope=${{ matrix.image }} - cache-to: type=gha,scope=${{ matrix.image }},mode=max \ No newline at end of file + cache-to: type=gha,scope=${{ matrix.image }},mode=max + + - name: Debug Tags + run: echo "${{ steps.meta.outputs.tags }}" From 7ac520fd221ff365e7fe6e22eb0c59e65b6dda7d Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 20:33:38 +0100 Subject: [PATCH 20/27] add sha --- .github/workflows/build-and-push-docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index cc503675..6ac29ee9 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -73,6 +73,7 @@ jobs: type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} + type=sha - name: Build and push Docker Image uses: docker/build-push-action@v6 From 14041ad8c319191ccab9897548dec4e400735864 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 20:37:15 +0100 Subject: [PATCH 21/27] prefix sha --- .github/workflows/build-and-push-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index 6ac29ee9..da5a0b95 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -73,7 +73,7 @@ jobs: type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} - type=sha + type=sha,prefix={{branch}}- - name: Build and push Docker Image uses: docker/build-push-action@v6 From 0d45241fe98ab4c547e3d61e088a3d717dc889b2 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 20:47:50 +0100 Subject: [PATCH 22/27] change tags --- .github/workflows/build-and-push-docker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index da5a0b95..54e60fe9 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -71,9 +71,10 @@ jobs: tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch + type=ref,event=branch,suffix=-{{sha}} type=ref,event=pr + type=ref,event=pr,suffix=-{{sha}} type=semver,pattern={{version}} - type=sha,prefix={{branch}}- - name: Build and push Docker Image uses: docker/build-push-action@v6 From 3975400c815a71f3648e3b5f71c293a2299e5a6e Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 20:56:34 +0100 Subject: [PATCH 23/27] remove tags --- .github/workflows/build-and-push-docker.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index 54e60fe9..6bd8e032 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -71,9 +71,7 @@ jobs: tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch - type=ref,event=branch,suffix=-{{sha}} type=ref,event=pr - type=ref,event=pr,suffix=-{{sha}} type=semver,pattern={{version}} - name: Build and push Docker Image @@ -87,6 +85,3 @@ jobs: push: true cache-from: type=gha,scope=${{ matrix.image }} cache-to: type=gha,scope=${{ matrix.image }},mode=max - - - name: Debug Tags - run: echo "${{ steps.meta.outputs.tags }}" From a4e382858f9d383db22167e2b34f08b5b65abacc Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 20:59:29 +0100 Subject: [PATCH 24/27] add long sha --- .github/workflows/build-and-push-docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index 6bd8e032..a42d7d85 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -73,6 +73,7 @@ jobs: type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} + type=sha,prefix=,format=long - name: Build and push Docker Image uses: docker/build-push-action@v6 From d98a1e22ac2c2f7f7ec0db9a3fe5c6d6942190f6 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 1 Dec 2024 21:12:16 +0100 Subject: [PATCH 25/27] fix client env in dev --- webapp/src/app/environment.service.ts | 29 +++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/webapp/src/app/environment.service.ts b/webapp/src/app/environment.service.ts index 32281f50..30935a55 100644 --- a/webapp/src/app/environment.service.ts +++ b/webapp/src/app/environment.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, isDevMode } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { lastValueFrom } from 'rxjs'; @@ -27,22 +27,29 @@ export interface Environment { providedIn: 'root' }) export class EnvironmentService { - private config!: Environment; + private environment!: Environment; constructor(private http: HttpClient) {} loadEnv() { - return lastValueFrom(this.http.get('/environment.json')) - .then((config) => { - this.config = config; - console.log('Config loaded successfully.', this.config); - }) - .catch((error) => { - console.error('Error loading config.', error); - }); + if (isDevMode()) { + // eslint-disable-next-line @typescript-eslint/no-require-imports + const environment = require('../../public/environment.json') as Environment; + this.environment = environment; + return Promise.resolve(); + } else { + return lastValueFrom(this.http.get('/environment.json')) + .then((environment) => { + this.environment = environment; + console.log('Environment loaded successfully.', this.environment); + }) + .catch((error) => { + console.error('Error loading environment.', error); + }); + } } get env(): Environment { - return this.config; + return this.environment; } } From 42e04312ccaf149c43bbb8d05def8704616f38b0 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Mon, 9 Dec 2024 01:07:28 +0100 Subject: [PATCH 26/27] update stuff --- compose.yaml | 24 +++++++++++++++++++ package-lock.json | 2 ++ package.json | 1 + webapp/generate_config.sh | 7 ++++++ webapp/public/environment.json | 5 ++++ .../src/app/core/header/header.component.html | 1 + .../src/app/core/header/header.component.ts | 4 ++++ .../app/core/sentry/sentry.error-handler.ts | 10 ++++---- webapp/src/app/environment.service.ts | 5 ++++ 9 files changed, 54 insertions(+), 5 deletions(-) diff --git a/compose.yaml b/compose.yaml index 7c6a714b..1d5295aa 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,4 +1,28 @@ services: + webapp: + build: + context: ./webapp + ports: + - '80' + environment: + - APPLICATION_CLIENT_URL + - APPLICATION_SERVER_URL + - SENTRY_DNS + - KEYCLOAK_URL + - KEYCLOAK_REALM + - KEYCLOAK_CLIENT_ID + - KEYCLOAK_SKIP_LOGIN + - LEGAL_IMPRINT_HTML + - LEGAL_PRIVACY_HTML + - UMAMI_ENABLED + - UMAMI_SCRIPT_URL + - UMAMI_WEBSITE_ID + - UMAMI_DOMAINS + depends_on: + - application-server + networks: + - app-network + application-server: build: context: ./server/application-server diff --git a/package-lock.json b/package-lock.json index dc061d43..b5cc70c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,12 @@ { "name": "hephaestus", + "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hephaestus", + "version": "0.0.1", "workspaces": [ "webapp/*" ], diff --git a/package.json b/package.json index 7ae0df07..10200163 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "version": "0.0.1", "name": "hephaestus", "workspaces": [ "webapp/*" diff --git a/webapp/generate_config.sh b/webapp/generate_config.sh index 34a4dec1..c7f63c48 100644 --- a/webapp/generate_config.sh +++ b/webapp/generate_config.sh @@ -1,10 +1,17 @@ #!/bin/sh # This script generates the environment.json file for the webapp based on the environment variables during the docker container startup. +APP_VERSION=$(cat /version.txt) + cat < /usr/share/nginx/html/environment.json { + "version": "{$APP_VERSION}", "clientUrl": "${APPLICATION_CLIENT_URL}", "serverUrl": "${APPLICATION_SERVER_URL}", + "sentry": { + "dsn": "${SENTRY_DNS}", + "environment": "prod" + }, "keycloak": { "url": "${KEYCLOAK_URL}", "realm": "${KEYCLOAK_REALM}", diff --git a/webapp/public/environment.json b/webapp/public/environment.json index d90af7dd..6cea134c 100644 --- a/webapp/public/environment.json +++ b/webapp/public/environment.json @@ -1,6 +1,11 @@ { + "version": "dev", "clientUrl": "http://localhost:4200", "serverUrl": "http://localhost:8080", + "sentry": { + "dsn": "https://289f1f62feeb4f70a8878dc0101825cd@sentry.ase.in.tum.de/3", + "environment": "prod" + }, "keycloak": { "url": "http://localhost:8081", "realm": "hephaestus", diff --git a/webapp/src/app/core/header/header.component.html b/webapp/src/app/core/header/header.component.html index 955d44af..b47af1c0 100644 --- a/webapp/src/app/core/header/header.component.html +++ b/webapp/src/app/core/header/header.component.html @@ -3,6 +3,7 @@ + {{ appVersion }} @if (user()?.roles?.includes('admin')) { Workspace diff --git a/webapp/src/app/core/header/header.component.ts b/webapp/src/app/core/header/header.component.ts index ec870dfa..28e8d3bc 100644 --- a/webapp/src/app/core/header/header.component.ts +++ b/webapp/src/app/core/header/header.component.ts @@ -52,6 +52,10 @@ export class HeaderComponent { this.securityStore.signOut(); } + protected get appVersion() { + return this.environmentService.env.version; + } + protected signIn() { if (this.environmentService.env.keycloak.skipLoginPage) { const authUrl = diff --git a/webapp/src/app/core/sentry/sentry.error-handler.ts b/webapp/src/app/core/sentry/sentry.error-handler.ts index 2bde1073..357e88e7 100644 --- a/webapp/src/app/core/sentry/sentry.error-handler.ts +++ b/webapp/src/app/core/sentry/sentry.error-handler.ts @@ -1,10 +1,10 @@ -import { ErrorHandler, Injectable } from '@angular/core'; -import { environment } from 'environments/environment'; +import { ErrorHandler, inject, Injectable } from '@angular/core'; +import { EnvironmentService } from '@app/environment.service'; import * as Sentry from '@sentry/angular'; @Injectable({ providedIn: 'root' }) export class SentryErrorHandler extends ErrorHandler { - private environment = environment; + private environmentService = inject(EnvironmentService); constructor() { super(); @@ -14,7 +14,7 @@ export class SentryErrorHandler extends ErrorHandler { * Initialize Sentry with environment. */ async init() { - const env = this.environment; + const env = this.environmentService.env; if (!env || !env.version || !env.sentry?.dsn) { return; } @@ -38,7 +38,7 @@ export class SentryErrorHandler extends ErrorHandler { super.handleError(error); return; } - if (this.environment.sentry.environment !== 'local') { + if (this.environmentService.env.sentry.environment !== 'local') { const exception = error.error || error.message || error.originalError || error; Sentry.captureException(exception); } diff --git a/webapp/src/app/environment.service.ts b/webapp/src/app/environment.service.ts index 30935a55..64081ca0 100644 --- a/webapp/src/app/environment.service.ts +++ b/webapp/src/app/environment.service.ts @@ -3,8 +3,13 @@ import { HttpClient } from '@angular/common/http'; import { lastValueFrom } from 'rxjs'; export interface Environment { + version: string; clientUrl: string; serverUrl: string; + sentry: { + dsn: string; + environment: string; + }; keycloak: { url: string; realm: string; From 71c8082d5004fb1e01761d45baf6f9e9d6093888 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Mon, 9 Dec 2024 01:14:12 +0100 Subject: [PATCH 27/27] update env --- .../src/main/resources/application-prod.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/application-server/src/main/resources/application-prod.yml b/server/application-server/src/main/resources/application-prod.yml index 37fdd15c..a5bdbcb1 100644 --- a/server/application-server/src/main/resources/application-prod.yml +++ b/server/application-server/src/main/resources/application-prod.yml @@ -14,7 +14,7 @@ spring: issuer-uri: ${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM} hephaestus: - host-url: ${APPLICATION_HOST_URL} + host-url: ${APPLICATION_CLIENT_URL} leaderboard: schedule: @@ -33,8 +33,8 @@ hephaestus: keycloak: url: ${KEYCLOAK_URL} realm: ${KEYCLOAK_REALM} - client-id: ${KEYCLOAK_CLIENT_ID} - client-secret: ${KEYCLOAK_CLIENT_SECRET} + client-id: ${KEYCLOAK_CONFIDENTIAL_CLIENT_ID} + client-secret: ${KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET} nats: enabled: ${NATS_ENABLED:false}