diff --git a/.run/TemplateServiceJavaSpringBootApplication.run.xml b/.run/TemplateServiceJavaSpringBootApplication.run.xml new file mode 100644 index 0000000..26d96e2 --- /dev/null +++ b/.run/TemplateServiceJavaSpringBootApplication.run.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8f69a59..20cd0f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,15 @@ FROM openjdk:21-jdk LABEL authors="Shubham Varshney" +LABEL maintainer="Shubham Varshney" ENV JAVA_HOME="/usr/lib/jvm/default-jvm" ENV PATH=$PATH:${JAVA_HOME}/bin ADD build/libs/template-service-java-springboot-0.0.1.jar app.jar +# Expose the port for JMX +EXPOSE 8009 + EXPOSE 8080 -ENTRYPOINT ["java", "-Xms64M", "-Xmx128M", "-jar", "app.jar"] \ No newline at end of file + +ENTRYPOINT ["java", "-Xms64M", "-Xmx128M", "-Dcom.sun.management.jmxremote=true", "-Dcom.sun.management.jmxremote.port=8009", "-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false", "-jar", "app.jar"] diff --git a/build.gradle b/build.gradle index 771d04a..e53dc15 100644 --- a/build.gradle +++ b/build.gradle @@ -15,8 +15,10 @@ plugins { id 'java' id 'org.springframework.boot' version '3.3.0-M3' id 'io.spring.dependency-management' version '1.1.4' - id 'jacoco' id 'org.hibernate.orm' version '6.4.4.Final' +// id 'org.graalvm.buildtools.native' version '0.10.1' + + id 'jacoco' id 'org.sonarqube' version '4.0.0.2929' } @@ -41,11 +43,11 @@ configurations { repositories { mavenCentral() + maven { url 'https://repo.spring.io/milestone' } // maven { // url "http://127.0.0.1:8081/artifactory/libs-release" // allowInsecureProtocol true // } - maven { url 'https://repo.spring.io/milestone' } } ext { @@ -123,17 +125,17 @@ hibernate { tasks.withType(io.spring.javaformat.gradle.tasks.CheckFormat) { } -tasks.named('test') { - useJUnitPlatform() - finalizedBy(jacocoTestReport) -// afterSuite { desc, result -> -// if (!desc.parent) -// println("${result.resultType} " + -// "(${result.testCount} tests, " + -// "${result.successfulTestCount} successes, " + -// "${result.failedTestCount} failures, " + -// "${result.skippedTestCount} skipped)") -} +//tasks.named('test') { +// useJUnitPlatform() +// finalizedBy(jacocoTestReport) +//// afterSuite { desc, result -> +//// if (!desc.parent) +//// println("${result.resultType} " + +//// "(${result.testCount} tests, " + +//// "${result.successfulTestCount} successes, " + +//// "${result.failedTestCount} failures, " + +//// "${result.skippedTestCount} skipped)") +//} tasks.named('test') { useJUnitPlatform() diff --git a/compose.yaml b/compose.yaml index 8840409..4e01a5a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,5 +1,3 @@ -version: "3.8" - services: web: container_name: template-service-java-springboot-web @@ -17,6 +15,7 @@ services: ports: - '8080:8080' + - '8009:8009' restart: 'on-failure' @@ -70,6 +69,7 @@ services: ports: - '8081:8080' + - '8010:8009' restart: 'on-failure' @@ -169,7 +169,7 @@ services: - ./log/:/etc/data newrelic: - image: 'newrelic' + image: 'newrelic:latest' container_name: newrelic build: context: . @@ -181,6 +181,8 @@ services: privileged: true volumes: - "/:/host:ro" + - "./newrelic-infra/execute.sh:/tmp/execute.sh" + - "./newrelic-infra/newrelic-infra.yml:/etc/newrelic-infra.yml" - "/var/run/docker.sock:/var/run/docker.sock" restart: unless-stopped environment: diff --git a/fluentbit/Dockerfile b/fluentbit/Dockerfile index 0d0128a..05c4cca 100644 --- a/fluentbit/Dockerfile +++ b/fluentbit/Dockerfile @@ -1,3 +1,6 @@ FROM fluent/fluent-bit:2.1.8 +LABEL authors="Shubham Varshney" +LABEL maintainer="Shubham Varshney" + ADD fluent-bit.conf.temp /fluent-bit/etc/ #ADD parsers.conf /fluent-bit/etc/ \ No newline at end of file diff --git a/newrelic-infra/execute.sh b/newrelic-infra/execute.sh new file mode 100755 index 0000000..e80388a --- /dev/null +++ b/newrelic-infra/execute.sh @@ -0,0 +1 @@ +echo $NEWRELIC_API_KEY | sed -i 's/$NEWRELIC_API_KEY/$1/g' /etc/newrelic-infra.yml \ No newline at end of file diff --git a/newrelic-infra/newrelic-infra.dockerfile b/newrelic-infra/newrelic-infra.dockerfile index 8c063eb..3930993 100644 --- a/newrelic-infra/newrelic-infra.dockerfile +++ b/newrelic-infra/newrelic-infra.dockerfile @@ -1,2 +1,10 @@ FROM newrelic/infrastructure:latest -ADD newrelic-infra/newrelic-infra.yml /etc/newrelic-infra.yml \ No newline at end of file +LABEL authors="Shubham Varshney" +LABEL maintainer="Shubham Varshney" + +ADD newrelic-infra/newrelic-infra.yml /etc/newrelic-infra.yml +ADD newrelic-infra/execute.sh /tmp/execute.sh + +RUN chmod 777 /tmp/execute.sh + +ENTRYPOINT "/bin/bash /tmp/execute.sh" \ No newline at end of file diff --git a/newrelic-infra/newrelic-infra.yml b/newrelic-infra/newrelic-infra.yml index 5cce969..6c3f050 100644 --- a/newrelic-infra/newrelic-infra.yml +++ b/newrelic-infra/newrelic-infra.yml @@ -1 +1 @@ - license_key: ${NEWRELIC_API_KEY} + license_key: 9815e0163fd3e754c542094658a7fa0fFFFFNRAL diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b7ec5d2..f49d3f7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -19,6 +19,9 @@ kafka: name: template-service-java-springboot logging: level: + io: + micrometer: + newrelic: TRACE org: hibernate: ERROR springframework: @@ -35,6 +38,10 @@ management: probes: enabled: true metrics: + export: + newrelic: + api-key: 9815e0163fd3e754c542094658a7fa0fFFFFNRAL + account-id: 4413760 tags: application: ${spring.application.name} security: @@ -73,6 +80,8 @@ spring: properties: hibernate: dialect: org.hibernate.dialect.MySQLDialect + connection: + handling_mode: DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION kafka: bootstrap-servers: localhost:29092 consumer: