From 9fa4a4babb046d3168b5dd43a2db67460c171393 Mon Sep 17 00:00:00 2001 From: Clemence Kyara Date: Sat, 22 Jun 2024 22:45:20 +0300 Subject: [PATCH] ENV for Sentry environment is SENTRY_ENVIRONMENT We've been using SENTRY_ENV wrong: https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#environment --- .github/workflows/charterafrica-deploy-dev.yml | 4 ++-- .github/workflows/charterafrica-deploy-prod.yml | 4 ++-- .github/workflows/codeforafrica-deploy-dev-app.yml | 4 ++-- .github/workflows/codeforafrica-deploy-prod.yml | 4 ++-- .github/workflows/pesayetu-deploy-dev.yml | 4 ++-- .github/workflows/roboshield-deploy-dev.yml | 4 ++-- .github/workflows/vpnmanager-deploy-dev.yml | 4 ++-- Dockerfile | 8 ++++---- apps/charterafrica/.env | 10 +++++----- apps/charterafrica/.env.template | 2 +- apps/codeforafrica/.env | 9 ++++----- apps/codeforafrica/env.template | 2 +- apps/pesayetu/.env | 3 +++ apps/roboshield/.env | 2 +- apps/roboshield/.env.template | 2 +- apps/vpnmanager/sentry.client.config.ts | 2 +- apps/vpnmanager/sentry.edge.config.ts | 2 +- apps/vpnmanager/sentry.server.config.ts | 2 +- charterafrica.Dockerfile | 4 ++-- codeforafrica.Dockerfile | 4 ++-- docker-compose.yml | 4 ++-- roboshield.Dockerfile | 4 ++-- 22 files changed, 45 insertions(+), 43 deletions(-) diff --git a/.github/workflows/charterafrica-deploy-dev.yml b/.github/workflows/charterafrica-deploy-dev.yml index 1c8aa49ad..e1049e964 100644 --- a/.github/workflows/charterafrica-deploy-dev.yml +++ b/.github/workflows/charterafrica-deploy-dev.yml @@ -17,7 +17,7 @@ env: DOKKU_REMOTE_URL: "ssh://dokku@ui-1.dev.codeforafrica.org/charterafrica" IMAGE_NAME: "codeforafrica/charterafrica-ui" NEXT_PUBLIC_APP_URL: "https://charterafrica.dev.codeforafrica.org" - SENTRY_ENV: "development" + SENTRY_ENVIRONMENT: "development" jobs: deploy: @@ -58,7 +58,7 @@ jobs: NEXT_PUBLIC_SENTRY_DSN=${{ secrets.CHARTERAFRICA_SENTRY_DSN }} PAYLOAD_SECRET_KEY=${{ secrets.CHARTERAFRICA_PAYLOAD_SECRET_KEY }} SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ENV=${{ env.SENTRY_ENV }} + SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} SENTRY_ORG=${{ secrets.SENTRY_ORG }} SENTRY_PROJECT=${{ secrets.CHARTERAFRICA_SENTRY_PROJECT }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.github/workflows/charterafrica-deploy-prod.yml b/.github/workflows/charterafrica-deploy-prod.yml index 69db0c7c3..b3e2ec623 100644 --- a/.github/workflows/charterafrica-deploy-prod.yml +++ b/.github/workflows/charterafrica-deploy-prod.yml @@ -15,7 +15,7 @@ env: NEXT_PUBLIC_APP_URL: "https://charter.africa" NEXT_PUBLIC_SEO_DISABLED: "false" VERSION_FILE_NAME: "./apps/charterafrica/package.json" - SENTRY_ENV: "production" + SENTRY_ENVIRONMENT: "production" jobs: deploy: @@ -87,7 +87,7 @@ jobs: NEXT_PUBLIC_SEO_DISABLED=${{ env.NEXT_PUBLIC_SEO_DISABLED }} PAYLOAD_SECRET_KEY=${{ secrets.CHARTERAFRICA_PAYLOAD_SECRET_KEY }} SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ENV=${{ env.SENTRY_ENV }} + SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} SENTRY_ORG=${{ secrets.SENTRY_ORG }} SENTRY_PROJECT=${{ secrets.CHARTERAFRICA_SENTRY_PROJECT }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.github/workflows/codeforafrica-deploy-dev-app.yml b/.github/workflows/codeforafrica-deploy-dev-app.yml index bca8123d7..819212eb9 100644 --- a/.github/workflows/codeforafrica-deploy-dev-app.yml +++ b/.github/workflows/codeforafrica-deploy-dev-app.yml @@ -19,7 +19,7 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} IMAGE_NAME: "codeforafrica/codeforafrica-ui" NEXT_PUBLIC_APP_URL: "https://codeforafrica-ui.dev.codeforafrica.org" - SENTRY_ENV: "development" + SENTRY_ENVIRONMENT: "development" jobs: deploy: @@ -61,7 +61,7 @@ jobs: NEXT_PUBLIC_APP_LOGO_URL=${{ secrets.NEXT_PUBLIC_CODEFORAFRICA_APP_LOGO_URL }} NEXT_PUBLIC_APP_NAME=${{ secrets.NEXT_PUBLIC_CODEFORAFRICA_APP_NAME }} SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ENV=${{ env.SENTRY_ENV }} + SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} SENTRY_ORG=${{ secrets.SENTRY_ORG }} SENTRY_PROJECT=${{ secrets.CODEFORAFRICA_SENTRY_PROJECT }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.github/workflows/codeforafrica-deploy-prod.yml b/.github/workflows/codeforafrica-deploy-prod.yml index af5cabb84..a5b8fb3a7 100644 --- a/.github/workflows/codeforafrica-deploy-prod.yml +++ b/.github/workflows/codeforafrica-deploy-prod.yml @@ -17,7 +17,7 @@ env: IMAGE_NAME: "codeforafrica/codeforafrica-ui" VERSION_FILE_NAME: "./apps/codeforafrica/package.json" NEXT_PUBLIC_APP_URL: "https://cfa.dev.codeforafrica.org" - SENTRY_ENV: "production" + SENTRY_ENVIRONMENT: "production" jobs: deploy: @@ -82,7 +82,7 @@ jobs: NEXT_PUBLIC_APP_URL=${{ env.NEXT_PUBLIC_APP_URL }} PAYLOAD_SECRET=${{ secrets.CODEFORAFRICA_PAYLOAD_SECRET }} SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ENV=${{ env.SENTRY_ENV }} + SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} SENTRY_ORG=${{ secrets.SENTRY_ORG }} SENTRY_PROJECT=${{ secrets.CODEFORAFRICA_SENTRY_PROJECT }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.github/workflows/pesayetu-deploy-dev.yml b/.github/workflows/pesayetu-deploy-dev.yml index 6d16ef6b0..033d06f54 100644 --- a/.github/workflows/pesayetu-deploy-dev.yml +++ b/.github/workflows/pesayetu-deploy-dev.yml @@ -19,7 +19,7 @@ env: IMAGE_NAME: "codeforafrica/pesayetu-ui" GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NEXT_PUBLIC_APP_URL: "https://pesayetu-ui.dev.codeforafrica.org" - SENTRY_ENV: "development" + SENTRY_ENVIRONMENT: "development" jobs: deploy: @@ -63,7 +63,7 @@ jobs: JWT_SECRET_KEY=${{ secrets.PESAYETU_JWT_SECRET_KEY }} HURUMAP_API_URL=${{ secrets.PESAYETU_HURUMAP_API_URL }} SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ENV=${{ env.SENTRY_ENV }} + SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} SENTRY_ORG=${{ secrets.SENTRY_ORG }} SENTRY_PROJECT=${{ secrets.PESAYETU_SENTRY_PROJECT }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.github/workflows/roboshield-deploy-dev.yml b/.github/workflows/roboshield-deploy-dev.yml index 905282f45..82d8e2c9a 100644 --- a/.github/workflows/roboshield-deploy-dev.yml +++ b/.github/workflows/roboshield-deploy-dev.yml @@ -19,7 +19,7 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} IMAGE_NAME: "codeforafrica/roboshield" NEXT_PUBLIC_APP_URL: "https://roboshield-ui.dev.codeforafrica.org" - SENTRY_ENV: "development" + SENTRY_ENVIRONMENT: "development" jobs: deploy: @@ -60,7 +60,7 @@ jobs: NEXT_PUBLIC_SENTRY_DSN=${{ secrets.CHARTERAFRICA_SENTRY_DSN }} PAYLOAD_SECRET_KEY=${{ secrets.CHARTERAFRICA_PAYLOAD_SECRET_KEY }} SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ENV=${{ env.SENTRY_ENV }} + SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} SENTRY_ORG=${{ secrets.SENTRY_ORG }} SENTRY_PROJECT=${{ secrets.ROBOSHIELD_SENTRY_PROJECT }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/.github/workflows/vpnmanager-deploy-dev.yml b/.github/workflows/vpnmanager-deploy-dev.yml index 711b93ab2..56a3c256c 100644 --- a/.github/workflows/vpnmanager-deploy-dev.yml +++ b/.github/workflows/vpnmanager-deploy-dev.yml @@ -16,7 +16,7 @@ concurrency: env: DOKKU_REMOTE_URL: "ssh://azureuser@ui-1.dev.codeforafrica.org/vpnmanager" IMAGE_NAME: "codeforafrica/vpnmanager" - SENTRY_ENV: "development" + SENTRY_ENVIRONMENT: "development" jobs: deploy: @@ -54,7 +54,7 @@ jobs: build-args: | SENTRY_DSN=${{ secrets.VPNMANAGER_SENTRY_DSN }} SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ENV=${{ env.SENTRY_ENV }} + SENTRY_ENVIRONMENT=${{ env.SENTRY_ENVIRONMENT }} SENTRY_ORG=${{ secrets.SENTRY_ORG }} SENTRY_PROJECT=${{ secrets.VPNMANAGER_SENTRY_PROJECT }} cache-from: type=local,src=/tmp/.buildx-cache diff --git a/Dockerfile b/Dockerfile index 1b1e5d611..55263a788 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ARG \ NEXT_PUBLIC_GOOGLE_ANALYTICS="" \ # Sentry (build time) SENTRY_AUTH_TOKEN \ - SENTRY_ENV="" \ + SENTRY_ENVIRONMENT="" \ SENTRY_ORG \ SENTRY_PROJECT @@ -102,7 +102,7 @@ ENV NODE_ENV=production \ NEXT_PUBLIC_SEO_DISABLED=${NEXT_PUBLIC_SEO_DISABLED} \ NEXT_PUBLIC_GOOGLE_ANALYTICS=${NEXT_PUBLIC_GOOGLE_ANALYTICS} \ PORT=${PORT} \ - SENTRY_ENV=${SENTRY_ENV} \ + SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT} \ # set hostname to localhost HOSTNAME="0.0.0.0" @@ -151,7 +151,7 @@ ARG NEXT_TELEMETRY_DISABLED \ NEXT_PUBLIC_GOOGLE_ANALYTICS \ # Sentry (build time) SENTRY_AUTH_TOKEN \ - SENTRY_ENV \ + SENTRY_ENVIRONMENT \ SENTRY_ORG \ SENTRY_PROJECT \ # Wordpress @@ -245,7 +245,7 @@ ARG NEXT_TELEMETRY_DISABLED \ NEXT_PUBLIC_GOOGLE_ANALYTICS \ # Sentry (build time) SENTRY_AUTH_TOKEN \ - SENTRY_ENV \ + SENTRY_ENVIRONMENT \ SENTRY_ORG \ SENTRY_PROJECT \ SENTRY_LOG_LEVEL="info" diff --git a/apps/charterafrica/.env b/apps/charterafrica/.env index 9bea0cf37..af886893b 100644 --- a/apps/charterafrica/.env +++ b/apps/charterafrica/.env @@ -1,8 +1,8 @@ +MIGRATIONS_DIR=./migrations NEXT_PUBLIC_IMAGE_UNOPTIMIZED=true - NEXT_PUBLIC_SEO_DISABLED=true - -PAYLOAD_PUBLIC_LOCALES="en, fr, pt" PAYLOAD_PUBLIC_DEFAULT_LOCALE=en -MIGRATIONS_DIR=./migrations -SENTRY_ENV=local +PAYLOAD_PUBLIC_LOCALES="en, fr, pt" +SENTRY_ENVIRONMENT=local +SENTRY_ORG=code-for-africa +SENTRY_PROJECT=charterafrica diff --git a/apps/charterafrica/.env.template b/apps/charterafrica/.env.template index bfe2aabe9..cd0a39b15 100644 --- a/apps/charterafrica/.env.template +++ b/apps/charterafrica/.env.template @@ -38,6 +38,6 @@ SENDGRID_FROM_NAME # https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ NEXT_PUBLIC_SENTRY_DSN= -SENTRY_ENV=local|development|production +SENTRY_ENVIRONMENT=local|development|production SENTRY_ORG= SENTRY_PROJECT= diff --git a/apps/codeforafrica/.env b/apps/codeforafrica/.env index 88617ef72..bd63c6aec 100644 --- a/apps/codeforafrica/.env +++ b/apps/codeforafrica/.env @@ -1,13 +1,12 @@ +MIGRATIONS_DIR=./migrations +NEXT_PUBLIC_APP_DIRECTORY="apps/codeforafrica/" NEXT_PUBLIC_APP_LOGO_URL=https://res.cloudinary.com/code-for-africa/image/upload/v1656078512/codeforafrica/logos/CfA_logo_BW_twlmo6.png NEXT_PUBLIC_APP_NAME="Code for Africa" NEXT_PUBLIC_APP_URL="https://cfa.dev.codeforafrica.org" +NEXT_PUBLIC_GOOGLE_ANALYTICS_ID="G-QVY4THBKNT" NEXT_PUBLIC_IMAGE_DOMAINS="longform.codeforafrica.org,res.cloudinary.com" NEXT_PUBLIC_IMAGE_UNOPTIMIZED="true" NEXT_PUBLIC_VERCEL_URL=${VERCEL_URL} -NEXT_PUBLIC_APP_DIRECTORY="apps/codeforafrica/" -NEXT_PUBLIC_GOOGLE_ANALYTICS_ID="G-QVY4THBKNT" -MIGRATIONS_DIR=./migrations - -SENTRY_ENV=local +SENTRY_ENVIRONMENT=local SENTRY_ORG=code-for-africa SENTRY_PROJECT=codeforafrica diff --git a/apps/codeforafrica/env.template b/apps/codeforafrica/env.template index 0412c00d2..ad20e8794 100644 --- a/apps/codeforafrica/env.template +++ b/apps/codeforafrica/env.template @@ -22,6 +22,6 @@ S3_ACCESS_KEY_ID= # Sentry NEXT_PUBLIC_SENTRY_DSN= SENTRY_AUTH_TOKEN= -SENTRY_ENV= +SENTRY_ENVIRONMENT= SENTRY_ORG= SENTRY_PROJECT= diff --git a/apps/pesayetu/.env b/apps/pesayetu/.env index e69de29bb..50cb4a987 100644 --- a/apps/pesayetu/.env +++ b/apps/pesayetu/.env @@ -0,0 +1,3 @@ +SENTRY_ENVIRONMENT=local +SENTRY_ORG=code-for-africa +SENTRY_PROJECT=pesayetu \ No newline at end of file diff --git a/apps/roboshield/.env b/apps/roboshield/.env index aad2d5819..627b03da3 100644 --- a/apps/roboshield/.env +++ b/apps/roboshield/.env @@ -1,3 +1,3 @@ -SENTRY_ENV=local +SENTRY_ENVIRONMENT=local SENTRY_ORG=code-for-africa SENTRY_PROJECT=roboshield diff --git a/apps/roboshield/.env.template b/apps/roboshield/.env.template index 678dac1a0..9e65c883b 100644 --- a/apps/roboshield/.env.template +++ b/apps/roboshield/.env.template @@ -12,7 +12,7 @@ PORT # https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ NEXT_PUBLIC_SENTRY_DSN= # Defaults to local -SENTRY_ENV=local|development|staging|production +SENTRY_ENVIRONMENT=local|development|staging|production # Defaults to code-for-africa SENTRY_ORG= # Defaults to roboshield diff --git a/apps/vpnmanager/sentry.client.config.ts b/apps/vpnmanager/sentry.client.config.ts index 63d96bd47..1758a406e 100644 --- a/apps/vpnmanager/sentry.client.config.ts +++ b/apps/vpnmanager/sentry.client.config.ts @@ -3,7 +3,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.SENTRY_DSN, tracesSampleRate: 1, - environment: process.env.SENTRY_ENV ?? "local", + environment: process.env.SENTRY_ENVIRONMENT ?? "local", debug: false, replaysOnErrorSampleRate: 1.0, replaysSessionSampleRate: 0.1, diff --git a/apps/vpnmanager/sentry.edge.config.ts b/apps/vpnmanager/sentry.edge.config.ts index 5a5ad8d6d..9496c30b1 100644 --- a/apps/vpnmanager/sentry.edge.config.ts +++ b/apps/vpnmanager/sentry.edge.config.ts @@ -2,7 +2,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.SENTRY_DSN, - environment: process.env.SENTRY_ENV ?? "local", + environment: process.env.SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1, debug: false, }); diff --git a/apps/vpnmanager/sentry.server.config.ts b/apps/vpnmanager/sentry.server.config.ts index 869ae5737..2636afc47 100644 --- a/apps/vpnmanager/sentry.server.config.ts +++ b/apps/vpnmanager/sentry.server.config.ts @@ -2,7 +2,7 @@ import * as Sentry from "@sentry/nextjs"; const options = { dsn: process.env.SENTRY_DSN, - environment: process.env.SENTRY_ENV ?? "local", + environment: process.env.SENTRY_ENVIRONMENT ?? "local", tracesSampleRate: 1, }; diff --git a/charterafrica.Dockerfile b/charterafrica.Dockerfile index a60949df6..bd9b4fdea 100644 --- a/charterafrica.Dockerfile +++ b/charterafrica.Dockerfile @@ -49,7 +49,7 @@ ARG NEXT_TELEMETRY_DISABLED=1 \ PORT=3000 \ # Sentry config for source maps upload (needed at build time only) SENTRY_AUTH_TOKEN="" \ - SENTRY_ENV="" \ + SENTRY_ENVIRONMENT="" \ SENTRY_ORG="" \ SENTRY_PROJECT="" \ # Needed by Payload at Next.js build time (see below for Payload's own @@ -99,7 +99,7 @@ ENV NODE_ENV=production \ PAYLOAD_CONFIG_PATH=${PAYLOAD_CONFIG_PATH} \ PAYLOAD_PUBLIC_APP_URL=${PAYLOAD_PUBLIC_APP_URL} \ PORT=${PORT} \ - SENTRY_ENV=${SENTRY_ENV} + SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT} WORKDIR /workspace/apps/charterafrica diff --git a/codeforafrica.Dockerfile b/codeforafrica.Dockerfile index 89a33f016..2076be28b 100644 --- a/codeforafrica.Dockerfile +++ b/codeforafrica.Dockerfile @@ -37,7 +37,7 @@ ARG PORT=3000 \ NEXT_PUBLIC_SENTRY_DSN="" \ # Sentry config for source maps upload (needed at build time only) SENTRY_AUTH_TOKEN="" \ - SENTRY_ENV="" \ + SENTRY_ENVIRONMENT="" \ SENTRY_ORG="" \ SENTRY_PROJECT="" @@ -72,7 +72,7 @@ ENV NODE_ENV=production \ NEXT_PUBLIC_APP_NAME=${NEXT_PUBLIC_APP_NAME} \ NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL} \ NEXT_PUBLIC_SENTRY_DSN=${NEXT_PUBLIC_SENTRY_DSN} \ - SENTRY_ENV=${SENTRY_ENV} + SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT} WORKDIR /workspace/apps/codeforafrica diff --git a/docker-compose.yml b/docker-compose.yml index 92e8ba2c7..139564295 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: PAYLOAD_SECRET_KEY: ${PAYLOAD_SECRET_KEY} SENTRY_AUTH_TOKEN: ${SENTRY_AUTH_TOKEN} SENTRY_ORG: ${SENTRY_ORG} - SENTRY_ENV: ${SENTRY_ENV} + SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT} SENTRY_PROJECT: ${SENTRY_PROJECT} ports: - 3000:3000 @@ -50,7 +50,7 @@ services: PAYLOAD_SECRET: ${PAYLOAD_SECRET} SENTRY_AUTH_TOKEN: ${SENTRY_AUTH_TOKEN} SENTRY_ORG: ${SENTRY_ORG} - SENTRY_ENV: ${SENTRY_ENV} + SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT} SENTRY_PROJECT: ${SENTRY_PROJECT} ports: - 3000:3000 diff --git a/roboshield.Dockerfile b/roboshield.Dockerfile index 77838339b..384e612cb 100644 --- a/roboshield.Dockerfile +++ b/roboshield.Dockerfile @@ -59,7 +59,7 @@ ARG NEXT_TELEMETRY_DISABLED=1 \ PORT=3000 \ # Sentry config for source maps upload (needed at build time only) SENTRY_AUTH_TOKEN="" \ - SENTRY_ENV="" \ + SENTRY_ENVIRONMENT="" \ SENTRY_ORG="" \ SENTRY_PROJECT="" @@ -92,7 +92,7 @@ ENV NODE_ENV=production \ NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL} \ NEXT_PUBLIC_SENTRY_DSN=${NEXT_PUBLIC_SENTRY_DSN} \ PORT=${PORT} \ - SENTRY_ENV=${SENTRY_ENV} + SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT} RUN set -ex \ # Create a non-root user