Skip to content

Commit

Permalink
af
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamv108 committed May 1, 2024
1 parent 0dc5531 commit 9ee6670
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 19 deletions.
19 changes: 19 additions & 0 deletions .run/TemplateServiceJavaSpringBootApplication.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="TemplateServiceJavaSpringBootApplication" type="Application" factoryName="Application" nameIsGenerated="true">
<envs>
<env name="NEWRELIC_API_KEY" value="9815e0163fd3e754c542094658a7fa0fFFFFNRAL" />
</envs>
<option name="MAIN_CLASS_NAME" value="code.shubham.TemplateServiceJavaSpringBootApplication" />
<module name="template-service-java-springboot.main" />
<option name="VM_PARAMETERS" value="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=8009 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="code.shubham.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

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"]
28 changes: 15 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand All @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 5 additions & 3 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
web:
container_name: template-service-java-springboot-web
Expand All @@ -17,6 +15,7 @@ services:

ports:
- '8080:8080'
- '8009:8009'

restart: 'on-failure'

Expand Down Expand Up @@ -70,6 +69,7 @@ services:

ports:
- '8081:8080'
- '8010:8009'

restart: 'on-failure'

Expand Down Expand Up @@ -169,7 +169,7 @@ services:
- ./log/:/etc/data

newrelic:
image: 'newrelic'
image: 'newrelic:latest'
container_name: newrelic
build:
context: .
Expand All @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions fluentbit/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
1 change: 1 addition & 0 deletions newrelic-infra/execute.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo $NEWRELIC_API_KEY | sed -i 's/$NEWRELIC_API_KEY/$1/g' /etc/newrelic-infra.yml
10 changes: 9 additions & 1 deletion newrelic-infra/newrelic-infra.dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
FROM newrelic/infrastructure:latest
ADD newrelic-infra/newrelic-infra.yml /etc/newrelic-infra.yml
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"
2 changes: 1 addition & 1 deletion newrelic-infra/newrelic-infra.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
license_key: ${NEWRELIC_API_KEY}
license_key: 9815e0163fd3e754c542094658a7fa0fFFFFNRAL
9 changes: 9 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ kafka:
name: template-service-java-springboot
logging:
level:
io:
micrometer:
newrelic: TRACE
org:
hibernate: ERROR
springframework:
Expand All @@ -35,6 +38,10 @@ management:
probes:
enabled: true
metrics:
export:
newrelic:
api-key: 9815e0163fd3e754c542094658a7fa0fFFFFNRAL
account-id: 4413760
tags:
application: ${spring.application.name}
security:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 9ee6670

Please sign in to comment.