chore: disable sentry for local development

This commit is contained in:
Nicolas Meienberger 2024-03-21 17:57:15 +01:00
parent 8d10d0e96a
commit 0e4f0d1ca7
11 changed files with 49 additions and 38 deletions

View File

@ -7,12 +7,12 @@ FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS node_base
FROM node_base AS builder_base
ARG SENTRY_AUTH_TOKEN
ARG SENTRY_DISABLE_AUTO_UPLOAD
ARG TIPI_VERSION
ARG LOCAL
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
ENV SENTRY_DISABLE_AUTO_UPLOAD=${SENTRY_DISABLE_AUTO_UPLOAD}
ENV TIPI_VERSION=${TIPI_VERSION}
ENV LOCAL=${LOCAL}
RUN npm install pnpm -g
RUN apk add --no-cache curl python3 make g++ git

View File

@ -30,10 +30,12 @@ COPY ./pnpm-lock.yaml ./
RUN pnpm fetch --ignore-scripts
COPY ./package*.json ./
COPY ./packages ./packages
COPY ./packages/worker/package.json ./packages/worker/package.json
COPY ./packages/shared/package.json ./packages/shared/package.json
RUN pnpm install -r --prefer-offline
COPY ./packages ./packages
COPY ./tsconfig.json ./tsconfig.json
COPY ./next.config.mjs ./next.config.mjs
COPY ./public ./public

View File

@ -95,6 +95,7 @@ services:
WORKER_APP_DIR: /app/packages/worker
DASHBOARD_APP_DIR: /app
NEXT_PUBLIC_TIPI_VERSION: development
LOCAL: true
env_file:
- .env
labels:

View File

@ -63,8 +63,8 @@ services:
context: .
dockerfile: Dockerfile
args:
SENTRY_DISABLE_AUTO_UPLOAD: true
TIPI_VERSION: development
LOCAL: true
container_name: runtipi
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:5000/worker-api/healthcheck']
@ -97,6 +97,7 @@ services:
NODE_ENV: production
TIPI_VERSION: development
NEXT_PUBLIC_TIPI_VERSION: development
LOCAL: true
networks:
- tipi_main_network
ports:

View File

@ -18,22 +18,23 @@ const nextConfig = {
},
};
export default withSentryConfig(
nextConfig,
{
// https://github.com/getsentry/sentry-webpack-plugin#options
silent: false,
org: 'runtipi',
project: 'runtipi-dashboard',
dryRun: process.env.SENTRY_DISABLE_AUTO_UPLOAD === 'true',
release: process.env.TIPI_VERSION,
},
{
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
widenClientFileUpload: true,
transpileClientSDK: false,
tunnelRoute: '/errors',
hideSourceMaps: false,
disableLogger: true,
},
);
export default !process.env.LOCAL === 'true'
? withSentryConfig(
nextConfig,
{
// https://github.com/getsentry/sentry-webpack-plugin#options
silent: false,
org: 'runtipi',
project: 'runtipi-dashboard',
release: process.env.TIPI_VERSION,
},
{
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
widenClientFileUpload: true,
transpileClientSDK: false,
tunnelRoute: '/errors',
hideSourceMaps: false,
disableLogger: true,
},
)
: nextConfig;

View File

@ -11,7 +11,7 @@
"test:client": "jest --colors --selectProjects client --",
"test:server": "jest --colors --selectProjects server --",
"test:vite": "dotenv -e .env.test -- vitest run --coverage",
"dev": "next dev",
"dev": "next dev --turbo",
"db:migrate": "NODE_ENV=development dotenv -e .env.local -- tsx ./src/server/run-migrations-dev.ts",
"lint": "next lint",
"lint:fix": "next lint --fix",

View File

@ -1,6 +1,21 @@
const { build } = require('esbuild');
const { sentryEsbuildPlugin } = require('@sentry/esbuild-plugin');
const plugins = [];
if (process.env.LOCAL !== 'true') {
plugins.push(
sentryEsbuildPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: process.env.TIPI_VERSION,
},
org: 'runtipi',
project: 'runtipi-worker',
}),
);
}
async function bundle() {
const start = Date.now();
const options = {
@ -15,16 +30,7 @@ async function bundle() {
'.node': 'copy',
},
minify: true,
plugins: [
sentryEsbuildPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: process.env.TIPI_VERSION,
},
org: 'runtipi',
project: 'runtipi-worker',
}),
],
plugins,
};
await build({

View File

@ -49,7 +49,7 @@ const main = async () => {
logger.info('Copying system files...');
await copySystemFiles(envMap);
if (envMap.get('ALLOW_ERROR_MONITORING') === 'true' && process.env.NODE_ENV === 'production') {
if (envMap.get('ALLOW_ERROR_MONITORING') === 'true' && process.env.NODE_ENV === 'production' && process.env.LOCAL !== 'true') {
logger.info(`Anonymous error monitoring is enabled, to disable it add "allowErrorMonitoring": false to your settings.json file. Version: ${process.env.TIPI_VERSION}`);
setupSentry(process.env.TIPI_VERSION);
}

View File

@ -20,7 +20,7 @@ const getClientConfig = () => {
const { allowErrorMonitoring } = getClientConfig();
if (allowErrorMonitoring && process.env.NODE_ENV === 'production') {
if (allowErrorMonitoring && process.env.NODE_ENV === 'production' && process.env.LOCAL !== 'true') {
Sentry.init({
release: process.env.NEXT_PUBLIC_TIPI_VERSION,
environment: process.env.NODE_ENV,

View File

@ -10,7 +10,7 @@ import { extraErrorDataIntegration } from '@sentry/integrations';
const { version, allowErrorMonitoring, NODE_ENV } = TipiConfig.getConfig();
if (allowErrorMonitoring && NODE_ENV === 'production') {
if (allowErrorMonitoring && NODE_ENV === 'production' && process.env.LOCAL !== 'true') {
Sentry.init({
release: version,
environment: NODE_ENV,

View File

@ -9,7 +9,7 @@ import { extraErrorDataIntegration } from '@sentry/integrations';
const { version, allowErrorMonitoring, NODE_ENV } = TipiConfig.getConfig();
if (allowErrorMonitoring && NODE_ENV === 'production') {
if (allowErrorMonitoring && NODE_ENV === 'production' && process.env.LOCAL !== 'true') {
Sentry.init({
release: version,
environment: NODE_ENV,