Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup/sentry #22

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ jobs:
packages: write
with:
environment: Development
docker-image: ghcr.io/AplinkosMinisterija/biip-zuvinimas-web
docker-image: ghcr.io/AplinkosMinisterija/biip-zuvinimas-web
enable-sentry: true
build-args: |
NODE_ENV=development
REACT_APP_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
REACT_APP_MAPS_HOST=https://dev.maps.biip.lt
7 changes: 6 additions & 1 deletion .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ jobs:
packages: write
with:
environment: Production
docker-image: ghcr.io/AplinkosMinisterija/biip-zuvinimas-web
docker-image: ghcr.io/AplinkosMinisterija/biip-zuvinimas-web
enable-sentry: true
build-args: |
NODE_ENV=production
REACT_APP_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
REACT_APP_MAPS_HOST=https://maps.biip.lt
7 changes: 6 additions & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ jobs:
packages: write
with:
environment: Staging
docker-image: ghcr.io/AplinkosMinisterija/biip-zuvinimas-web
docker-image: ghcr.io/AplinkosMinisterija/biip-zuvinimas-web
enable-sentry: true
build-args: |
NODE_ENV=production
REACT_APP_SENTRY_DSN=https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
REACT_APP_MAPS_HOST=https://staging.maps.biip.lt
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ RUN yarn install --frozen-lockfile
# Copy source
COPY . .

# Docker build args and environment variables
ARG ENVIRONMENT
ARG VERSION
ARG REACT_APP_ENVIRONMENT=${ENVIRONMENT}
ARG REACT_APP_VERSION=${VERSION}

# Set env variables
ARG REACT_APP_MAPS_HOST=
ARG REACT_APP_SENTRY_DSN=
ARG NODE_ENV=production

# Build and cleanup
RUN yarn build

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"@material-ui/core": "^4.12.4",
"@reduxjs/toolkit": "^1.9.3",
"@sentry/react": "^7.73.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/other/RegistrationMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const Map = ({
[locationMutationMutateAsync]
);


const handleSaveGeom = useCallback(
(event: any) => {
if (!event?.data?.mapIframeMsg) return;
Expand Down Expand Up @@ -151,6 +150,7 @@ const Map = ({
)}

<StyledIframe
allow="geolocation *"
ref={iframeRef}
src={src}
width={"100%"}
Expand Down
33 changes: 31 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import ReactDOM from "react-dom/client";
import * as Sentry from "@sentry/react";
import { QueryClient, QueryClientProvider } from "react-query";
import { Provider } from "react-redux";
import { BrowserRouter } from "react-router-dom";
import {
BrowserRouter,
createRoutesFromChildren,
matchRoutes,
useLocation,
useNavigationType
} from "react-router-dom";
import { PersistGate } from "redux-persist/integration/react";
import { ThemeProvider } from "styled-components";
import App from "./App";
Expand All @@ -10,12 +17,34 @@ import reportWebVitals from "./reportWebVitals";
import * as serviceWorkerRegistration from "./serviceWorkerRegistration";
import redux from "./state/store";
import { GlobalStyle, theme } from "./styles/index";
import { useEffect } from "react";
const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
);
const { store, persistor } = redux;

const queryClient = new QueryClient();
const env = process.env;

if (env.REACT_APP_SENTRY_DSN) {
Sentry.init({
environment: env.REACT_APP_ENVIRONMENT,
dsn: env.REACT_APP_SENTRY_DSN,
integrations: [
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.reactRouterV6Instrumentation(
useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes
)
})
],
tracesSampleRate: 1,
release: env.REACT_APP_VERSION,
tracePropagationTargets: [env.REACT_APP_MAPS_HOST!]
});
}

root.render(
<>
Expand Down
69 changes: 69 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,70 @@
resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.2.0.tgz"
integrity sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg==

"@sentry-internal/tracing@7.73.0":
version "7.73.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.73.0.tgz#4838f31e41d23a6041ef4520519b80f788bf1cac"
integrity sha512-ig3WL/Nqp8nRQ52P205NaypGKNfIl/G+cIqge9xPW6zfRb5kJdM1YParw9GSJ1SPjEZBkBORGAML0on5H2FILw==
dependencies:
"@sentry/core" "7.73.0"
"@sentry/types" "7.73.0"
"@sentry/utils" "7.73.0"
tslib "^2.4.1 || ^1.9.3"

"@sentry/browser@7.73.0":
version "7.73.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.73.0.tgz#a8eaeb50cf16ca32f0039a81719c503d7045495f"
integrity sha512-e301hUixcJ5+HNKCJwajFF5smF4opXEFSclyWsJuFNufv5J/1C1SDhbwG2JjBt5zzdSoKWJKT1ewR6vpICyoDw==
dependencies:
"@sentry-internal/tracing" "7.73.0"
"@sentry/core" "7.73.0"
"@sentry/replay" "7.73.0"
"@sentry/types" "7.73.0"
"@sentry/utils" "7.73.0"
tslib "^2.4.1 || ^1.9.3"

"@sentry/core@7.73.0":
version "7.73.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.73.0.tgz#1caeeec44f42c4d58c06cc05dec39e5497b65aa3"
integrity sha512-9FEz4Gq848LOgVN2OxJGYuQqxv7cIVw69VlAzWHEm3njt8mjvlTq+7UiFsGRo84+59V2FQuHxzA7vVjl90WfSg==
dependencies:
"@sentry/types" "7.73.0"
"@sentry/utils" "7.73.0"
tslib "^2.4.1 || ^1.9.3"

"@sentry/react@^7.73.0":
version "7.73.0"
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.73.0.tgz#8591bb70ac683b43fbe41736c2c321a4661ce22d"
integrity sha512-RCGlxW0Xp5vsC38LGxUO0Xf11LBzfg75VN+KS3D2FS5GXl0R0JwgUyPNVlod7YMCfwytsKGhfP+YpQvHGQAVwg==
dependencies:
"@sentry/browser" "7.73.0"
"@sentry/types" "7.73.0"
"@sentry/utils" "7.73.0"
hoist-non-react-statics "^3.3.2"
tslib "^2.4.1 || ^1.9.3"

"@sentry/replay@7.73.0":
version "7.73.0"
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.73.0.tgz#4e6c522bac5c12f596ef76afe15ecb3807407669"
integrity sha512-a8IC9SowBisLYD2IdLkXzx7gN4iVwHDJhQvLp2B8ARs1PyPjJ7gCxSMHeGrYp94V0gOXtorNYkrxvuX8ayPROA==
dependencies:
"@sentry/core" "7.73.0"
"@sentry/types" "7.73.0"
"@sentry/utils" "7.73.0"

"@sentry/types@7.73.0":
version "7.73.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.73.0.tgz#6d811bbe413d319df0a592a672d6d72a94a8e716"
integrity sha512-/v8++bly8jW7r4cP2wswYiiVpn7eLLcqwnfPUMeCQze4zj3F3nTRIKc9BGHzU0V+fhHa3RwRC2ksqTGq1oJMDg==

"@sentry/utils@7.73.0":
version "7.73.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.73.0.tgz#530cf023f7c395aa7708cd3824e5a45948449c10"
integrity sha512-h3ZK/qpf4k76FhJV9uiSbvMz3V/0Ovy94C+5/9UgPMVCJXFmVsdw8n/dwANJ7LupVPfYP23xFGgebDMFlK1/2w==
dependencies:
"@sentry/types" "7.73.0"
tslib "^2.4.1 || ^1.9.3"

"@sinclair/typebox@^0.24.1":
version "0.24.51"
resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz"
Expand Down Expand Up @@ -9275,6 +9339,11 @@ tslib@^2.0.3:
resolved "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==

"tslib@^2.4.1 || ^1.9.3":
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz"
Expand Down
Loading