Skip to content
Open
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
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,23 @@ RUN pwd
RUN mkdir tmp
ENV TMP=/home/${USER}/tmp
ENV TEMP=/home/${USER}/tmp
ENV SENTRY_TRACES_SAMPLE_RATE_FRONTEND=__SENTRY_TRACES_SAMPLE_RATE_FRONTEND_HERE__
ENV SENTRY_DSN_FRONTEND=__SENTRY_DSN_FRONTEND_HERE__
ENV SENTRY_ENVIRONMENT=__SENTRY_ENVIRONMENT_HERE__

# Replace env var placeholders before running
ADD entrypoint.sh ./
ENTRYPOINT ["/home/ljprojectbuilder/entrypoint.sh"]

RUN cd /home/${USER}
RUN ls -al
# copy application JAR (with libraries inside)
COPY application/target/application-*.jar /home/ljprojectbuilder/application.jar
#COPY /home/ljprojectbuilder/application/target/application-*.jar /home/ljprojectbuilder/application.jar

ENV SENTRY_TRACES_SAMPLE_RATE_FRONTEND=.75
ENV SENTRY_DSN_FRONTEND=
ENV SENTRY_ENVIRONMENT=local-development

# specify default command
CMD ["/usr/local/openjdk-17/bin/java", "-jar", "/home/ljprojectbuilder/application.jar", "-Dlog4j2.formatMsgNoLookups=true"]
3 changes: 1 addition & 2 deletions application/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ springdoc.swagger-ui.csrf.enabled=true
#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata
#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=/home/anett/create.sql

#logging.level.org.springframework.security=DEBUG

keycloak.auth-server-url=http://localhost:8080/auth
keycloak.realm=projectbuilder
keycloak.resource=projectbuilder
keycloak.principal-attribute=preferred_username
keycloak.public-client=true
keycloak.enabled=true
sentry.dsn=



Expand Down
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh

# Replace config env vars
printf "Replacing config env vars ..."
find .next/static -type f -exec sed -i -e "s|__SENTRY_DSN_FRONTEND_HERE__|$SENTRY_DSN_FRONTEND|g" -e "s|__SENTRY_ENVIRONMENT_HERE__|$SENTRY_ENVIRONMENT|g" -e "s|__SENTRY_TRACES_SAMPLE_RATE_FRONTEND_HERE__|$SENTRY_TRACES_SAMPLE_RATE_FRONTEND|g" {} \;
printf " done.\n"

# Run CMD
exec "$@"
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-boot-starter</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-log4j2</artifactId>
<version>6.1.0</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
2 changes: 2 additions & 0 deletions webclient/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"@mui/lab": "^5.0.0-alpha.63",
"@mui/material": "^5.0.0",
"@mui/styles": "^5.0.0",
"@sentry/react": "^7.1.1",
"@sentry/tracing": "^7.1.1",
"@starwit/react-starwit": "0.0.6-6",
"axios": "^0.24.0",
"i18next": "^21.0.1",
Expand Down
8 changes: 7 additions & 1 deletion webclient/app/src/app/AppConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ const appMenuItems = [
{title: "apptemplates.title", link: "/apptemplates/all"}
];

export {appMenuItems};
const sentryConfiguration = {
dsn: process.env.SENTRY_DSN_FRONTEND,
tracesSampleRate: Number(process.env.SENTRY_TRACES_SAMPLE_RATE_FRONTEND || .75),
environment: process.env.SENTRY_ENVIRONMENT
};

export {appMenuItems, sentryConfiguration};
23 changes: 23 additions & 0 deletions webclient/app/src/app/commons/sentryInit/SentryInit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react";
import * as Sentry from "@sentry/react";
import {BrowserTracing} from "@sentry/tracing";
import {sentryConfiguration} from "../../AppConfig";

function SentryInit(props) {
Sentry.init({
dsn: sentryConfiguration.dsn,
integrations: [new BrowserTracing()],

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: sentryConfiguration.tracesSampleRate,
enabled: process.env.NODE_ENV !== "development",
environment: sentryConfiguration.environment
});

return (
<></>
);
}

export default SentryInit;
2 changes: 2 additions & 0 deletions webclient/app/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import {HashRouter as Router} from "react-router-dom";
import "./localization/i18n";
import {SnackbarProvider} from "notistack";
import MainTheme from "./app/commons/mainTheme/MainTheme";
import SentryInit from "./app/commons/sentryInit/SentryInit";

ReactDOM.render((
<Router>
<SentryInit/>
<MainTheme>
<SnackbarProvider maxSnack={5}>
<App/>
Expand Down