= Creating a Simple Quarkus App
Thomas W. Stütz, credits to Mr. Christian Aberger
1.0.1, 2021-03-03: How to use ssh in project work @ HTL Leonding college
ifndef::imagesdir[:imagesdir: images]
//:toc-placement!:  // prevents the generation of the doc at this position, so it can be printed afterwards
:sourcedir: ../src/main/java
:icons: font
:sectnums:    // Nummerierung der Überschriften / section numbering
:toc: left
:toclevels: 5
:experimental: true
:linkattrs:   // so window="_blank" will be executed

//Need this blank line after ifdef, don't know why...
ifdef::backend-html5[]

// https://fontawesome.com/v4.7.0/icons/
icon:file-text-o[link=https://raw.githubusercontent.com/htl-leonding-college/quarkus-jar-gh-actions-demo/master/asciidocs/{docname}.adoc] ‏ ‏ ‎
icon:github-square[link=https://github.com/htl-leonding-college/quarkus-jar-gh-actions-demo] ‏ ‏ ‎
icon:home[link=http://edufs.edu.htl-leonding.ac.at/~t.stuetz/hugo/]
endif::backend-html5[]

// print the toc here (not at the default position)
//toc::[]

----
Credits to Mr. Christian Aberger - this notes are based on his lecture @ HTL Leonding
----

== Create a Quarkus-App at quarkus.io

* browse to https://quarkus.io/

* click on kbd:[START CODING]

.Create a repo and push to gh. The first time, you have to approve the push to github.
image:quarkus-001.png[width=80%]

.Clone the repo to your local machine
image:quarkus-002.png[width=50%]

[source,bash]
----
git clone https://github.com/htl-leonding/gh-actions-demo.git
----

=== First Try - Run your Quarkus App

----
./mvnw clean compile quarkus:dev
----

----
curl localhost:8080/hello
----

.result
----
Hello RESTEasy
----

=== Change Quarkus Package Type

* To deploy the jar-file on the remote server, we have to include all dependencies into the jar-file.

==== Package Types

* quarkus.package.type=uber-jar
** `fast-jar` (default)
** `legacy-jar` for the pre-1.12 default jar packaging,
** `uber-jar`
** `native`


==== Configuration in Quarkus

* There are plenty of configuration options available (https://quarkus.io/guides/all-config[more information])

* Basically there are three ways to configure a quarkus app
. Add an entry to *application.properties*
+
----
quarkus.package.type=uber-jar
----

. Add an *parameter* when invoking *maven*
+
----
./mvnw clean package -Dquarkus.package.type=uber-jar
----

. Add an entry to the *pom.xml*
+
[source,xml]
----
<properties>
  <quarkus.package.type>uber-jar</quarkus.package.type>
  ...
</properties>
----


=== Compile the Quarkus App


.After compiling and packaging ...
----
./mvnw clean package -Dquarkus.package.type=uber-jar
----

.\...you get a -runner - jar with all dependencies included
----
-rw-r--r--   1 stuetz  staff    10M Mar 13 19:17 gh-actions-demo-1.0.0-SNAPSHOT-runner.jar
-rw-r--r--   1 stuetz  staff   4.7K Mar 13 19:17 gh-actions-demo-1.0.0-SNAPSHOT.jar.original
----

=== Run the jar-File

----
java -jar target/gh-actions-demo-1.0.0-SNAPSHOT-runner.jar
----

=== Check the Endpoint

----
curl http://localhost:8080/hello
----

.Result
----
Hello RESTEasy
----


