Skip to content
Permalink
Browse files

Add Sentry to the Foundation site (#3983)

* update python deps + install sentry

* add sentry to the back

* add sentry to the front

* Update source/js/main.js

Co-Authored-By: Christopher DeCairos <christopherd@mozillafoundation.org>

* Add Heroku release version to webpack config

* let's get a new lockfile since I messed up >.<
  • Loading branch information
patjouk committed Dec 6, 2019
1 parent 2910860 commit 71e66dea8dce1cac9da537a4e22db8cbed88fa2d
Showing with 120 additions and 28 deletions.
  1. +1 −0 Pipfile
  2. +12 −4 Pipfile.lock
  3. +2 −0 docker-compose.yml
  4. +4 −0 env.default
  5. +15 −0 network-api/networkapi/settings.py
  6. +3 −0 network-api/networkapi/urls.py
  7. +65 −23 package-lock.json
  8. +1 −0 package.json
  9. +7 −0 source/js/main.js
  10. +10 −1 webpack.config.js
@@ -33,6 +33,7 @@ wagtail-modeltranslation = "==0.10.6"
"psycopg2-binary" = "==2.8.4"
cloudinary = "*"
wagtail-experiments = "*"
sentry-sdk = "*"

[dev-packages]
"flake8" = "*"

Some generated files are not rendered by default. Learn more.

@@ -6,6 +6,8 @@ services:
build:
context: .
dockerfile: ./dockerfiles/Dockerfile.node
env_file:
- .env
environment:
# Need to specify the SHELL env var for chokidar
- SHELL=/bin/sh
@@ -75,3 +75,7 @@ USE_CLOUDINARY=False
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=

# Sentry
SENTRY_DSN=
HEROKU_RELEASE_VERSION=
@@ -77,6 +77,9 @@
CLOUDINARY_API_SECRET=(str, ''),
FEED_LIMIT=(int, 10),
DATA_UPLOAD_MAX_NUMBER_FIELDS=(int, 2500),
# Sentry
SENTRY_DSN=(str, None),
HEROKU_RELEASE_VERSION=(str, None)
)

# Read in the environment
@@ -85,6 +88,18 @@
else:
environ.Env.read_env()

SENTRY_DSN = env('SENTRY_DSN')
HEROKU_RELEASE_VERSION = env('HEROKU_RELEASE_VERSION')

if SENTRY_DSN:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[DjangoIntegration()],
release=HEROKU_RELEASE_VERSION
)

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = root()

@@ -46,6 +46,9 @@
url(r'^documents/', include(wagtaildocs_urls)),
url('^sitemap.xml$', sitemap) if settings.DEBUG else None,

# Sentry test url
path('sentry-debug', lambda r: 1 / 0) if settings.SENTRY_DSN and settings.DEBUG else None,

# set up set language redirect view
url('i18n/', include('django.conf.urls.i18n')),
]))

Some generated files are not rendered by default. Learn more.

@@ -45,6 +45,7 @@
"@babel/core": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"@babel/preset-react": "^7.7.4",
"@sentry/browser": "^5.9.1",
"autoprefixer": "^9.7.3",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
@@ -4,6 +4,7 @@ import React from "react";
import ReactGA from "react-ga";
import ReactDOM from "react-dom";
import Analytics from "./analytics.js";
import * as Sentry from "@sentry/browser";

import JoinUs from "./components/join/join.jsx";
import Petition from "./components/petition/petition.jsx";
@@ -20,6 +21,12 @@ import youTubeRegretsTunnel from "./youtube-regrets.js";

const SHOW_MEMBER_NOTICE = false;

// Initialize Sentry error reporting
Sentry.init({
dsn: __SENTRY_DSN__,
release: __HEROKU_RELEASE_VERSION__
});

// To be populated via XHR and querySelector
let env, networkSiteURL, csrfToken;

@@ -1,3 +1,4 @@
let webpack = require(`webpack`);
let path = require(`path`);
let frontendPath = path.resolve(
__dirname,
@@ -29,7 +30,15 @@ let main = {
},
module: {
rules
}
},
plugins: [
new webpack.DefinePlugin({
__SENTRY_DSN__: JSON.stringify(process.env.SENTRY_DSN),
__HEROKU_RELEASE_VERSION__: JSON.stringify(
process.env.HEROKU_RELEASE_VERSION
)
})
]
};

let bgMain = {

0 comments on commit 71e66de

Please sign in to comment.
You can’t perform that action at this time.