Skip to content
Draft
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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ ARG GITLAB_MAVEN_REGISTRY_URL
WORKDIR /app
COPY . /app

RUN ./gradlew clean -x test build
RUN --mount=type=bind,source=.m2,target=/root/.m2 \
./gradlew clean -x test build

FROM openjdk:21-jdk-slim AS backend
COPY --from=build /app/cf-application/build/libs/*SNAPSHOT.jar /app.jar
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile.native
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/graalvm/graalvm-community:21 AS build
ARG GITLAB_MAVEN_REGISTRY_URL
ARG HOME
WORKDIR /app
COPY . /app
RUN --mount=type=bind,source=.m2,target=/root/.m2 \
./gradlew clean nativeCompile

# Final image
FROM ubuntu:22.04
WORKDIR /app
COPY --from=build /app/cf-application/build/native/nativeCompile/* /opt/
EXPOSE 8080
ENTRYPOINT ["/opt/cf-application"]
15 changes: 5 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subprojects {
apply(plugin = "com.github.ben-manes.versions")
apply(plugin = "info.solidsoft.pitest")

group = "de.cardanofoundation"
group = "org.cardanofoundation"
version = "1.1.0-SNAPSHOT"

sourceSets {
Expand All @@ -30,7 +30,7 @@ subprojects {
mavenLocal()
mavenCentral()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
}

val gitlabMavenRegistryUrl = providers.environmentVariable("GITLAB_MAVEN_REGISTRY_URL").orElse(providers.gradleProperty("gitlabMavenRegistryUrl"))
Expand All @@ -52,10 +52,10 @@ subprojects {
}
}

extra["springBootVersion"] = "3.3.3"
extra["springBootVersion"] = "3.3.13"
extra["springCloudVersion"] = "2023.0.0"
extra["jMoleculesVersion"] = "2023.1.0"
extra["cfLobPlatformVersion"] = "1.1.0-release-1.1.0-d6fcd8a-GHRUN16669156803"
extra["cfLobPlatformVersion"] = "1.1.0-native-test-SNAPSHOT"

dependencies {
compileOnly("org.projectlombok:lombok:1.18.32")
Expand Down Expand Up @@ -95,10 +95,8 @@ subprojects {
}

tasks {
val ENABLE_PREVIEW = "--enable-preview"

withType<JavaCompile> {
options.compilerArgs.add(ENABLE_PREVIEW)
//options.compilerArgs.add("-Xlint:preview")
val isKafkaEnabled: Boolean = System.getenv("KAFKA_ENABLED")?.toBooleanStrictOrNull() ?: true
if (!isKafkaEnabled) {
Expand All @@ -109,22 +107,19 @@ subprojects {

withType<Test> {
useJUnitPlatform()
jvmArgs(ENABLE_PREVIEW)
}

withType<PitestTask> {
jvmArgs(ENABLE_PREVIEW)
}

withType<JavaExec> {
jvmArgs(ENABLE_PREVIEW)
}

}

pitest {
//adds dependency to org.pitest:pitest-junit5-plugin and sets "testPlugin" to "junit5"
jvmArgs.add("--enable-preview")
// jvmArgs.add("--enable-preview")
targetClasses.set(setOf("org.cardanofoundation.lob.app.*"))
targetTests.set(setOf("org.cardanofoundation.lob.app.*"))
exportLineCoverage = true
Expand Down
41 changes: 39 additions & 2 deletions cf-application/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id("org.springframework.boot") version "3.3.0"
id("org.springframework.boot") version "3.3.13"
id("org.graalvm.buildtools.native") version "0.11.0"
id("org.hibernate.orm") version "6.5.2.Final"
}
val isKafkaEnabled: Boolean = System.getenv("KAFKA_ENABLED")?.toBooleanStrictOrNull() ?: true
dependencies {
Expand All @@ -25,5 +27,40 @@ dependencies {
implementation("org.cardanofoundation:cf-lob-platform-netsuite_altavia_erp_adapter:${property("cfLobPlatformVersion")}")
implementation("org.cardanofoundation:cf-lob-platform-csv_erp_adapter:${property("cfLobPlatformVersion")}")
implementation("org.cardanofoundation:cf-lob-platform-blockchain_publisher:${property("cfLobPlatformVersion")}")
implementation("org.cardanofoundation:cf-lob-platform-accounting_reporting_core:${property("cfLobPlatformVersion")}")
implementation("org.cardanofoundation:cf-lob-platform-accounting_reporting_core:${property("cfLobPlatformVersion")}") {
exclude(group = "io.hypersistence", module = "hypersistence-utils-hibernate-63")
}
}

tasks.withType<org.springframework.boot.gradle.tasks.aot.ProcessAot> {
args("--spring.profiles.active=dev--yaci-dev-kit")
environment("SPRING_KAFKA_ENABLED", "false")
environment("LOB_ACCOUNTING_REPORTING_CORE_ENABLED", "true")
environment("LOB_ORGANISATION_ENABLED", "true")
environment("LOB_BLOCKCHAIN_READER_ENABLED", "true")
environment("LOB_BLOCKCHAIN_PUBLISHER_ENABLED", "true")
environment("LOB_NETSUITE_ENABLED", "true")
environment("LOB_CSV_ENABLED", "true")
// args("--spring.profiles.active=dev--yaci-dev-kit,pre-prod-prod")
}

hibernate {
enhancement {
lazyInitialization(true)
dirtyTracking(true)
associationManagement(true)
}
}

graalvmNative {
binaries {
named("main") {
// mainClass.set("org.cardanofoundation.lob.app.LobServiceApp")
sharedLibrary.set(false)
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(21))
})
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.hc.client5.http.config.RequestConfig;
Expand All @@ -25,6 +26,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
Expand All @@ -37,6 +39,8 @@
import org.springframework.web.client.RestClient;
import org.springframework.web.filter.ShallowEtagHeaderFilter;

import ch.qos.logback.classic.Logger;

import java.math.BigDecimal;
import java.time.Clock;
import java.time.Duration;
Expand All @@ -56,8 +60,12 @@
@EnableAutoConfiguration
@Slf4j
@Import({ LobServiceApp.CacheConfig.class, LobServiceApp.MetricsConfig.class, LobServiceApp.SchedulerConfig.class, LobServiceApp.TimeConfig.class, LobServiceApp.JaversConfig.class, LobServiceApp.RestClientConfig.class, LobServiceApp.RestClientConfig.class, SpringWebConfig.class })
@EnableAspectJAutoProxy
public class LobServiceApp {

@Value("${lob.blockchain_reader.lob_follower_base_url:http://localhost:9090/api}")
String followerBaseUrl;

public static void main(String[] args) {
SpringApplication.run(LobServiceApp.class, args);
}
Expand All @@ -69,9 +77,15 @@ public CommandLineRunner onStart() {
};
}

@PostConstruct
public void printConfig() {
log.info("********* follower url configured: {}", followerBaseUrl);

}

@Configuration
@EnableCaching
public class CacheConfig {
public static class CacheConfig {

// https://asbnotebook.com/etags-in-restful-services-spring-boot/
@Bean
Expand All @@ -84,7 +98,7 @@ public ShallowEtagHeaderFilter shallowEtagHeaderFilter() {
}

@Configuration
public class MetricsConfig {
public static class MetricsConfig {

@Bean
public TimedAspect timedAspect(MeterRegistry registry) {
Expand All @@ -96,7 +110,7 @@ public TimedAspect timedAspect(MeterRegistry registry) {

@Configuration
@EnableScheduling
public class SchedulerConfig {
public static class SchedulerConfig {

@Bean
public ScheduledTaskRegistrar scheduledTaskRegistrar() {
Expand All @@ -121,7 +135,7 @@ TaskScheduler threadPoolTaskScheduler() {
}

@Configuration
public class TimeConfig {
public static class TimeConfig {

@Bean
public Clock clock() {
Expand All @@ -132,7 +146,7 @@ public Clock clock() {
}

@Configuration
public class JaversConfig {
public static class JaversConfig {

@Bean
public Javers javers() {
Expand All @@ -147,7 +161,7 @@ public Javers javers() {
}

@Configuration
public class RestClientConfig {
public static class RestClientConfig {

@Value("${lob.netsuite.client.timeout-seconds:300}")
private int netsuiteClientTimeoutSeconds;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"name":"[Lcom.sun.management.internal.DiagnosticCommandArgumentInfo;"
},
{
"name":"[Lcom.sun.management.internal.DiagnosticCommandInfo;"
},
{
"name":"com.sun.management.internal.DiagnosticCommandArgumentInfo",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","java.lang.String","boolean","boolean","boolean","int"] }]
},
{
"name":"com.sun.management.internal.DiagnosticCommandInfo",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","java.lang.String","java.lang.String","java.lang.String","boolean","java.util.List"] }]
},
{
"name":"java.lang.Boolean",
"methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }]
},
{
"name":"java.util.Arrays",
"methods":[{"name":"asList","parameterTypes":["java.lang.Object[]"] }]
},
{
"name":"sun.management.VMManagementImpl",
"fields":[{"name":"compTimeMonitoringSupport"}, {"name":"currentThreadCpuTimeSupport"}, {"name":"objectMonitorUsageSupport"}, {"name":"otherThreadCpuTimeSupport"}, {"name":"remoteDiagnosticCommandsSupport"}, {"name":"synchronizerUsageSupport"}, {"name":"threadAllocatedMemorySupport"}, {"name":"threadContentionMonitoringSupport"}]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"type":"agent-extracted",
"classes":[
]
}
]

Loading