-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #730 from CodeForAfrica/chore/roboshield_sentry
Add Sentry to RoboShield
- Loading branch information
Showing
17 changed files
with
200 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,13 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
APP_NAME: codeforafrica-ui | ||
DOKKU_REMOTE_BRANCH: "master" | ||
DOKKU_REMOTE_URL: "ssh://[email protected]" | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
IMAGE_NAME: "codeforafrica/codeforafrica-ui" | ||
NEXT_PUBLIC_APP_URL: "https://codeforafrica-ui.dev.codeforafrica.org" | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
APP_NAME: codeforafrica-ui | ||
SENTRY_ENV: "development" | ||
|
||
jobs: | ||
deploy: | ||
|
@@ -59,6 +60,10 @@ jobs: | |
PAYLOAD_SECRET=${{ secrets.CODEFORAFRICA_PAYLOAD_SECRET }} | ||
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_ORG=${{ secrets.SENTRY_ORG }} | ||
SENTRY_PROJECT=${{ secrets.CODEFORAFRICA_SENTRY_PROJECT }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
context: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,14 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
APP: "codeforafrica" | ||
DOKKU_REMOTE_BRANCH: "master" | ||
DOKKU_REMOTE_URL: "ssh://[email protected]/codeforafrica-ui" | ||
GIT_PUSH_FLAGS: "--force" | ||
IMAGE_NAME: "codeforafrica/codeforafrica-ui" | ||
APP: "codeforafrica" | ||
VERSION_FILE_NAME: "./apps/codeforafrica/package.json" | ||
GIT_PUSH_FLAGS: "--force" | ||
NEXT_PUBLIC_APP_URL: "https://cfa.dev.codeforafrica.org" | ||
SENTRY_ENV: "production" | ||
|
||
jobs: | ||
deploy: | ||
|
@@ -80,6 +81,10 @@ jobs: | |
NEXT_PUBLIC_APP_NAME=${{ secrets.NEXT_PUBLIC_CODEFORAFRICA_APP_NAME }} | ||
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_ORG=${{ secrets.SENTRY_ORG }} | ||
SENTRY_PROJECT=${{ secrets.CODEFORAFRICA_SENTRY_PROJECT }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
context: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,13 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
APP_NAME: pesayetu-ui | ||
DOKKU_REMOTE_BRANCH: "master" | ||
DOKKU_REMOTE_URL: "ssh://[email protected]" | ||
IMAGE_NAME: "codeforafrica/pesayetu-ui" | ||
NEXT_PUBLIC_APP_URL: "https://pesayetu-ui.dev.codeforafrica.org" | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
APP_NAME: pesayetu-ui | ||
NEXT_PUBLIC_APP_URL: "https://pesayetu-ui.dev.codeforafrica.org" | ||
SENTRY_ENV: "development" | ||
|
||
jobs: | ||
deploy: | ||
|
@@ -61,6 +62,10 @@ jobs: | |
WORDPRESS_APPLICATION_PASSWORD=${{ secrets.PESAYETU_WORDPRESS_APPLICATION_PASSWORD }} | ||
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_ORG=${{ secrets.SENTRY_ORG }} | ||
SENTRY_PROJECT=${{ secrets.PESAYETU_SENTRY_PROJECT }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
context: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,13 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
APP_NAME: roboshield-ui | ||
DOKKU_REMOTE_BRANCH: "master" | ||
DOKKU_REMOTE_URL: "ssh://[email protected]" | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
IMAGE_NAME: "codeforafrica/roboshield" | ||
NEXT_PUBLIC_APP_URL: "https://roboshield-ui.dev.codeforafrica.org" | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
APP_NAME: roboshield-ui | ||
SENTRY_ENV: "development" | ||
|
||
jobs: | ||
deploy: | ||
|
@@ -53,6 +54,15 @@ jobs: | |
- name: Build Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
build-args: | | ||
MONGO_URL=${{ secrets.CHARTERAFRICA_MONGO_URL }} | ||
NEXT_PUBLIC_APP_URL=${{ env.NEXT_PUBLIC_APP_URL }} | ||
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_ORG=${{ secrets.SENTRY_ORG }} | ||
SENTRY_PROJECT=${{ secrets.ROBOSHIELD_SENTRY_PROJECT }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
context: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ credentials.json | |
|
||
# Sentry Config File | ||
.sentryclirc | ||
.env.sentry-build-plugin | ||
|
||
# SQLite files | ||
**.db | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SENTRY_ENV=local | ||
SENTRY_ORG=code-for-africa | ||
SENTRY_PROJECT=roboshield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Required | ||
# -------- | ||
|
||
# Optional | ||
# -------- | ||
# Defaults to 'localhost' | ||
NEXT_HOSTNAME | ||
# Defaults to http://localhost:3000. | ||
NEXT_PUBLIC_APP_URL | ||
# Defaults to 3000. | ||
PORT | ||
# https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ | ||
NEXT_PUBLIC_SENTRY_DSN= | ||
# Defaults to local | ||
SENTRY_ENV=local|development|staging|production | ||
# Defaults to code-for-africa | ||
SENTRY_ORG= | ||
# Defaults to roboshield | ||
SENTRY_PROJECT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export async function register() { | ||
if (process.env.NEXT_RUNTIME === "nodejs") { | ||
await import("./sentry.server.config"); | ||
} | ||
|
||
if (process.env.NEXT_RUNTIME === "edge") { | ||
await import("./sentry.edge.config"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// This file configures the initialization of Sentry on the client. | ||
// The config you add here will be used whenever a users loads a page in their browser. | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
||
import * as Sentry from "@sentry/nextjs"; | ||
|
||
Sentry.init({ | ||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
|
||
// Adjust this value in production, or use tracesSampler for greater control | ||
tracesSampleRate: 1, | ||
|
||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
|
||
replaysOnErrorSampleRate: 1.0, | ||
|
||
// This sets the sample rate to be 10%. You may want this to be 100% while | ||
// in development and sample at a lower rate in production | ||
replaysSessionSampleRate: 0.1, | ||
|
||
// You can remove this option if you're not planning to use the Sentry Session Replay feature: | ||
integrations: [ | ||
Sentry.replayIntegration({ | ||
// Additional Replay configuration goes in here, for example: | ||
maskAllText: true, | ||
blockAllMedia: true, | ||
}), | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on). | ||
// The config you add here will be used whenever one of the edge features is loaded. | ||
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally. | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
||
import * as Sentry from "@sentry/nextjs"; | ||
|
||
Sentry.init({ | ||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
|
||
// Adjust this value in production, or use tracesSampler for greater control | ||
tracesSampleRate: 1, | ||
|
||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This file configures the initialization of Sentry on the server. | ||
// The config you add here will be used whenever the server handles a request. | ||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ | ||
|
||
import * as Sentry from "@sentry/nextjs"; | ||
|
||
Sentry.init({ | ||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, | ||
|
||
// Adjust this value in production, or use tracesSampler for greater control | ||
tracesSampleRate: 1, | ||
|
||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
|
||
// Uncomment the line below to enable Spotlight (https://spotlightjs.com) | ||
// spotlight: process.env.NODE_ENV === 'development', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as Sentry from "@sentry/nextjs"; | ||
import Error from "next/error"; | ||
|
||
const CustomError = (props) => { | ||
return <Error statusCode={props.statusCode} />; | ||
}; | ||
|
||
CustomError.getInitialProps = async (contextData) => { | ||
// In case this is running in a serverless function, await this in order to give Sentry | ||
// time to send the error before the lambda exits | ||
await Sentry.captureUnderscoreErrorException(contextData); | ||
|
||
// This will contain the status code of the response | ||
return Error.getInitialProps(contextData); | ||
}; | ||
|
||
export default CustomError; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters