https://github.com/michael-simons/helidon-test
https://github.com/michael-simons/helidon-test
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/michael-simons/helidon-test
- Owner: michael-simons
- Created: 2019-07-17T16:19:07.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-17T16:19:17.000Z (almost 7 years ago)
- Last Synced: 2025-03-27T06:49:10.828Z (over 1 year ago)
- Language: Java
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Helidon Quickstart SE Example
This project implements a simple Hello World REST service using Helidon SE.
## Prerequisites
1. Maven 3.5 or newer
2. Java SE 8 or newer
3. Docker 17 or newer to build and run docker images
4. Kubernetes minikube v0.24 or newer to deploy to Kubernetes (or access to a K8s 1.7.4 or newer cluster)
5. Kubectl 1.7.4 or newer to deploy to Kubernetes
Verify prerequisites
```
java -version
mvn --version
docker --version
minikube version
kubectl version --short
```
## Build
```
mvn package
```
## Start the application
```
java -jar target/helidon-quickstart-se.jar
```
## Exercise the application
```
curl -X GET http://localhost:8080/greet
{"message":"Hello World!"}
curl -X GET http://localhost:8080/greet/Joe
{"message":"Hello Joe!"}
curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http://localhost:8080/greet/greeting
curl -X GET http://localhost:8080/greet/Jose
{"message":"Hola Jose!"}
```
## Try health and metrics
```
curl -s -X GET http://localhost:8080/health
{"outcome":"UP",...
. . .
# Prometheus Format
curl -s -X GET http://localhost:8080/metrics
# TYPE base:gc_g1_young_generation_count gauge
. . .
# JSON Format
curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics
{"base":...
. . .
```
## Build the Docker Image
```
docker build -t helidon-quickstart-se .
```
## Start the application with Docker
```
docker run --rm -p 8080:8080 helidon-quickstart-se:latest
```
Exercise the application as described above
## Deploy the application to Kubernetes
```
kubectl cluster-info # Verify which cluster
kubectl get pods # Verify connectivity to cluster
kubectl create -f app.yaml # Deply application
kubectl get service helidon-quickstart-se # Get service info
```
## Native image with GraalVM
GraalVM allows you to compile your programs ahead-of-time into a native
executable. See https://www.graalvm.org/docs/reference-manual/aot-compilation/
for more information.
You can build a native executable in 2 different ways:
* With a local installation of GraalVM
* Using Docker
### Local build
Download Graal VM at https://github.com/oracle/graal/releases, the version
currently supported for Helidon is `19.0.0`.
```
# Setup the environment
export GRAALVM_HOME=/path
# build the native executable
mvn package -Pnative-image
```
You can also put the Graal VM `bin` directory in your PATH, or pass
`-DgraalVMHome=/path` to the Maven command.
See https://github.com/oracle/helidon-build-tools/tree/master/helidon-maven-plugin
for more information.
Start the application:
```
./target/helidon-quickstart-se
```
### Multi-stage Docker build
Build the "native" Docker Image
```
docker build -t helidon-quickstart-se-native -f Dockerfile.native .
```
Start the application:
```
docker run --rm -p 8080:8080 helidon-quickstart-se-native:latest
```