From e9a13394d6b5cc98875f5064fdf150cf1226ba18 Mon Sep 17 00:00:00 2001 From: Otavio Santana Date: Sun, 13 Oct 2024 05:40:15 +0100 Subject: [PATCH] docs: convert adoc Signed-off-by: Otavio Santana --- README.md => README.adoc | 118 +++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 59 deletions(-) rename README.md => README.adoc (75%) diff --git a/README.md b/README.adoc similarity index 75% rename from README.md rename to README.adoc index b2f7e4e..00a0b68 100644 --- a/README.md +++ b/README.adoc @@ -1,27 +1,28 @@ -# hotel-reservation += hotel-reservation Sample Helidon MP project that includes multiple REST operations. -## Build and run - +== Build and run With JDK21 -```bash +[source,bash] +---- mvn package java -jar target/hotel-reservation.jar -``` +---- -## Exercise the application +== Exercise the application Basic: -``` +[source,bash] +---- curl -X GET http://localhost:8080/simple-greet Hello World! -``` - +---- JSON: -``` +[source,bash] +---- curl -X GET http://localhost:8080/greet {"message":"Hello World!"} @@ -32,39 +33,34 @@ curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http: curl -X GET http://localhost:8080/greet/Jose {"message":"Hola Jose!"} -``` - - +---- -## Try health - -``` +== Try health +[source,bash] +---- curl -s -X GET http://localhost:8080/health {"outcome":"UP",... +---- -``` - - -## Building a Native Image +== Building a Native Image The generation of native binaries requires an installation of GraalVM 22.1.0+. You can build a native binary using Maven as follows: - -``` +[source,bash] +---- mvn -Pnative-image install -DskipTests -``` +---- The generation of the executable binary may take a few minutes to complete depending on your hardware and operating system. When completed, the executable file will be available under the `target` directory and be named after the artifact ID you have chosen during the project generation phase. +== Try metrics - -## Try metrics - -``` +[source,bash] +---- # Prometheus Format curl -s -X GET http://localhost:8080/metrics # TYPE base:gc_g1_young_generation_count gauge @@ -74,73 +70,77 @@ curl -s -X GET http://localhost:8080/metrics curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics {"base":... . . . -``` - +---- +== Building the Docker Image -## Building the Docker Image - -``` +[source,bash] +---- docker build -t hotel-reservation . -``` +---- -## Running the Docker Image +== Running the Docker Image -``` +[source,bash] +---- docker run --rm -p 8080:8080 hotel-reservation:latest -``` +---- Exercise the application as described above. - -## Run the application in Kubernetes +== Run the application in Kubernetes -If you don’t have access to a Kubernetes cluster, you can [install one](https://helidon.io/docs/latest/#/about/kubernetes) on your desktop. +If you don’t have access to a Kubernetes cluster, you can https://helidon.io/docs/latest/#/about/kubernetes[install one] on your desktop. -### Verify connectivity to cluster +=== Verify connectivity to cluster -``` +[source,bash] +---- kubectl cluster-info # Verify which cluster kubectl get pods # Verify connectivity to cluster -``` +---- -### Deploy the application to Kubernetes +=== Deploy the application to Kubernetes -``` +[source,bash] +---- kubectl create -f app.yaml # Deploy application kubectl get pods # Wait for quickstart pod to be RUNNING kubectl get service hotel-reservation # Get service info kubectl port-forward service/hotel-reservation 8081:8080 # Forward service port to 8081 -``` +---- You can now exercise the application as you did before but use the port number 8081. After you’re done, cleanup. -``` +[source,bash] +---- kubectl delete -f app.yaml -``` - +---- -## Building a Custom Runtime Image +== Building a Custom Runtime Image Build the custom runtime image using the jlink image profile: -``` +[source,bash] +---- 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/hotel-reservation-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: +The `target/hotel-reservation-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 provided start script: -``` +[source,bash] +---- ./target/hotel-reservation-jri/bin/start -``` +---- + +=== Class Data Sharing (CDS) Archive -Class Data Sharing (CDS) Archive Also included in the custom image is a Class Data Sharing (CDS) archive that improves your application’s startup performance and in-memory footprint. You can learn more about Class Data Sharing in the JDK documentation. @@ -150,9 +150,9 @@ The size of the CDS archive is reported at the end of the build output. If you’d rather have a smaller image size (with a slightly increased startup time) you can skip the creation of the CDS archive by executing your build like this: -``` +[source,bash] +---- mvn package -Pjlink-image -Djlink.image.addClassDataSharingArchive=false -``` +---- For more information on available configuration options see the helidon-maven-plugin documentation. -