Skip to content

Commit

Permalink
added helidon se
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir.Shapkin authored and Vladimir.Shapkin committed Oct 16, 2023
1 parent d37bc7d commit bb421fa
Show file tree
Hide file tree
Showing 75 changed files with 1,701 additions and 1,762 deletions.
61 changes: 57 additions & 4 deletions config-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,34 @@
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>
<groupId>my.test.eureka</groupId>
<artifactId>parent-pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<artifactId>config-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>config</name>
<description>Demo project for Spring Boot</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-cloud.version>2022.0.1</spring-cloud.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand All @@ -35,4 +52,40 @@
</plugins>
</build>

<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</project>
28 changes: 22 additions & 6 deletions eureka-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,35 @@
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>
<groupId>my.test.eureka</groupId>
<artifactId>parent-pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<artifactId>eureka-server</artifactId>
<version>1.0-SNAPSHOT</version>

<name>eureka-server</name>
<description>Demo project eureka service discovery</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-cloud.version>2022.0.1</spring-cloud.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions helidon_mp/Dockerfile → helidon-se/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml pom.xml
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip -DskipOpenApiGenerate
RUN mvn package -Dmaven.test.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
Expand All @@ -22,9 +22,9 @@ FROM openjdk:17-jdk-slim
WORKDIR /helidon

# Copy the binary built in the 1st stage
COPY --from=build /helidon/target/helidon-quickstart-mp.jar ./
COPY --from=build /helidon/target/helidon-quickstart-se.jar ./
COPY --from=build /helidon/target/libs ./libs

CMD ["java", "-jar", "helidon-quickstart-mp.jar"]
CMD ["java", "-jar", "helidon-quickstart-se.jar"]

EXPOSE 8080
6 changes: 3 additions & 3 deletions helidon_mp/Dockerfile.native → helidon-se/Dockerfile.native
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# 1st stage, build the app
FROM ghcr.io/graalvm/graalvm-ce:ol9-java17-22.3.0 as build
FROM ghcr.io/graalvm/graalvm-ce:ol9-java19-22.3.0 as build

# Install native-image
RUN gu install native-image
Expand Down Expand Up @@ -35,8 +35,8 @@ FROM scratch
WORKDIR /helidon

# Copy the binary built in the 1st stage
COPY --from=build /helidon/target/helidon-quickstart-mp .
COPY --from=build /helidon/target/helidon-quickstart-se .

ENTRYPOINT ["./helidon-quickstart-mp"]
ENTRYPOINT ["./helidon-quickstart-se"]

EXPOSE 8080
25 changes: 16 additions & 9 deletions helidon_mp/README.md → helidon-se/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# helidon-quickstart-mp
# helidon-quickstart-se

Minimal Helidon MP project suitable to start from scratch.
Sample Helidon SE project that includes multiple REST operations.

## Build and run


With JDK17+
```bash
mvn package
java -jar target/helidon-quickstart-mp.jar
java -jar target/helidon-quickstart-se.jar
```

## Exercise the application
```
curl -X GET http://localhost:8080/simple-greet
{"message":"Hello World!"}
```

```
curl -X GET http://localhost:8080/greet
{"message":"Hello World!"}
Expand All @@ -30,6 +31,7 @@ curl -X GET http://localhost:8080/greet/Jose
```



## Try metrics

```
Expand All @@ -45,6 +47,7 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics
```



## Try health

```
Expand All @@ -54,6 +57,7 @@ curl -s -X GET http://localhost:8080/health
```



## Building a Native Image

Make sure you have GraalVM locally installed:
Expand All @@ -72,24 +76,27 @@ This uses the helidon-maven-plugin to perform the native compilation using your
Once it completes start the application using the native executable (no JVM!):

```
./target/helidon-quickstart-mp
./target/helidon-quickstart-se
```

Yep, it starts fast. You can exercise the application’s endpoints as before.


## Building the Docker Image

```
docker build -t helidon-quickstart-mp .
docker build -t helidon-quickstart-se .
```

## Running the Docker Image

```
docker run --rm -p 8080:8080 helidon-quickstart-mp:latest
docker run --rm -p 8080:8080 helidon-quickstart-se:latest
```

Exercise the application as described above.


## Building a Custom Runtime Image

Build the custom runtime image using the jlink image profile:
Expand All @@ -101,11 +108,11 @@ mvn package -Pjlink-image
This uses the helidon-maven-plugin to perform the custom image generation.
After the build completes it will report some statistics about the build including the reduction in image size.

The target/helidon-quickstart-mp-jri directory is a self contained custom image of your application. It contains your application,
The target/helidon-quickstart-se-jri directory is a self contained custom image of your application. It contains your application,
its runtime dependencies and the JDK modules it depends on. You can start your application using the provide start script:

```
./target/helidon-quickstart-mp-jri/bin/start
./target/helidon-quickstart-se-jri/bin/start
```

Class Data Sharing (CDS) Archive
Expand All @@ -123,4 +130,4 @@ mvn package -Pjlink-image -Djlink.image.addClassDataSharingArchive=false
```

For more information on available configuration options see the helidon-maven-plugin documentation.


Loading

0 comments on commit bb421fa

Please sign in to comment.