Skip to content

refactor: spring boot 3.4 streamlining across sub-applications #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged
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
6 changes: 3 additions & 3 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:24.04 AS build-common
WORKDIR /build

RUN apt update --fix-missing \
&& apt install -y --no-install-recommends openjdk-21-jdk maven curl \
&& apt install -y --no-install-recommends openjdk-21-jdk maven curl ca-certificates \
&& apt clean

COPY ./pom.xml /build/pom.xml
Expand All @@ -11,12 +11,12 @@ COPY ./yaci-indexer /build/yaci-indexer
COPY ./test-data-generator /build/test-data-generator
COPY ./.git .git

RUN --mount=type=cache,target=/root/.m2 mvn clean package -DskipTests
RUN --mount=type=cache,target=/root/.m2 mvn -U clean package -DskipTests

WORKDIR /app
RUN cp /build/api/target/*.jar /app/api.jar
RUN rm -rf /build

ENTRYPOINT ["java", "--enable-preview", "-jar", "/app/api.jar"]

CMD ["/bin/sh", "-c", "bash"]
CMD ["/bin/sh", "-c", "bash"]
19 changes: 12 additions & 7 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>base</artifactId>
<groupId>org.cardanofoundation.rosetta-java</groupId>
Expand Down Expand Up @@ -30,6 +31,14 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand All @@ -52,10 +61,6 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
Expand Down Expand Up @@ -131,24 +136,26 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<artifactId>hibernate-jpamodelgen</artifactId>
<groupId>org.hibernate.orm</groupId>
<version>6.2.0.Final</version>
<scope>provided</scope>
</dependency>


<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.9.0</version>
</dependency>

<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
Expand All @@ -165,8 +172,6 @@
<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-63</artifactId>
<version>3.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ RUN mkdir -p /node/postgres
RUN rm -rf /var/lib/postgresql/${PG_VERSION}/main

# Install jdk 21
RUN apt install -y --no-install-recommends openjdk-21-jdk jq bc sudo curl \
RUN apt install -y --no-install-recommends jq bc sudo curl \
&& apt clean

# Copy cardano node
Expand Down
28 changes: 20 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
</licenses>

<properties>
<maven.compiler.proc>full</maven.compiler.proc>
<revision>1.2.8</revision>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.spring-boot>3.4.3</version.spring-boot>
<version.spring-boot>3.4.4</version.spring-boot>
<version.springdoc-openapi-ui>1.6.15</version.springdoc-openapi-ui>
<version.openapi-generator-maven-plugin>6.4.0</version.openapi-generator-maven-plugin>
<version.maven-compiler-plugin>3.13.0</version.maven-compiler-plugin>
<version.maven-surefire-plugin>3.2.5</version.maven-surefire-plugin>
<version.hibernate-types>3.7.1</version.hibernate-types>
<version.jacoco-maven-plugin>0.8.11</version.jacoco-maven-plugin>
<version.flatten-maven-plugin>1.3.0</version.flatten-maven-plugin>
<version.lombok>1.18.38</version.lombok>
Expand Down Expand Up @@ -90,6 +92,18 @@
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${version.spring-boot}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<type>pom</type>
<version>${version.spring-boot}</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.cardanofoundation</groupId>
<artifactId>cf-cardano-conversions-java</artifactId>
Expand All @@ -100,13 +114,6 @@
<artifactId>vavr</artifactId>
<version>${version.vavr}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<type>pom</type>
<version>${version.spring-boot}</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
Expand Down Expand Up @@ -143,6 +150,11 @@
<artifactId>yaci</artifactId>
<version>${version.yaci}</version>
</dependency>
<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-63</artifactId>
<version>${version.hibernate-types}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down
7 changes: 7 additions & 0 deletions test-data-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
<version>${version.maven-compiler-plugin}</version>
<configuration>
<release>21</release>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${version.lombok}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion yaci-indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPY ./yaci-indexer /build/yaci-indexer
COPY ./test-data-generator /build/test-data-generator
COPY ./.git .git

RUN --mount=type=cache,target=/root/.m2 mvn clean package -DskipTests
RUN --mount=type=cache,target=/root/.m2 mvn -U clean package -DskipTests

WORKDIR /app
RUN cp /build/yaci-indexer/target/*.jar /app/yaci-indexer.jar
Expand Down
42 changes: 36 additions & 6 deletions yaci-indexer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.10</version>
<relativePath/> <!-- lookup parent from repository -->
<artifactId>base</artifactId>
<groupId>org.cardanofoundation.rosetta-java</groupId>
<version>${revision}</version>
</parent>

<groupId>org.cardanofoundation.rosetta-java</groupId>
<artifactId>yaci-indexer</artifactId>
<version>1.0.0</version>
<name>yaci-indexer</name>

<description>yaci-indexer</description>
<packaging>jar</packaging>

<properties>
<java.version>21</java.version>
<maven.compiler.proc>full</maven.compiler.proc>
<yaci-store.version>0.1.2</yaci-store.version>
<sonar.exclusions>src/main/java/org/cardanofoundation/rosetta/yaciindexer/stores/txsize/model/*</sonar.exclusions>
<version.spotless-maven-plugin>2.43.0</version.spotless-maven-plugin>
Expand All @@ -38,7 +40,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down Expand Up @@ -88,6 +89,10 @@
<artifactId>yaci-store-epoch-spring-boot-starter</artifactId>
<version>${yaci-store.version}</version>
</dependency>
<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-63</artifactId>
</dependency>
<!-- Add mysql or H2 or Postgres dependency based on your database -->
<dependency>
<groupId>org.postgresql</groupId>
Expand All @@ -100,6 +105,31 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${version.spring-boot}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>

</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.maven-compiler-plugin}</version>
<configuration>
<release>21</release>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${version.lombok}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
spring.datasource.url=jdbc:h2:file:./testData/devkit.db
spring.datasource.username=rosetta_db_admin
spring.datasource.password=weakpwd#123_d
spring.h2.console.enabled=true
spring.h2.console.enabled=true

spring.jpa.hibernate.ddl-auto=update
4 changes: 3 additions & 1 deletion yaci-indexer/src/main/resources/application-h2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
spring.datasource.url=jdbc:h2:mem:${DB_NAME:rosetta-java}
spring.datasource.username=${DB_USER:rosetta_db_admin}
spring.datasource.password=${DB_SECRET:weakpwd#123_d}
spring.h2.console.enabled=true
spring.h2.console.enabled=true

spring.jpa.hibernate.ddl-auto=update
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
##################### Postgres DB #######################
spring.datasource.url=jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5433}/${DB_NAME:rosetta-java}?currentSchema=${DB_SCHEMA:preprod}
spring.datasource.username=${DB_USER:rosetta_db_admin}
spring.datasource.password=${DB_SECRET:weakpwd#123_d}
spring.datasource.password=${DB_SECRET:weakpwd#123_d}

spring.jpa.hibernate.ddl-auto=none
1 change: 0 additions & 1 deletion yaci-indexer/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ spring.profiles.active=${YACI_SPRING_PROFILES: h2}
server.port=9095
#The following flyway section is mandatory
spring.flyway.out-of-order=true
spring.jpa.hibernate.ddl-auto=update
spring.flyway.locations=classpath:db/store/{vendor}

#Api prefix for out-of-box REST API
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS transaction_size (
tx_hash TEXT PRIMARY KEY,
block_number BIGINT NOT NULL,
size INTEGER NOT NULL,
script_size INTEGER NOT NULL
);