From 4829b313301c9d2403456214d2d47cc05e7b0ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Placzy=C5=84ski?= Date: Thu, 25 Apr 2024 14:51:23 +0200 Subject: [PATCH 1/2] [#849] Fix broken docker compose In this commit, the docker-compose file was modified to include the `google-credentials.json` file as a secret volume. This change was made to ensure that the necessary Google credentials are available for the analytics service running on the `participation.sanchogov.tools` sub-domain. Including the `google-credentials.json` file in the docker-compose configuration is crucial for the proper functioning of the analytics dashboard service. --- scripts/govtool/config/templates/docker-compose.yml.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/govtool/config/templates/docker-compose.yml.tpl b/scripts/govtool/config/templates/docker-compose.yml.tpl index 4ec065705..e997a52b7 100644 --- a/scripts/govtool/config/templates/docker-compose.yml.tpl +++ b/scripts/govtool/config/templates/docker-compose.yml.tpl @@ -291,6 +291,8 @@ secrets: file: /home//config/dbsync-secrets/postgres_user backend-config.json: file: /home//config/backend-config.json + google-credentials.json: + file: /home//config/google-credentials.json volumes: letsencrypt: From af3051a7e6e28cbb5dbb5b7826476a38ca764b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Placzy=C5=84ski?= Date: Thu, 25 Apr 2024 14:52:16 +0200 Subject: [PATCH 2/2] [#849] Add build arg for docker image for analytics-dashboard In this commit, an argument (`NEXT_PUBLIC_API_URL`) was added to the `Dockerfile` of the analytics-dasboard service. This change is necessary to dynamically specify the API URL that the dashboard should connect to. By introducing this build arg, the analytics dashboard service can now adapt to different environments, like the `participation.sanchogov.tools` sub-domain, as part of configuring the analytics service under one domain tree. --- govtool/analytics-dashboard/Dockerfile | 3 ++- scripts/govtool/analytics-dashboard.mk | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/govtool/analytics-dashboard/Dockerfile b/govtool/analytics-dashboard/Dockerfile index 89776f804..6128db7ff 100644 --- a/govtool/analytics-dashboard/Dockerfile +++ b/govtool/analytics-dashboard/Dockerfile @@ -17,6 +17,7 @@ RUN \ # Rebuild the source code only when needed FROM base AS builder +ARG NEXT_PUBLIC_API_URL WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . @@ -62,4 +63,4 @@ ENV PORT 3000 ENV HOSTNAME "0.0.0.0" # server.js is created by next build from the standalone output -CMD ["node", "server.js"] \ No newline at end of file +CMD ["node", "server.js"] diff --git a/scripts/govtool/analytics-dashboard.mk b/scripts/govtool/analytics-dashboard.mk index f56f89b92..98d2ae7e3 100644 --- a/scripts/govtool/analytics-dashboard.mk +++ b/scripts/govtool/analytics-dashboard.mk @@ -12,7 +12,9 @@ analytics_dashboard_image_tag := $(shell git log -n 1 --format="%H" -- $(root_di .PHONY: build-analytics-dashboard build-analytics-dashboard: $(call check_image_on_ecr,analytics-dashboard,$(analytics_dashboard_image_tag)) || \ - $(docker) build --tag "$(repo_url)/analytics-dashboard:$(analytics_dashboard_image_tag)" $(root_dir)/govtool/analytics-dashboard + $(docker) build --tag "$(repo_url)/analytics-dashboard:$(analytics_dashboard_image_tag)" \ + --build-arg NEXT_PUBLIC_API_URL="$${NEXT_PUBLIC_API_URL}" \ + $(root_dir)/govtool/analytics-dashboard .PHONY: push-analytics-dashboard push-analytics-dashboard: build-analytics-dashboard