From fee28e6d9d1edf322794f34d3bfa8a81c51143dd Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 20 Mar 2021 16:39:27 +0100 Subject: [PATCH 01/76] Create Heroku.md --- docs/Heroku.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 docs/Heroku.md diff --git a/docs/Heroku.md b/docs/Heroku.md new file mode 100644 index 0000000..35ef29f --- /dev/null +++ b/docs/Heroku.md @@ -0,0 +1,71 @@ +# Heroku deployment +The goal was to deploy a demo online, so that you don't have to run the code locally and also have a showcase available online. + +I used [Heroku](https://www.heroku.com/home) once before with GitHub so I choose that as my cloud platform again. + +## How to set it up +The setup is based on [this guide](https://dev.to/heroku/deploying-to-heroku-from-github-actions-29ej) + +### Preparing Heroku +At first: You need to [setup an account](https://signup.heroku.com/) + +TL;DR
+Web applications on Heroku are called [web dynos](https://www.heroku.com/dynos).
+A [free tier account on Heroku](https://www.heroku.com/pricing) grants you 550 dyno hours (and additional 450 hours if you add your credit card).
+Your dyno will automatically sleep/shut down if there is no activity in the last 30 minutes. + +After the account is set up, create a new app: +![Pic](https://user-images.githubusercontent.com/80211953/111872102-e4fb4a80-898d-11eb-8151-ab41ca7a23b7.png) +Choose your region, add a name (the app will be available under that ``https://.herokuapp.com``) and then click create app. + +### Deploying the project using GitHub +Great, now we have a new app on heroku but there isn't actually anything running, because nothing was deployed. + +So how can the code be deployed? +There are 2 ways: +* Setup a deployment pipeline directly in heroku +* Write a [GitHub actions](https://github.com/features/actions) workflow that builds and deploys the code + +I wanted to stay independent from Heroku and - through the fact that I already had experience with GitHub Actions - I ultimatively choose those. + +#### Setting up secrets +There have to be some [secrets stored for the coming GitHub Actions workflow](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository): +* ``HEROKU_APP_NAME``
+The app-name that is used on heroku e.g. ``hackathon-ms-fuel-filling`` +* ``HEROKU_API_KEY``
+The API-Key so that the app can be deployed to heroku.
+The key can be generated via multiple methods.
+I recommend adding a new "authorization" (API-Key) using https://dashboard.heroku.com/account/applications#authorizations + +#### Writing the workflow +Setup a new workflow and name it e.g. [deploy.yml](../workflows/deploy.yml) + +The workflow has to meet the following requirements: +* Executed the workflow when a new release is created or manually +* Build tha app (as jar) +* Deployt the app to Heroku + +The first two part are pretty easy doable if you know a bit about GitHub Actions.
+The last part is a little bit more tricky: +* GitHub Actions own virtual (linux) machines are by default equipped with the Heroku CLI.
More details are available [here](https://github.com/actions/virtual-environments#available-environments) +* At first install [Heroku's Java plugin](https://github.com/heroku/plugin-java): ``heroku plugins:install java`` +* Deploy the jar with the deploy command ``heroku deploy:jar`` + * Select the jar using ``target/fuel-filling-service.jar`` + * Set the JDK explicitly to Java 11 using ``--jdk 11``.
Heroku trys to deploy by default with JDK 8. + * The libs folder must be included: ``--includes target/libs/`` + * Select the app that you want to deploy to with ``--app ${{ secrets.HEROKU_APP_NAME }}`` + * Of course Heroku also needs some type of authentification. This is done using ``HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}`` + +In the last 2 steps you noted the use of ``${{ secret.XXX }}`` this is the usage of the GitHub secrets we created before. + +#### Using a Procfile +There is one special case when you want to use heroku: You have to either expose your app on Port 80 or you have to bind to Herokus ``PORT`` environment variable. + +This can be done easily using a [Procfile](/Procfile) in the repository root which contains ``-Dserver.port=$PORT``. + +#### Deploying it +Great now when everything was done correctly, you can go to the ``Actions`` tab of your repository and run the Deployment workflow: +![Pic](https://user-images.githubusercontent.com/80211953/111875065-137e2300-8998-11eb-9819-f83c0e04cdbc.png) + +In Herkou you should see that your app is now deployed: +![Pic](https://user-images.githubusercontent.com/80211953/111875139-85566c80-8998-11eb-945a-b62fa2b9395b.png) From 1a00e793f2a4cf87b9990cde8993954fec663f8a Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 20 Mar 2021 16:40:09 +0100 Subject: [PATCH 02/76] Update Heroku.md --- docs/Heroku.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Heroku.md b/docs/Heroku.md index 35ef29f..ab0ccbe 100644 --- a/docs/Heroku.md +++ b/docs/Heroku.md @@ -1,5 +1,5 @@ # Heroku deployment -The goal was to deploy a demo online, so that you don't have to run the code locally and also have a showcase available online. +The goal was to deploy a demo online, so that you don't have to run the code locally and also have a showcase available. I used [Heroku](https://www.heroku.com/home) once before with GitHub so I choose that as my cloud platform again. From ae092bd7cf0d1fce54dc4b271ee632834e300a2b Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 20 Mar 2021 16:49:50 +0100 Subject: [PATCH 03/76] Update Heroku.md --- docs/Heroku.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/Heroku.md b/docs/Heroku.md index ab0ccbe..8965319 100644 --- a/docs/Heroku.md +++ b/docs/Heroku.md @@ -64,8 +64,10 @@ There is one special case when you want to use heroku: You have to either expose This can be done easily using a [Procfile](/Procfile) in the repository root which contains ``-Dserver.port=$PORT``. #### Deploying it -Great now when everything was done correctly, you can go to the ``Actions`` tab of your repository and run the Deployment workflow: +Great - now when everything was done correctly - you should be able to deploy it.
+Go to the ``Actions`` tab of your repository and run the Deployment workflow: ![Pic](https://user-images.githubusercontent.com/80211953/111875065-137e2300-8998-11eb-9819-f83c0e04cdbc.png) -In Herkou you should see that your app is now deployed: -![Pic](https://user-images.githubusercontent.com/80211953/111875139-85566c80-8998-11eb-945a-b62fa2b9395b.png) +After some time you should see that your app was deployed on Heroku.
+It is also usedful to check the logs for problems and have a quick look at your app. +![Pic](https://user-images.githubusercontent.com/80211953/111875837-1418b880-899c-11eb-895e-81c62ba2e5d4.png) From 3b3a943c6263ae31e0ecea2f896385f7e7203db4 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 20 Mar 2021 18:16:05 +0100 Subject: [PATCH 04/76] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 68ffa4a..a512dff 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ There are prebuilt executables, which save you from building the executable loca ### JAR * Check if you have Java 11 installed, if not [install it](https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot) -* Download the [latest zip from the releases](https://github.com/alb2k/fuel-filling-service/releases/latest) -* Unzip it and run it locally with ``java -jar fuel-filling-service.jar`` +* Download the [latest zip from the releases](https://github.com/alb2k/fuel-filling-service/releases/latest) and unzip it +* Run ``java -jar fuel-filling-service.jar`` * Open http://localhost:8080 → you should get redirected to the OpenAPI UI From 4a7c0424b2503a9ba991e8c37b7d04c3a77d2fb3 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 20 Mar 2021 18:22:35 +0100 Subject: [PATCH 05/76] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a512dff..3d311dd 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ A helidon (microprofile) RESTful webservice with microstream. The project represents a basic CRUD webservice where you can manage fuel fillings (of a car).
It is also shipped with a nice UI (openapi-ui) so that no external REST/HTTP client is required. -This project was created for the [Microstream hackathon](https://hackathon.microstream.one/) - ### Used technologies * [Microstream](https://microstream.one/platforms/microstream-for-java/) * [Microprofile (config)](https://github.com/eclipse/microprofile-config) @@ -22,6 +20,10 @@ The demo is hosted on heroku. ![openapi-ui screenshot](assets/OpenApiUI.png) +* [OpenAPI-UI (redirection)](https://hackathon-ms-fuel-filling.herokuapp.com) +* [OpenAPI](https://hackathon-ms-fuel-filling.herokuapp.com/openapi) +* [Health](https://hackathon-ms-fuel-filling.herokuapp.com/health) + ## Download [![Release Status](https://img.shields.io/github/workflow/status/alb2k/fuel-filling-service/Release%20CI?label=release)](https://github.com/alb2k/fuel-filling-service/actions/workflows/release.yml) There are prebuilt executables, which save you from building the executable locally. @@ -66,3 +68,5 @@ Requirements: * Stop/Remove it with ``docker stop fuel-filling`` ### Dependencies and Licenses [![dependency overview](https://img.shields.io/badge/dependency--overview-online-success?logo=apache-maven)](https://alb2k.github.io/fuel-filling-service/dependencies/) [![Apache License 2.0](https://img.shields.io/github/license/alb2k/fuel-filling-service?color=informational)](https://choosealicense.com/licenses/apache-2.0/) + +This project was created for the [Microstream hackathon](https://hackathon.microstream.one/) From 0b026fd799809a9b4e8c6a61c146502345dedf70 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 14:50:30 +0100 Subject: [PATCH 06/76] Create Helidon.md --- docs/Helidon.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/Helidon.md diff --git a/docs/Helidon.md b/docs/Helidon.md new file mode 100644 index 0000000..e706450 --- /dev/null +++ b/docs/Helidon.md @@ -0,0 +1,3 @@ +## Helidon + +WIP From 83e232ecd7d6ef46cd8fe26ab62b6a5017f5e76d Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 14:50:48 +0100 Subject: [PATCH 07/76] Create Microstream.md --- docs/Microstream.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/Microstream.md diff --git a/docs/Microstream.md b/docs/Microstream.md new file mode 100644 index 0000000..9ea7d46 --- /dev/null +++ b/docs/Microstream.md @@ -0,0 +1,3 @@ +## Microstream + +WIP From 73ea68b072515e30cff9449eedc2910c6bbf2617 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 14:51:02 +0100 Subject: [PATCH 08/76] Create OpenAPI.md --- docs/OpenAPI.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/OpenAPI.md diff --git a/docs/OpenAPI.md b/docs/OpenAPI.md new file mode 100644 index 0000000..020b733 --- /dev/null +++ b/docs/OpenAPI.md @@ -0,0 +1,3 @@ +## OpenAPI + +WIP From cf4ce3cb4b57c82f132be71fc46f0ba0276b1b6d Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 14:51:17 +0100 Subject: [PATCH 09/76] Create Logging.md --- docs/Logging.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/Logging.md diff --git a/docs/Logging.md b/docs/Logging.md new file mode 100644 index 0000000..09a50d5 --- /dev/null +++ b/docs/Logging.md @@ -0,0 +1,3 @@ +## Logging + +WIP From 211c8277a4c5f03e0e06f40a98c9c71a23980ea2 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 14:53:04 +0100 Subject: [PATCH 10/76] Update Heroku.md --- docs/Heroku.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Heroku.md b/docs/Heroku.md index 8965319..05e8393 100644 --- a/docs/Heroku.md +++ b/docs/Heroku.md @@ -38,7 +38,7 @@ The key can be generated via multiple methods.
I recommend adding a new "authorization" (API-Key) using https://dashboard.heroku.com/account/applications#authorizations #### Writing the workflow -Setup a new workflow and name it e.g. [deploy.yml](../workflows/deploy.yml) +Setup a new workflow and name it e.g. [deploy.yml](../../workflows/deploy.yml) The workflow has to meet the following requirements: * Executed the workflow when a new release is created or manually From c5e2e35b76e422e210368fac3a2cb71fbda3d0f2 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 14:54:42 +0100 Subject: [PATCH 11/76] Update Heroku.md Fixed link --- docs/Heroku.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Heroku.md b/docs/Heroku.md index 05e8393..a7a999a 100644 --- a/docs/Heroku.md +++ b/docs/Heroku.md @@ -38,7 +38,7 @@ The key can be generated via multiple methods.
I recommend adding a new "authorization" (API-Key) using https://dashboard.heroku.com/account/applications#authorizations #### Writing the workflow -Setup a new workflow and name it e.g. [deploy.yml](../../workflows/deploy.yml) +Setup a new workflow and name it e.g. [deploy.yml](../.github/workflows/deploy.yml) The workflow has to meet the following requirements: * Executed the workflow when a new release is created or manually From 4667b3afdf5bbfb23457e9286475837edf4aa070 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:00:27 +0100 Subject: [PATCH 12/76] Create GHActions.md --- docs/GHActions.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/GHActions.md diff --git a/docs/GHActions.md b/docs/GHActions.md new file mode 100644 index 0000000..7e62ea1 --- /dev/null +++ b/docs/GHActions.md @@ -0,0 +1,8 @@ +# GitHub Actions + +The following plans are used: +| Plan | Runs when | Description | +| --- | --- | --- | +| [checkBuild.yml](../.github/workflows/checkBuild.yml) | Manually
Push or PullRequest on develop | Checks if the project is buildable | +| [release.yml](../.github/workflows/release.yml) | Push on master | Builds a release jar and creates a new release draft on GitHub, where the jar is uploaded | +| [deploy.yml](../.github/workflows/deploy.yml) | Push on master | Deploys the current code to [Heroku](../Heroku.md) | From 7003089116cb903ae414810e53944c0ecc84b798 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:00:45 +0100 Subject: [PATCH 13/76] Update GHActions.md --- docs/GHActions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/GHActions.md b/docs/GHActions.md index 7e62ea1..e471009 100644 --- a/docs/GHActions.md +++ b/docs/GHActions.md @@ -5,4 +5,4 @@ The following plans are used: | --- | --- | --- | | [checkBuild.yml](../.github/workflows/checkBuild.yml) | Manually
Push or PullRequest on develop | Checks if the project is buildable | | [release.yml](../.github/workflows/release.yml) | Push on master | Builds a release jar and creates a new release draft on GitHub, where the jar is uploaded | -| [deploy.yml](../.github/workflows/deploy.yml) | Push on master | Deploys the current code to [Heroku](../Heroku.md) | +| [deploy.yml](../.github/workflows/deploy.yml) | Push on master | Deploys the current code to [Heroku](Heroku.md) | From 4c87467eb762b756e1c0ce46ba08086384423d92 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:04:58 +0100 Subject: [PATCH 14/76] Update GHActions.md --- docs/GHActions.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/GHActions.md b/docs/GHActions.md index e471009..0f1270d 100644 --- a/docs/GHActions.md +++ b/docs/GHActions.md @@ -3,6 +3,7 @@ The following plans are used: | Plan | Runs when | Description | | --- | --- | --- | -| [checkBuild.yml](../.github/workflows/checkBuild.yml) | Manually
Push or PullRequest on develop | Checks if the project is buildable | +| [checkBuild.yml](../.github/workflows/checkBuild.yml) | Push or PullRequest on develop | Checks if the project is buildable | | [release.yml](../.github/workflows/release.yml) | Push on master | Builds a release jar and creates a new release draft on GitHub, where the jar is uploaded | | [deploy.yml](../.github/workflows/deploy.yml) | Push on master | Deploys the current code to [Heroku](Heroku.md) | +| [gh-pages.yml](../.github/workflows/gh-pages.yml) | Push on master | Creates a [project-info-report about the dependencies](https://maven.apache.org/plugins/maven-project-info-reports-plugin/dependencies-mojo.html) and publishes it with [GitHub pages](https://pages.github.com/) | From 4dea7c830bf0a38b5b2692e09c119da3e377b6cd Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:05:56 +0100 Subject: [PATCH 15/76] Update GHActions.md --- docs/GHActions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/GHActions.md b/docs/GHActions.md index 0f1270d..c191528 100644 --- a/docs/GHActions.md +++ b/docs/GHActions.md @@ -3,7 +3,7 @@ The following plans are used: | Plan | Runs when | Description | | --- | --- | --- | -| [checkBuild.yml](../.github/workflows/checkBuild.yml) | Push or PullRequest on develop | Checks if the project is buildable | +| [checkBuild.yml](../.github/workflows/checkBuild.yml) | Push or PullRequest on develop | Checks if the project is buildable (using ``mvn -B clean package``) | | [release.yml](../.github/workflows/release.yml) | Push on master | Builds a release jar and creates a new release draft on GitHub, where the jar is uploaded | | [deploy.yml](../.github/workflows/deploy.yml) | Push on master | Deploys the current code to [Heroku](Heroku.md) | | [gh-pages.yml](../.github/workflows/gh-pages.yml) | Push on master | Creates a [project-info-report about the dependencies](https://maven.apache.org/plugins/maven-project-info-reports-plugin/dependencies-mojo.html) and publishes it with [GitHub pages](https://pages.github.com/) | From 730a1a751f206bc93e83c18ce81892017e19b307 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:07:16 +0100 Subject: [PATCH 16/76] Update GHActions.md --- docs/GHActions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/GHActions.md b/docs/GHActions.md index c191528..94da0a9 100644 --- a/docs/GHActions.md +++ b/docs/GHActions.md @@ -7,3 +7,5 @@ The following plans are used: | [release.yml](../.github/workflows/release.yml) | Push on master | Builds a release jar and creates a new release draft on GitHub, where the jar is uploaded | | [deploy.yml](../.github/workflows/deploy.yml) | Push on master | Deploys the current code to [Heroku](Heroku.md) | | [gh-pages.yml](../.github/workflows/gh-pages.yml) | Push on master | Creates a [project-info-report about the dependencies](https://maven.apache.org/plugins/maven-project-info-reports-plugin/dependencies-mojo.html) and publishes it with [GitHub pages](https://pages.github.com/) | + +Results of the executed workflows are aviable in the [``Actions`` tab](https://github.com/alb2k/fuel-filling-service/actions) From 3eda26631616ae66e7723a3dc3df7beb42f6211d Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:08:40 +0100 Subject: [PATCH 17/76] Update Helidon.md --- docs/Helidon.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Helidon.md b/docs/Helidon.md index e706450..13ff8ad 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -1,3 +1,3 @@ -## Helidon +# Helidon -WIP +The project is based on [helidon-quickstart-mp](https://github.com/oracle/helidon/tree/master/examples/quickstarts/helidon-quickstart-mp) From 457ecc1d154898681843fd526a97099045825b88 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:47:33 +0100 Subject: [PATCH 18/76] Create _index.md --- docs/_index.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docs/_index.md diff --git a/docs/_index.md b/docs/_index.md new file mode 100644 index 0000000..8abbd62 --- /dev/null +++ b/docs/_index.md @@ -0,0 +1,15 @@ +# Docs +Documentation about the project + +## Overview +A quick overview how the project is designed to work: +![Overview](https://user-images.githubusercontent.com/80211953/112724270-d7583e80-8f12-11eb-9506-5e62c647f98d.png) + +## Details +Each part of the project has it's own documentation: +1. [Helidon](Helidon.md) +2. [Microstream](Microstream.md) +3. [OpenAPI (+UI)](OpenAPI.md) +4. [Logging](Logging.md) +5. [GitHub Actions](GHActions.md) +6. [Heroku](Heroku.md) From f7f99bf979715c8b7f8b6598b60ba0a644cb4d9b Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:47:51 +0100 Subject: [PATCH 19/76] Rename _index.md to index.md --- docs/{_index.md => index.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{_index.md => index.md} (100%) diff --git a/docs/_index.md b/docs/index.md similarity index 100% rename from docs/_index.md rename to docs/index.md From 14b2229cd4437782f5682c965afdddf35c47ccc1 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 16:07:33 +0100 Subject: [PATCH 20/76] Update OpenAPI.md --- docs/OpenAPI.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/OpenAPI.md b/docs/OpenAPI.md index 020b733..7839847 100644 --- a/docs/OpenAPI.md +++ b/docs/OpenAPI.md @@ -1,3 +1,17 @@ -## OpenAPI +# [OpenAPI](https://www.openapis.org/) -WIP +OpenAPI is a standardized specification to describe REST-conform APIs. + +Helidon supports OpenAPI.
+For more information read [this guide](https://medium.com/helidon/project-helidon-and-openapi-54a1fadc75b1). + +## OpenAPI UI +To test the app without the requirement of an external HTTP Client, you can simply add [OpenAPI UI](https://github.com/microprofile-extensions/openapi-ext/blob/main/openapi-ui/README.md) (derived from [Swagger UI](https://swagger.io/tools/swagger-ui/)). + +#### What was done to add it to this project? +* Added the [dependency](https://mvnrepository.com/artifact/org.microprofile-ext.openapi-ext/openapi-ui) to the pom.xml +* Annotated the Rest-Endpoints with informations +* Added a custom application class for some informations → [App.java](../src/main/java/hackathon/microstream/service/system/App.java) +* Customized the UI further with [microprofile-config.properties](../src/main/resources/META-INF/microprofile-config.properties#L9-L11) + +I also highly recommend reading the ["Getting Started" page of OpenAPI-UI](https://github.com/microprofile-extensions/openapi-ext/blob/main/openapi-ui/README.md#getting-started), because it explains everything that was done in detail. From fd3682f908e0385e00b57da1ca1d5d0a6dc6a0a3 Mon Sep 17 00:00:00 2001 From: litetex <80211953+alb2k@users.noreply.github.com> Date: Sat, 27 Mar 2021 16:27:49 +0100 Subject: [PATCH 21/76] Updated docs --- pom.xml | 3 ++- src/main/java/hackathon/microstream/Startup.java | 5 +++++ src/main/java/hackathon/microstream/storage/DBManager.java | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 10598b7..ffa1edc 100644 --- a/pom.xml +++ b/pom.xml @@ -103,11 +103,12 @@ true - + org.microprofile-ext.openapi-ext openapi-ui 1.1.4 + runtime diff --git a/src/main/java/hackathon/microstream/Startup.java b/src/main/java/hackathon/microstream/Startup.java index 23e1a58..a98b0ad 100644 --- a/src/main/java/hackathon/microstream/Startup.java +++ b/src/main/java/hackathon/microstream/Startup.java @@ -11,6 +11,11 @@ import javax.enterprise.context.Initialized; import javax.enterprise.event.Observes; +/** + * Handles the startup and shutdown + * + * @seealso https://stackoverflow.com/a/11476587 + */ @ApplicationScoped public class Startup { private final static Logger LOG = LoggerFactory.getLogger(Startup.class); diff --git a/src/main/java/hackathon/microstream/storage/DBManager.java b/src/main/java/hackathon/microstream/storage/DBManager.java index 1dc0993..e2a6e57 100644 --- a/src/main/java/hackathon/microstream/storage/DBManager.java +++ b/src/main/java/hackathon/microstream/storage/DBManager.java @@ -9,6 +9,9 @@ import java.time.LocalDate; +/** + * Manages DB access (Microstream) + */ public class DBManager { private static final Logger LOG = LoggerFactory.getLogger(DBManager.class); From a77ae5ab3066b11603cef4eaa21dbfed63c8efa6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Apr 2021 03:05:55 +0000 Subject: [PATCH 22/76] Bump helidon-dependencies from 2.2.1 to 2.2.2 Bumps helidon-dependencies from 2.2.1 to 2.2.2. Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 10598b7..e2f8975 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ UTF-8 - 2.2.1 + 2.2.2 1.7.30 2.14.1 From ac14d63401990ef2cd6f5c8f73ddf59b80b04598 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 3 Apr 2021 19:43:37 +0200 Subject: [PATCH 23/76] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3d311dd..0e3600b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ It is also shipped with a nice UI (openapi-ui) so that no external REST/HTTP cli * [GitHub Actions](https://github.com/features/actions) for CI/CD * [Heroku](https://www.heroku.com/) for hosting the demo +### [Documentation](docs/index.md) +Documentation about this project is [available here](docs/index.md) + ## [Demo](https://hackathon-ms-fuel-filling.herokuapp.com) [![Deployment Status](https://img.shields.io/github/workflow/status/alb2k/fuel-filling-service/Deploy%20CI?label=deployment)](https://github.com/alb2k/fuel-filling-service/actions/workflows/deploy.yml) The demo is hosted on heroku. From b039b8f28e94381e621cb67b7d57060d4d653ae2 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 3 Apr 2021 19:53:00 +0200 Subject: [PATCH 24/76] Update Heroku.md --- docs/Heroku.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/Heroku.md b/docs/Heroku.md index a7a999a..9d35c25 100644 --- a/docs/Heroku.md +++ b/docs/Heroku.md @@ -1,5 +1,5 @@ # Heroku deployment -The goal was to deploy a demo online, so that you don't have to run the code locally and also have a showcase available. +The goal here was to deploy a demo online, so that you don't have to run the code locally and also have a showcase available. I used [Heroku](https://www.heroku.com/home) once before with GitHub so I choose that as my cloud platform again. @@ -19,14 +19,14 @@ After the account is set up, create a new app: Choose your region, add a name (the app will be available under that ``https://.herokuapp.com``) and then click create app. ### Deploying the project using GitHub -Great, now we have a new app on heroku but there isn't actually anything running, because nothing was deployed. +Great, now we have a new app on heroku... but there isn't actually anything running, because nothing was deployed. -So how can the code be deployed? +So how can we deploy code (from GitHub)?
There are 2 ways: -* Setup a deployment pipeline directly in heroku +* Setup a deployment pipeline directly in Heroku * Write a [GitHub actions](https://github.com/features/actions) workflow that builds and deploys the code -I wanted to stay independent from Heroku and - through the fact that I already had experience with GitHub Actions - I ultimatively choose those. +I wanted to stay independent from Heroku and - through the fact that I already had experience with GitHub Actions - I ultimately choose those. #### Setting up secrets There have to be some [secrets stored for the coming GitHub Actions workflow](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository): @@ -43,9 +43,9 @@ Setup a new workflow and name it e.g. [deploy.yml](../.github/workflows/deploy.y The workflow has to meet the following requirements: * Executed the workflow when a new release is created or manually * Build tha app (as jar) -* Deployt the app to Heroku +* Deploy the app to Heroku -The first two part are pretty easy doable if you know a bit about GitHub Actions.
+The first two parts are pretty easy doable if you know a bit about GitHub Actions.
The last part is a little bit more tricky: * GitHub Actions own virtual (linux) machines are by default equipped with the Heroku CLI.
More details are available [here](https://github.com/actions/virtual-environments#available-environments) * At first install [Heroku's Java plugin](https://github.com/heroku/plugin-java): ``heroku plugins:install java`` @@ -54,7 +54,7 @@ The last part is a little bit more tricky: * Set the JDK explicitly to Java 11 using ``--jdk 11``.
Heroku trys to deploy by default with JDK 8. * The libs folder must be included: ``--includes target/libs/`` * Select the app that you want to deploy to with ``--app ${{ secrets.HEROKU_APP_NAME }}`` - * Of course Heroku also needs some type of authentification. This is done using ``HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}`` + * Of course Heroku also needs some type of authentication. This is done using ``HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}`` In the last 2 steps you noted the use of ``${{ secret.XXX }}`` this is the usage of the GitHub secrets we created before. @@ -69,5 +69,5 @@ Go to the ``Actions`` tab of your repository and run the Deployment workflow: ![Pic](https://user-images.githubusercontent.com/80211953/111875065-137e2300-8998-11eb-9819-f83c0e04cdbc.png) After some time you should see that your app was deployed on Heroku.
-It is also usedful to check the logs for problems and have a quick look at your app. +It is also useful to check the logs for problems and have a quick look at your app. ![Pic](https://user-images.githubusercontent.com/80211953/111875837-1418b880-899c-11eb-895e-81c62ba2e5d4.png) From 7d19e612759f95f6fc36cf752adec5fbf9c3b522 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 3 Apr 2021 20:08:43 +0200 Subject: [PATCH 25/76] Update index.md --- docs/index.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 8abbd62..2b6c07f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,10 +1,6 @@ # Docs Documentation about the project -## Overview -A quick overview how the project is designed to work: -![Overview](https://user-images.githubusercontent.com/80211953/112724270-d7583e80-8f12-11eb-9506-5e62c647f98d.png) - ## Details Each part of the project has it's own documentation: 1. [Helidon](Helidon.md) @@ -13,3 +9,8 @@ Each part of the project has it's own documentation: 4. [Logging](Logging.md) 5. [GitHub Actions](GHActions.md) 6. [Heroku](Heroku.md) + + +## Overview +A quick overview how the project is designed to work: +![Overview](https://user-images.githubusercontent.com/80211953/112724270-d7583e80-8f12-11eb-9506-5e62c647f98d.png) From 2a6488fe579a00c731c39fb528407216984d09d9 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 3 Apr 2021 20:09:24 +0200 Subject: [PATCH 26/76] Update index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 2b6c07f..e8fa354 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,5 +12,5 @@ Each part of the project has it's own documentation: ## Overview -A quick overview how the project is designed to work: +A quick overview how the project is designed to work:

![Overview](https://user-images.githubusercontent.com/80211953/112724270-d7583e80-8f12-11eb-9506-5e62c647f98d.png) From 9ce4c262dfe29ab149d6c457bad721af800e6508 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 3 Apr 2021 20:34:50 +0200 Subject: [PATCH 27/76] Update Logging.md --- docs/Logging.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/Logging.md b/docs/Logging.md index 09a50d5..5e3db02 100644 --- a/docs/Logging.md +++ b/docs/Logging.md @@ -1,3 +1,47 @@ -## Logging +# Logging -WIP +Helidon uses [JUL](https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html) as default logger. + +## Using another logging framework +However I prefer the more statisfying [SLF4J](http://www.slf4j.org/) (→ https://stackoverflow.com/a/11360517) in combination with [Log4j 2](https://logging.apache.org/log4j/2.x/).
+So an adapter was needed to redirect JUL to SLF4J... + +Luckily I found [this great guide about how to use Heldion with other logging frameworks](https://medium.com/helidon/helidon-logging-and-mdc-5de272cf085d) which basically tells you how to achieve that. + +#### TL;DR / What was done to add it to this project? +* Added the following dependencies: + * [io.helidon.logging:helidon-logging-slf4j](https://mvnrepository.com/artifact/io.helidon.logging/helidon-logging-slf4j) (Helidon SLF4J integration) + * [org.slf4j:slf4j-api](https://mvnrepository.com/artifact/org.slf4j/slf4j-api) (logging facade) + * [org.slf4j:jul-to-slf4j](https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j) (JUL → SLF4J) + * [org.apache.logging.log4j:log4j-slf4j-impl](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl) (SLF4J → LOG4J) + * [org.apache.logging.log4j:log4j-core](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core) ("real" logging framework) +* Added a [log4j2.xml](../src/main/resources/log4j2.xml) +* Tweaked the [logging.properties](../src/main/resources/logging.properties) a bit so that it works correctly +* Due to no available main entry class the SLF4JBridgeHandler for JUL is installed in the [Startup class](../src/main/java/hackathon/microstream/Startup.java#L26-L30) + +After everything was done the output now looks like this: +``` +"...java.exe" ... io.helidon.microprofile.cdi.Main +[INFORMATION] 2021-04-03 20:31:47 [Thread[main,5,main]] Logging at initialization configured using classpath: /logging.properties +[INFO ] 2021-04-03 20:31:48.476 [main] org.jboss.weld.Version - WELD-000900: 3.1.6 (Final) +[INFO ] 2021-04-03 20:31:49.309 [main] org.jboss.weld.Bootstrap - WELD-ENV-000020: Using jandex for bean discovery +[INFO ] 2021-04-03 20:31:49.531 [main] org.jboss.weld.Bootstrap - WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. +[INFO ] 2021-04-03 20:31:49.679 [main] org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jersey.ext.cdi1x.internal.ProcessAllAnnotatedTypes.processAnnotatedType(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. +[INFO ] 2021-04-03 20:31:49.694 [main] org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] private io.helidon.microprofile.openapi.OpenApiCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. +[INFO ] 2021-04-03 20:31:50.465 [main] hackathon.microstream.Startup - The application is starting... +[INFO ] 2021-04-03 20:31:50.465 [main] hackathon.microstream.Startup - Installing org.slf4j.bridge.SLF4JBridgeHandler +[INFO ] 2021-04-03 20:31:50.465 [main] hackathon.microstream.Startup - Installed org.slf4j.bridge.SLF4JBridgeHandler successfully +[INFO ] 2021-04-03 20:31:50.465 [main] hackathon.microstream.Startup - Initializing DB +[INFO ] 2021-04-03 20:31:50.465 [main] hackathon.microstream.storage.DBManager - Loading configuration +[INFO ] 2021-04-03 20:31:51.020 [main] hackathon.microstream.storage.DBManager - BaseDirectory is 'data' +[INFO ] 2021-04-03 20:31:51.020 [main] hackathon.microstream.storage.DBManager - Initializing storageManager +[INFO ] 2021-04-03 20:31:51.553 [main] hackathon.microstream.storage.DBManager - Demo mode; Using demo data +[INFO ] 2021-04-03 20:31:51.553 [main] hackathon.microstream.Startup - Initialized DB +[INFO ] 2021-04-03 20:31:51.553 [main] hackathon.microstream.Startup - The application is started +[INFO ] 2021-04-03 20:31:51.553 [main] io.helidon.microprofile.server.ServerCdiExtension - Registering JAX-RS Application: App +[INFO ] 2021-04-03 20:31:52.217 [main] org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 6.1.2.Final +[INFO ] 2021-04-03 20:31:53.253 [nioEventLoopGroup-2-1] io.helidon.webserver.NettyWebServer - Channel '@default' started: [id: 0x245155bc, L:/0:0:0:0:0:0:0:0:8080] +[INFO ] 2021-04-03 20:31:53.253 [main] io.helidon.microprofile.server.ServerCdiExtension - Server started on http://localhost:8080 (and all other host addresses) in 6257 milliseconds (since JVM startup). +[INFO ] 2021-04-03 20:31:53.268 [features-thread] io.helidon.common.HelidonFeatures - Helidon MP 2.2.1 features: [CDI, Config, Health, JAX-RS, Open API, Server] +... +``` From 18983240e58433916d5f8830d84afef6f94b398d Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 3 Apr 2021 20:42:51 +0200 Subject: [PATCH 28/76] Update OpenAPI.md --- docs/OpenAPI.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/OpenAPI.md b/docs/OpenAPI.md index 7839847..d6b5f02 100644 --- a/docs/OpenAPI.md +++ b/docs/OpenAPI.md @@ -13,5 +13,6 @@ To test the app without the requirement of an external HTTP Client, you can simp * Annotated the Rest-Endpoints with informations * Added a custom application class for some informations → [App.java](../src/main/java/hackathon/microstream/service/system/App.java) * Customized the UI further with [microprofile-config.properties](../src/main/resources/META-INF/microprofile-config.properties#L9-L11) +* Added a [RootResource](../src/main/java/hackathon/microstream/service/rest/resource/RootResource.java) which redirects to the OpenAPI UI endpoint when trying to get '/' I also highly recommend reading the ["Getting Started" page of OpenAPI-UI](https://github.com/microprofile-extensions/openapi-ext/blob/main/openapi-ui/README.md#getting-started), because it explains everything that was done in detail. From cd0326777de13eba6e27261a2874199f5eef21a3 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sat, 3 Apr 2021 20:50:46 +0200 Subject: [PATCH 29/76] Update OpenAPI.md --- docs/OpenAPI.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/OpenAPI.md b/docs/OpenAPI.md index d6b5f02..b7b0e37 100644 --- a/docs/OpenAPI.md +++ b/docs/OpenAPI.md @@ -16,3 +16,10 @@ To test the app without the requirement of an external HTTP Client, you can simp * Added a [RootResource](../src/main/java/hackathon/microstream/service/rest/resource/RootResource.java) which redirects to the OpenAPI UI endpoint when trying to get '/' I also highly recommend reading the ["Getting Started" page of OpenAPI-UI](https://github.com/microprofile-extensions/openapi-ext/blob/main/openapi-ui/README.md#getting-started), because it explains everything that was done in detail. + + +Note: Using the app locally sometimes throws `` +[WARN ] 2021-04-03 20:00:00.787 [helidon-2] io.helidon.webserver.RequestRouting - Default error handler: Response wasn't successfully sent. +java.util.concurrent.CompletionException: io.helidon.webserver.SocketClosedException: Response channel is closed! +`` when calling the root / '/'.
+This problem does not occur when it is deployed on Heroku. From 86509e67330ecce575697f9456780af90ed8da98 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:32:55 +0200 Subject: [PATCH 30/76] Update index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index e8fa354..8a6f99c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,5 +1,5 @@ # Docs -Documentation about the project +Documentation about this project ## Details Each part of the project has it's own documentation: From 17aafdeae252456829ac262b6b5e3b9a26798402 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:40:16 +0200 Subject: [PATCH 31/76] Update Logging.md --- docs/Logging.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Logging.md b/docs/Logging.md index 5e3db02..7565b2f 100644 --- a/docs/Logging.md +++ b/docs/Logging.md @@ -1,8 +1,10 @@ # Logging +To protocol informations about events in the app, some kind of logging is required.
+For Java therefore multiple logging frameworks exist. Some popular ones include SLF4J, LOG4J, JUL, Logback, etc. Helidon uses [JUL](https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html) as default logger. -## Using another logging framework +### Using another logging framework However I prefer the more statisfying [SLF4J](http://www.slf4j.org/) (→ https://stackoverflow.com/a/11360517) in combination with [Log4j 2](https://logging.apache.org/log4j/2.x/).
So an adapter was needed to redirect JUL to SLF4J... From 1d2f7f45e0b6955438ef777d64728cb124872d20 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:55:11 +0200 Subject: [PATCH 32/76] Update microprofile-config.properties --- src/main/resources/META-INF/microprofile-config.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/resources/META-INF/microprofile-config.properties b/src/main/resources/META-INF/microprofile-config.properties index a56e089..7f845df 100644 --- a/src/main/resources/META-INF/microprofile-config.properties +++ b/src/main/resources/META-INF/microprofile-config.properties @@ -1,5 +1,4 @@ # Application properties. -#app.greeting=Hello db.demoMode=true # Microprofile server properties @@ -8,4 +7,4 @@ server.host=0.0.0.0 # OpenAPI-UI openapi.ui.title=Fuel filling webservice -openapi.ui.swaggerHeaderVisibility=hidden \ No newline at end of file +openapi.ui.swaggerHeaderVisibility=hidden From 3441e5cf31883893b55bbd14b8be629e76e50272 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:04:14 +0200 Subject: [PATCH 33/76] Update Microstream.md --- docs/Microstream.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/Microstream.md b/docs/Microstream.md index 9ea7d46..daa2ebc 100644 --- a/docs/Microstream.md +++ b/docs/Microstream.md @@ -1,3 +1,21 @@ -## Microstream +# Microstream -WIP +[Microstream](https://microstream.one/) is a storage/persostence solution which uses Graphs and binary files for it's storage. + +The project was mainly written based on the [Microstream Getting Started Guide](https://manual.docs.microstream.one/data-store/getting-started) + +#### TL;DR / What was done to add it to this project? +* Added [the dependencies](https://manual.docs.microstream.one/data-store/getting-started#prerequisites) to the [pom.xml](../pom.xml) +* Added a [root instance / DBContext class](../src/main/java/hackathon/microstream/storage/DBContext.java), where all objects that should be persisted are attached to (more information available [here](https://manual.docs.microstream.one/data-store/getting-started#the-root-instance)) +* Added a [DB Manager](../src/main/java/hackathon/microstream/storage/DBManager.java), which manages (cares about initalizing, reading, saving, shutdown ...) and holds the DBContext + * There also exist a demo mode → if enabled all data is overriden by the defaults on init
+ The demo mode is managed by [microprofile-config.properties](../src/main/resources/META-INF/microprofile-config.properties#L2) +* Added [microstream-storage.properties](../src/main/resources/microstream-storage.properties) +* Added a [DAL Layer](../src/main/java/hackathon/microstream/dal) which uses the DB Manager + + +The app by default writes the storage / binary files to the ``data`` folder. + + +### Notes +* Microstream doesn't have any built in ID management. I used [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier) for that. From 51379c79c99c4365eaa53c7bf38d200bdc6cba59 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:14:07 +0200 Subject: [PATCH 34/76] Update Helidon.md --- docs/Helidon.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/Helidon.md b/docs/Helidon.md index 13ff8ad..e158e76 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -1,3 +1,15 @@ # Helidon The project is based on [helidon-quickstart-mp](https://github.com/oracle/helidon/tree/master/examples/quickstarts/helidon-quickstart-mp) + + +WIP + +* What was used +* Explain arch +* config via MP +* CDI +* Validation +** ConstraintViolationExceptionMapper +* ObjectMapperContextResolver +* NotFoundExceptionHandler From 1c10d658f856cacc8c91a5e126a95f7eea4c9a20 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:14:18 +0200 Subject: [PATCH 35/76] Update Helidon.md --- docs/Helidon.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Helidon.md b/docs/Helidon.md index e158e76..d968835 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -10,6 +10,6 @@ WIP * config via MP * CDI * Validation -** ConstraintViolationExceptionMapper + * ConstraintViolationExceptionMapper * ObjectMapperContextResolver * NotFoundExceptionHandler From 5412219a7d68f43f378ff568fc27f907be486b5f Mon Sep 17 00:00:00 2001 From: litetex <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:14:41 +0200 Subject: [PATCH 36/76] Code improvements --- .../java/hackathon/microstream/Startup.java | 2 +- .../ConstraintViolationExceptionMapper.java | 4 +++- .../system/ObjectMapperContextResolver.java | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/hackathon/microstream/Startup.java b/src/main/java/hackathon/microstream/Startup.java index a98b0ad..8e52151 100644 --- a/src/main/java/hackathon/microstream/Startup.java +++ b/src/main/java/hackathon/microstream/Startup.java @@ -14,7 +14,7 @@ /** * Handles the startup and shutdown * - * @seealso https://stackoverflow.com/a/11476587 + * @see https://stackoverflow.com/a/11476587 */ @ApplicationScoped public class Startup { diff --git a/src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java b/src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java index 9d43bda..b3a73fe 100644 --- a/src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java +++ b/src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java @@ -1,12 +1,14 @@ package hackathon.microstream.service.system; -import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; import java.util.stream.Collectors; +/** + * Makes ConstraintViolationExceptions pretty + */ @Provider public class ConstraintViolationExceptionMapper implements ExceptionMapper { @Override diff --git a/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java b/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java index 4e08ba8..9204569 100644 --- a/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java +++ b/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java @@ -8,6 +8,23 @@ import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Provider; +/** + * The default provider for a configured {@link ObjectMapper} + * + * Configuration: + *
    + *
  • + * By default LocalDate is written as array, which is not ISO-8601 conform
    + * https://stackoverflow.com/a/28803634 + *
  • + *
  • + * By default ObjectMapper throws an exception, if unknown properties are supplied.
    + * To be a bit less restrictive, unknown properties are allowed (easier handling of objects with / without UUID + *
  • + *
+ * + * + */ @Provider public class ObjectMapperContextResolver implements ContextResolver { private final ObjectMapper MAPPER; @@ -17,6 +34,7 @@ public ObjectMapperContextResolver() { // Make LocalDate & Co to Strings (and vice versa) MAPPER.registerModule(new JavaTimeModule()); MAPPER.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } From 7a67eaaa822b9d3bf2458f91f73cbfd5d4d21b81 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:16:17 +0200 Subject: [PATCH 37/76] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e3600b..51bebaa 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ It is also shipped with a nice UI (openapi-ui) so that no external REST/HTTP cli * [GitHub Actions](https://github.com/features/actions) for CI/CD * [Heroku](https://www.heroku.com/) for hosting the demo -### [Documentation](docs/index.md) +### [Documentation in detail](docs/index.md) Documentation about this project is [available here](docs/index.md) ## [Demo](https://hackathon-ms-fuel-filling.herokuapp.com) [![Deployment Status](https://img.shields.io/github/workflow/status/alb2k/fuel-filling-service/Deploy%20CI?label=deployment)](https://github.com/alb2k/fuel-filling-service/actions/workflows/deploy.yml) From 08263c99f7372be681b6653aca20ffec4b9b0ffc Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:17:37 +0200 Subject: [PATCH 38/76] Update index.md --- docs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 8a6f99c..1288171 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ Documentation about this project ## Details -Each part of the project has it's own documentation: +Each part / Used technology of the project has it's own documentation: 1. [Helidon](Helidon.md) 2. [Microstream](Microstream.md) 3. [OpenAPI (+UI)](OpenAPI.md) @@ -12,5 +12,5 @@ Each part of the project has it's own documentation: ## Overview -A quick overview how the project is designed to work:

+A quick overview how the project is designed to work:

![Overview](https://user-images.githubusercontent.com/80211953/112724270-d7583e80-8f12-11eb-9506-5e62c647f98d.png) From 793a6b7c1de6088d6639289f4d7c7ab64be511a6 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:21:03 +0200 Subject: [PATCH 39/76] Update Microstream.md --- docs/Microstream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Microstream.md b/docs/Microstream.md index daa2ebc..751d457 100644 --- a/docs/Microstream.md +++ b/docs/Microstream.md @@ -1,6 +1,6 @@ # Microstream -[Microstream](https://microstream.one/) is a storage/persostence solution which uses Graphs and binary files for it's storage. +[Microstream](https://microstream.one/) is a storage/persistence solution which uses Graphs and binary files for it's storage. The project was mainly written based on the [Microstream Getting Started Guide](https://manual.docs.microstream.one/data-store/getting-started) From 9145818d70365ffa6e8e100df4a096f452f9d8cf Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:22:26 +0200 Subject: [PATCH 40/76] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 51bebaa..505be38 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ It is also shipped with a nice UI (openapi-ui) so that no external REST/HTTP cli Documentation about this project is [available here](docs/index.md) ## [Demo](https://hackathon-ms-fuel-filling.herokuapp.com) [![Deployment Status](https://img.shields.io/github/workflow/status/alb2k/fuel-filling-service/Deploy%20CI?label=deployment)](https://github.com/alb2k/fuel-filling-service/actions/workflows/deploy.yml) -The demo is hosted on heroku. +The demo is hosted on heroku.
+It may take some seconds to start. ![openapi-ui screenshot](assets/OpenApiUI.png) From 71f9fc0833c0d67cff43ebcb8b4df3a821c66a8f Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:26:46 +0200 Subject: [PATCH 41/76] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 505be38..bbca633 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ It is also shipped with a nice UI (openapi-ui) so that no external REST/HTTP cli ### Used technologies * [Microstream](https://microstream.one/platforms/microstream-for-java/) +* [Helidon MP](https://helidon.io/#getting-started) * [Microprofile (config)](https://github.com/eclipse/microprofile-config) -* [Helidon MP](https://helidon.io/#getting-started) * [MP Health](https://github.com/eclipse/microprofile-health) * Logging via [SLF4J](http://www.slf4j.org/) and [Apache Log4j 2](https://logging.apache.org/log4) * [OpenApi](https://www.openapis.org/) From e87715bc0e2b5eb0b49423b8969c6f640ee11e0a Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 14:51:27 +0200 Subject: [PATCH 42/76] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bbca633..1f5233e 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ Requirements: * Execute it with ``docker run --rm -p 8080:8080 --name fuel-filling fuel-filling`` * Stop/Remove it with ``docker stop fuel-filling`` -### Dependencies and Licenses [![dependency overview](https://img.shields.io/badge/dependency--overview-online-success?logo=apache-maven)](https://alb2k.github.io/fuel-filling-service/dependencies/) [![Apache License 2.0](https://img.shields.io/github/license/alb2k/fuel-filling-service?color=informational)](https://choosealicense.com/licenses/apache-2.0/) +## Dependencies and Licenses [![dependency overview](https://img.shields.io/badge/dependency--overview-online-success?logo=apache-maven)](https://alb2k.github.io/fuel-filling-service/dependencies/) [![Apache License 2.0](https://img.shields.io/github/license/alb2k/fuel-filling-service?color=informational)](https://choosealicense.com/licenses/apache-2.0/) +For the license of this project, check the [LICENSE file](LICENSE)
+A summary of all dependencies and their licenses is also available [online](https://alb2k.github.io/fuel-filling-service/dependencies/) This project was created for the [Microstream hackathon](https://hackathon.microstream.one/) From 319dc43c602a3eb04d49248c4bc12dd36c99c132 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 22:17:21 +0200 Subject: [PATCH 43/76] Update Helidon.md --- docs/Helidon.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/Helidon.md b/docs/Helidon.md index d968835..c95313f 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -1,15 +1,36 @@ -# Helidon +# Helidon (Microprofile) -The project is based on [helidon-quickstart-mp](https://github.com/oracle/helidon/tree/master/examples/quickstarts/helidon-quickstart-mp) +WIP + + +[Helidon MP](https://helidon.io/docs/latest/#/about/02_introduction) is a [collection of Java Libaries](https://alb2k.github.io/fuel-filling-service/dependencies/#Dependency_Tree).
+This project is based on [helidon-quickstart-mp](https://github.com/oracle/helidon/tree/master/examples/quickstarts/helidon-quickstart-mp) + +In the following details I will describe the used components/libraries (mostly [Java/Jakarta EE](https://en.wikipedia.org/wiki/Jakarta_EE)) and some tweaks that were made. + +## Webservice +![Heldion_Overview.png](https://user-images.githubusercontent.com/80211953/113520281-34e32f80-9592-11eb-8ea8-6d5d118864b2.png) +* HTTP +* JAX RS +* MP Server config (port) +## Injection WIP -* What was used +## Validation +WIP + +* ConstraintViolationExceptionMapper + +--- + +* What was used (Java EE | JAX RS, Injection) * Explain arch * config via MP * CDI -* Validation +* Validation (Annotation) * ConstraintViolationExceptionMapper * ObjectMapperContextResolver * NotFoundExceptionHandler + From b830876586f5d13d6d301d77718ec72f5708b566 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 22:31:23 +0200 Subject: [PATCH 44/76] Update index.md --- docs/index.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/index.md b/docs/index.md index 1288171..01a5a58 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,12 +3,17 @@ Documentation about this project ## Details Each part / Used technology of the project has it's own documentation: -1. [Helidon](Helidon.md) -2. [Microstream](Microstream.md) -3. [OpenAPI (+UI)](OpenAPI.md) +1. [Helidon](Helidon.md)
+Webservice, CDI, Configuration with Microprofile and more +2. [Microstream](Microstream.md)
+Graph based binary data storage +3. [OpenAPI (+UI)](OpenAPI.md)
+Standardized specification to describe REST-conform APIs + UI 4. [Logging](Logging.md) -5. [GitHub Actions](GHActions.md) -6. [Heroku](Heroku.md) +5. [GitHub Actions](GHActions.md)
+Continuous Integration (CI) / Continuous Delivery (CD) +6. [Heroku](Heroku.md)
+How to host a demo online ## Overview From 88f28768f5b89564568aafce0984a1e086e3035e Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 22:32:14 +0200 Subject: [PATCH 45/76] Update Logging.md --- docs/Logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Logging.md b/docs/Logging.md index 7565b2f..1c0b6c4 100644 --- a/docs/Logging.md +++ b/docs/Logging.md @@ -21,7 +21,7 @@ Luckily I found [this great guide about how to use Heldion with other logging fr * Tweaked the [logging.properties](../src/main/resources/logging.properties) a bit so that it works correctly * Due to no available main entry class the SLF4JBridgeHandler for JUL is installed in the [Startup class](../src/main/java/hackathon/microstream/Startup.java#L26-L30) -After everything was done the output now looks like this: +After everything was done the output looks like this: ``` "...java.exe" ... io.helidon.microprofile.cdi.Main [INFORMATION] 2021-04-03 20:31:47 [Thread[main,5,main]] Logging at initialization configured using classpath: /logging.properties From 8cd882fe7f4c5b5676a8b2cd31b1c510031a7d57 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 4 Apr 2021 22:33:55 +0200 Subject: [PATCH 46/76] Update Logging.md --- docs/Logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Logging.md b/docs/Logging.md index 1c0b6c4..2f653ca 100644 --- a/docs/Logging.md +++ b/docs/Logging.md @@ -17,7 +17,7 @@ Luckily I found [this great guide about how to use Heldion with other logging fr * [org.slf4j:jul-to-slf4j](https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j) (JUL → SLF4J) * [org.apache.logging.log4j:log4j-slf4j-impl](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl) (SLF4J → LOG4J) * [org.apache.logging.log4j:log4j-core](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core) ("real" logging framework) -* Added a [log4j2.xml](../src/main/resources/log4j2.xml) +* Added [log4j2.xml](../src/main/resources/log4j2.xml) which [configures the logging framework](https://logging.apache.org/log4j/2.x/manual/configuration.html) * Tweaked the [logging.properties](../src/main/resources/logging.properties) a bit so that it works correctly * Due to no available main entry class the SLF4JBridgeHandler for JUL is installed in the [Startup class](../src/main/java/hackathon/microstream/Startup.java#L26-L30) From 4a0d458b4b26a7b76fb03113ca23c7d8a649b9f8 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Mon, 5 Apr 2021 13:07:03 +0200 Subject: [PATCH 47/76] Fixed return type --- .../java/hackathon/microstream/dal/FillingRepository.java | 8 ++++---- .../microstream/service/provider/FillingService.java | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/hackathon/microstream/dal/FillingRepository.java b/src/main/java/hackathon/microstream/dal/FillingRepository.java index 3c87664..eb1e602 100644 --- a/src/main/java/hackathon/microstream/dal/FillingRepository.java +++ b/src/main/java/hackathon/microstream/dal/FillingRepository.java @@ -27,7 +27,7 @@ public List getAll() { * @return * @throws NotFoundException */ - public Filling getById(UUID id) { + public DBFilling getById(UUID id) { if(id == null) throw new IllegalArgumentException("id can't be null"); @@ -48,7 +48,7 @@ public Filling getById(UUID id) { * @param filling * @return */ - public Filling add(Filling filling) { + public DBFilling add(Filling filling) { if(filling == null) throw new IllegalArgumentException("filling can't be null"); @@ -72,13 +72,13 @@ public Filling add(Filling filling) { * @return * @throws NotFoundException */ - public Filling update(UUID id, Filling filling) { + public DBFilling update(UUID id, Filling filling) { if(id == null) throw new IllegalArgumentException("id can't be null"); if(filling == null) throw new IllegalArgumentException("filling can't be null"); - Filling dbFilling = getById(id); + var dbFilling = getById(id); // Update the properties in the bean try { diff --git a/src/main/java/hackathon/microstream/service/provider/FillingService.java b/src/main/java/hackathon/microstream/service/provider/FillingService.java index e3776e8..c856f30 100644 --- a/src/main/java/hackathon/microstream/service/provider/FillingService.java +++ b/src/main/java/hackathon/microstream/service/provider/FillingService.java @@ -26,7 +26,7 @@ public List getAll() { * @return * @throws NotFoundException */ - public Filling getById(UUID id) { + public DBFilling getById(UUID id) { return this.fillingRepository.getById(id); } @@ -35,7 +35,7 @@ public Filling getById(UUID id) { * @param filling * @return */ - public Filling add(Filling filling) { + public DBFilling add(Filling filling) { return this.fillingRepository.add(filling); } @@ -45,7 +45,7 @@ public Filling add(Filling filling) { * @return * @throws NotFoundException */ - public Filling update(UUID id, Filling filling) { + public DBFilling update(UUID id, Filling filling) { return this.fillingRepository.update(id, filling); } From 3a86ba339688c33de9b3453dc673dd39e1e3a458 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Mon, 5 Apr 2021 13:57:57 +0200 Subject: [PATCH 48/76] Update Helidon.md --- docs/Helidon.md | 55 ++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/docs/Helidon.md b/docs/Helidon.md index c95313f..7c62fcc 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -1,36 +1,35 @@ # Helidon (Microprofile) -WIP - - [Helidon MP](https://helidon.io/docs/latest/#/about/02_introduction) is a [collection of Java Libaries](https://alb2k.github.io/fuel-filling-service/dependencies/#Dependency_Tree).
This project is based on [helidon-quickstart-mp](https://github.com/oracle/helidon/tree/master/examples/quickstarts/helidon-quickstart-mp) -In the following details I will describe the used components/libraries (mostly [Java/Jakarta EE](https://en.wikipedia.org/wiki/Jakarta_EE)) and some tweaks that were made. - ## Webservice ![Heldion_Overview.png](https://user-images.githubusercontent.com/80211953/113520281-34e32f80-9592-11eb-8ea8-6d5d118864b2.png) -* HTTP -* JAX RS -* MP Server config (port) - -## Injection -WIP - -## Validation -WIP - -* ConstraintViolationExceptionMapper - ---- - -* What was used (Java EE | JAX RS, Injection) -* Explain arch -* config via MP -* CDI -* Validation (Annotation) - * ConstraintViolationExceptionMapper -* ObjectMapperContextResolver -* NotFoundExceptionHandler - +The HTTP Webservice was done with [JAX-RS](https://en.wikipedia.org/wiki/Jakarta_RESTful_Web_Services) and other [Java/Jakarta EE technologies](https://en.wikipedia.org/wiki/Jakarta_EE).
+The rest resources are located in [src/main/java/hackathon/microstream/service/rest/resource](../src/main/java/hackathon/microstream/service/rest/resource). + +#### Validation +If entities are transmitted to a method they are validated (via the ``@Valid`` annotation) using [jersey-bean-validation](https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/bean-validation.html).
+When the validation fails, a ``ConstraintViolationException`` is thrown which is automatically processed by the [ConstraintViolationExceptionMapper](../src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java). + +#### Serialization +For the serialization from JSON to Java objects and back [com.fasterxml.jackson](https://github.com/FasterXML/jackson) is used. +This worked pretty good, however some tweaks had to be [applied to the defaults](../src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java): +* By default LocalDate is written as array, which is not [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) conform
+ → https://stackoverflow.com/a/28803634 +* By default ObjectMapper throws an exception, if unknown properties are supplied.
+ To be a bit less restrictive, unknown properties are allowed (easier handling of objects with / without UUID) + +To also automatically serialize Java objects (to JSON) in a response without the need of doing it manually with an ObjectMapper [org.glassfish.jersey.media:jersey-media-json-jackson](https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-json-jackson) is used.
+More information [available here](https://stackoverflow.com/questions/26207252/messagebodywriter-not-found-for-media-type-application-json). + +#### CDI +The corresponding [service](../src/main/java/hackathon/microstream/service/provider) is injected via CDI. + +#### Microprofile +Furthermore the integrated webserver can be configured with microprofile.
+For example, the [``server.port`` can be set](../src/main/resources/META-INF/microprofile-config.properties#L4-L6). + +#### Other tweaks +* When a entity is not found, a [``NotFoundException``](../src/main/java/hackathon/microstream/dal/util/NotFoundException.java) is thrown, which is automatically catched by the [``NotFoundExceptionHandler``](../src/main/java/hackathon/microstream/service/rest/errorhandling/NotFoundExceptionHandler.java) From 72c6adc3449c5c16fd7be72befc23b30f9ed223a Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Mon, 5 Apr 2021 14:03:43 +0200 Subject: [PATCH 49/76] Update Helidon.md --- docs/Helidon.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/Helidon.md b/docs/Helidon.md index 7c62fcc..1261047 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -7,11 +7,15 @@ This project is based on [helidon-quickstart-mp](https://github.com/oracle/helid ![Heldion_Overview.png](https://user-images.githubusercontent.com/80211953/113520281-34e32f80-9592-11eb-8ea8-6d5d118864b2.png) The HTTP Webservice was done with [JAX-RS](https://en.wikipedia.org/wiki/Jakarta_RESTful_Web_Services) and other [Java/Jakarta EE technologies](https://en.wikipedia.org/wiki/Jakarta_EE).
-The rest resources are located in [src/main/java/hackathon/microstream/service/rest/resource](../src/main/java/hackathon/microstream/service/rest/resource). +The "rest resources" (which represent the HTTP interface) are located in [src/main/java/hackathon/microstream/service/rest/resource](../src/main/java/hackathon/microstream/service/rest/resource). #### Validation If entities are transmitted to a method they are validated (via the ``@Valid`` annotation) using [jersey-bean-validation](https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/bean-validation.html).
-When the validation fails, a ``ConstraintViolationException`` is thrown which is automatically processed by the [ConstraintViolationExceptionMapper](../src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java). +When the validation fails, a ``ConstraintViolationException`` is thrown which is automatically processed by the [ConstraintViolationExceptionMapper](../src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java) and results in a better feedback: +``` +Unrecognized token 'trues': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') + at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 7, column: 30] +``` #### Serialization For the serialization from JSON to Java objects and back [com.fasterxml.jackson](https://github.com/FasterXML/jackson) is used. From b08388f4e61ee75df8257700459fc1d75fec2a54 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Mon, 5 Apr 2021 14:03:59 +0200 Subject: [PATCH 50/76] Better doc --- pom.xml | 8 +++++++- .../service/system/ObjectMapperContextResolver.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ffa1edc..a9a87af 100644 --- a/pom.xml +++ b/pom.xml @@ -84,18 +84,23 @@ jakarta.activation jakarta.activation-api + + org.glassfish.jersey.media jersey-media-json-jackson + org.glassfish.jersey.ext jersey-bean-validation + com.fasterxml.jackson.datatype jackson-datatype-jsr310 + org.jboss jandex @@ -145,12 +150,13 @@ ${org.apache.logging.log4j.version} - + jakarta.annotation jakarta.annotation-api 1.3.5 + commons-beanutils commons-beanutils diff --git a/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java b/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java index 9204569..2f4f0ec 100644 --- a/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java +++ b/src/main/java/hackathon/microstream/service/system/ObjectMapperContextResolver.java @@ -19,7 +19,7 @@ * *
  • * By default ObjectMapper throws an exception, if unknown properties are supplied.
    - * To be a bit less restrictive, unknown properties are allowed (easier handling of objects with / without UUID + * To be a bit less restrictive, unknown properties are allowed (easier handling of objects with / without UUID) *
  • * * From 8b5dd58cca645a62b85415afb2bd8010290da4ca Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Mon, 5 Apr 2021 14:08:06 +0200 Subject: [PATCH 51/76] Update Helidon.md --- docs/Helidon.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Helidon.md b/docs/Helidon.md index 1261047..f329138 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -1,7 +1,7 @@ # Helidon (Microprofile) -[Helidon MP](https://helidon.io/docs/latest/#/about/02_introduction) is a [collection of Java Libaries](https://alb2k.github.io/fuel-filling-service/dependencies/#Dependency_Tree).
    -This project is based on [helidon-quickstart-mp](https://github.com/oracle/helidon/tree/master/examples/quickstarts/helidon-quickstart-mp) +[Helidon MP](https://helidon.io/docs/latest/#/about/02_introduction) is a [collection of Java Libaries](https://alb2k.github.io/fuel-filling-service/dependencies/#Dependency_Tree) mainly used for Java/Jakarte EE conform web/microservices.
    +This project is based on [helidon-quickstart-mp](https://github.com/oracle/helidon/tree/master/examples/quickstarts/helidon-quickstart-mp). ## Webservice ![Heldion_Overview.png](https://user-images.githubusercontent.com/80211953/113520281-34e32f80-9592-11eb-8ea8-6d5d118864b2.png) @@ -29,7 +29,7 @@ To also automatically serialize Java objects (to JSON) in a response without the More information [available here](https://stackoverflow.com/questions/26207252/messagebodywriter-not-found-for-media-type-application-json). #### CDI -The corresponding [service](../src/main/java/hackathon/microstream/service/provider) is injected via CDI. +The corresponding [service](../src/main/java/hackathon/microstream/service/provider) is injected into the rest resource via CDI. #### Microprofile Furthermore the integrated webserver can be configured with microprofile.
    From faf8df7b3cb7c917f6c93b1d9fd2fb4c910dba43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Apr 2021 03:06:28 +0000 Subject: [PATCH 52/76] Bump actions/setup-java from v1 to v2 Bumps [actions/setup-java](https://github.com/actions/setup-java) from v1 to v2. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/v1...8764a52df183aa0ccea74521dfd9d506ffc7a19a) Signed-off-by: dependabot[bot] --- .github/workflows/checkBuild.yml | 2 +- .github/workflows/deploy.yml | 2 +- .github/workflows/gh-pages.yml | 2 +- .github/workflows/release.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checkBuild.yml b/.github/workflows/checkBuild.yml index 6cf3139..470afe4 100644 --- a/.github/workflows/checkBuild.yml +++ b/.github/workflows/checkBuild.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: java-version: 11.x diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 989840b..31d940a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: java-version: 11.x diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 27c2add..97dcd31 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup - Java - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: java-version: 11.0.x diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68d5404..88ef424 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: java-version: 11.x From 9b9361d5612267a0adcd7d5458c673ffe9539e89 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 20:38:40 +0200 Subject: [PATCH 53/76] Fixed build --- .github/workflows/checkBuild.yml | 1 + .github/workflows/deploy.yml | 1 + .github/workflows/gh-pages.yml | 1 + .github/workflows/release.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/checkBuild.yml b/.github/workflows/checkBuild.yml index 470afe4..800f842 100644 --- a/.github/workflows/checkBuild.yml +++ b/.github/workflows/checkBuild.yml @@ -21,6 +21,7 @@ jobs: uses: actions/setup-java@v2 with: java-version: 11.x + distribution: 'adopt' - name: Cache local Maven repository uses: actions/cache@v2 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 31d940a..1bb4a0a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,6 +16,7 @@ jobs: uses: actions/setup-java@v2 with: java-version: 11.x + distribution: 'adopt' - name: Cache local Maven repository uses: actions/cache@v2 diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 97dcd31..8fb859e 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -17,6 +17,7 @@ jobs: uses: actions/setup-java@v2 with: java-version: 11.0.x + distribution: 'adopt' - name: Restore - Maven Cache uses: actions/cache@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88ef424..0a1b197 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,6 +15,7 @@ jobs: uses: actions/setup-java@v2 with: java-version: 11.x + distribution: 'adopt' - name: Cache local Maven repository uses: actions/cache@v2 From 8c8f5917191bd2f2bb6ccbd844bd0649c6a72329 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:01:04 +0200 Subject: [PATCH 54/76] Update Helidon.md --- docs/Helidon.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/Helidon.md b/docs/Helidon.md index f329138..ea35a1c 100644 --- a/docs/Helidon.md +++ b/docs/Helidon.md @@ -6,12 +6,14 @@ This project is based on [helidon-quickstart-mp](https://github.com/oracle/helid ## Webservice ![Heldion_Overview.png](https://user-images.githubusercontent.com/80211953/113520281-34e32f80-9592-11eb-8ea8-6d5d118864b2.png) -The HTTP Webservice was done with [JAX-RS](https://en.wikipedia.org/wiki/Jakarta_RESTful_Web_Services) and other [Java/Jakarta EE technologies](https://en.wikipedia.org/wiki/Jakarta_EE).
    +The HTTP Webservice was done with [JAX-RS](https://en.wikipedia.org/wiki/Jakarta_RESTful_Web_Services) and other [Java/Jakarta EE technologies](https://en.wikipedia.org/wiki/Jakarta_EE) (see below).
    The "rest resources" (which represent the HTTP interface) are located in [src/main/java/hackathon/microstream/service/rest/resource](../src/main/java/hackathon/microstream/service/rest/resource). +The integrated webserver is the by default shipped [Helidon-Webserver](https://github.com/oracle/helidon/tree/master/webserver/webserver). + #### Validation If entities are transmitted to a method they are validated (via the ``@Valid`` annotation) using [jersey-bean-validation](https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/bean-validation.html).
    -When the validation fails, a ``ConstraintViolationException`` is thrown which is automatically processed by the [ConstraintViolationExceptionMapper](../src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java) and results in a better feedback: +When the validation fails, a ``ConstraintViolationException`` is thrown which is automatically processed by the [ConstraintViolationExceptionMapper](../src/main/java/hackathon/microstream/service/system/ConstraintViolationExceptionMapper.java) so that it results in a better readable exception: ``` Unrecognized token 'trues': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 7, column: 30] From a1d0b792c795b7c5604ad8bd901dd5ecedef1ec6 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:02:15 +0200 Subject: [PATCH 55/76] Update OpenAPI.md --- docs/OpenAPI.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/OpenAPI.md b/docs/OpenAPI.md index b7b0e37..97c08b4 100644 --- a/docs/OpenAPI.md +++ b/docs/OpenAPI.md @@ -1,6 +1,6 @@ -# [OpenAPI](https://www.openapis.org/) +# OpenAPI -OpenAPI is a standardized specification to describe REST-conform APIs. +[OpenAPI](https://www.openapis.org/) is a standardized specification to describe REST-conform APIs. Helidon supports OpenAPI.
    For more information read [this guide](https://medium.com/helidon/project-helidon-and-openapi-54a1fadc75b1). From 0e8ca605070bb0605ce6adf595ad0d8be173f24f Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:03:09 +0200 Subject: [PATCH 56/76] Update OpenAPI.md --- docs/OpenAPI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/OpenAPI.md b/docs/OpenAPI.md index 97c08b4..76cbb28 100644 --- a/docs/OpenAPI.md +++ b/docs/OpenAPI.md @@ -21,5 +21,5 @@ I also highly recommend reading the ["Getting Started" page of OpenAPI-UI](https Note: Using the app locally sometimes throws `` [WARN ] 2021-04-03 20:00:00.787 [helidon-2] io.helidon.webserver.RequestRouting - Default error handler: Response wasn't successfully sent. java.util.concurrent.CompletionException: io.helidon.webserver.SocketClosedException: Response channel is closed! -`` when calling the root / '/'.
    +`` when calling the root endpoint ('/').
    This problem does not occur when it is deployed on Heroku. From 3ed0ac06eb5d2473f95cbea2e7d319c120c81680 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:04:53 +0200 Subject: [PATCH 57/76] Update Microstream.md --- docs/Microstream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Microstream.md b/docs/Microstream.md index 751d457..14dac6e 100644 --- a/docs/Microstream.md +++ b/docs/Microstream.md @@ -7,7 +7,7 @@ The project was mainly written based on the [Microstream Getting Started Guide]( #### TL;DR / What was done to add it to this project? * Added [the dependencies](https://manual.docs.microstream.one/data-store/getting-started#prerequisites) to the [pom.xml](../pom.xml) * Added a [root instance / DBContext class](../src/main/java/hackathon/microstream/storage/DBContext.java), where all objects that should be persisted are attached to (more information available [here](https://manual.docs.microstream.one/data-store/getting-started#the-root-instance)) -* Added a [DB Manager](../src/main/java/hackathon/microstream/storage/DBManager.java), which manages (cares about initalizing, reading, saving, shutdown ...) and holds the DBContext +* Added a [DB Manager](../src/main/java/hackathon/microstream/storage/DBManager.java), which manages (cares about initializing, reading, saving, shutdown ...) and holds the DBContext * There also exist a demo mode → if enabled all data is overriden by the defaults on init
    The demo mode is managed by [microprofile-config.properties](../src/main/resources/META-INF/microprofile-config.properties#L2) * Added [microstream-storage.properties](../src/main/resources/microstream-storage.properties) From 07fd98fcbdfe7aa3c9a77578dc6e02da99bac19f Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:06:51 +0200 Subject: [PATCH 58/76] Update OpenAPI.md --- docs/OpenAPI.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/OpenAPI.md b/docs/OpenAPI.md index 76cbb28..6aca878 100644 --- a/docs/OpenAPI.md +++ b/docs/OpenAPI.md @@ -10,8 +10,8 @@ To test the app without the requirement of an external HTTP Client, you can simp #### What was done to add it to this project? * Added the [dependency](https://mvnrepository.com/artifact/org.microprofile-ext.openapi-ext/openapi-ui) to the pom.xml -* Annotated the Rest-Endpoints with informations -* Added a custom application class for some informations → [App.java](../src/main/java/hackathon/microstream/service/system/App.java) +* Annotated the Rest-Endpoints (e.g. ``@Operation`` or ``@APIResponse``) +* Added a custom application class for more information → [App.java](../src/main/java/hackathon/microstream/service/system/App.java) * Customized the UI further with [microprofile-config.properties](../src/main/resources/META-INF/microprofile-config.properties#L9-L11) * Added a [RootResource](../src/main/java/hackathon/microstream/service/rest/resource/RootResource.java) which redirects to the OpenAPI UI endpoint when trying to get '/' From 3c30c4952e1400254569906ba0ad1ae33d09471a Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:07:40 +0200 Subject: [PATCH 59/76] Update Logging.md --- docs/Logging.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Logging.md b/docs/Logging.md index 2f653ca..ddbb5c9 100644 --- a/docs/Logging.md +++ b/docs/Logging.md @@ -1,11 +1,11 @@ # Logging -To protocol informations about events in the app, some kind of logging is required.
    +To protocol information about events in the app, some kind of logging is required.
    For Java therefore multiple logging frameworks exist. Some popular ones include SLF4J, LOG4J, JUL, Logback, etc. Helidon uses [JUL](https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html) as default logger. ### Using another logging framework -However I prefer the more statisfying [SLF4J](http://www.slf4j.org/) (→ https://stackoverflow.com/a/11360517) in combination with [Log4j 2](https://logging.apache.org/log4j/2.x/).
    +However I prefer the more satisfying [SLF4J](http://www.slf4j.org/) (→ https://stackoverflow.com/a/11360517) in combination with [Log4j 2](https://logging.apache.org/log4j/2.x/).
    So an adapter was needed to redirect JUL to SLF4J... Luckily I found [this great guide about how to use Heldion with other logging frameworks](https://medium.com/helidon/helidon-logging-and-mdc-5de272cf085d) which basically tells you how to achieve that. From 9cbd8adcbbf9e18bbe7d02a746908abb1f995bf4 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:09:06 +0200 Subject: [PATCH 60/76] Update GHActions.md --- docs/GHActions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/GHActions.md b/docs/GHActions.md index 94da0a9..63d2499 100644 --- a/docs/GHActions.md +++ b/docs/GHActions.md @@ -8,4 +8,4 @@ The following plans are used: | [deploy.yml](../.github/workflows/deploy.yml) | Push on master | Deploys the current code to [Heroku](Heroku.md) | | [gh-pages.yml](../.github/workflows/gh-pages.yml) | Push on master | Creates a [project-info-report about the dependencies](https://maven.apache.org/plugins/maven-project-info-reports-plugin/dependencies-mojo.html) and publishes it with [GitHub pages](https://pages.github.com/) | -Results of the executed workflows are aviable in the [``Actions`` tab](https://github.com/alb2k/fuel-filling-service/actions) +Results of the executed workflows occur in the [``Actions`` tab](https://github.com/alb2k/fuel-filling-service/actions) From a895fb433eadd8d00a40a8298211f0f5f6acc5c2 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:09:56 +0200 Subject: [PATCH 61/76] Update Heroku.md --- docs/Heroku.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Heroku.md b/docs/Heroku.md index 9d35c25..6d1cb64 100644 --- a/docs/Heroku.md +++ b/docs/Heroku.md @@ -42,7 +42,7 @@ Setup a new workflow and name it e.g. [deploy.yml](../.github/workflows/deploy.y The workflow has to meet the following requirements: * Executed the workflow when a new release is created or manually -* Build tha app (as jar) +* Build the app (as jar) * Deploy the app to Heroku The first two parts are pretty easy doable if you know a bit about GitHub Actions.
    @@ -59,7 +59,7 @@ The last part is a little bit more tricky: In the last 2 steps you noted the use of ``${{ secret.XXX }}`` this is the usage of the GitHub secrets we created before. #### Using a Procfile -There is one special case when you want to use heroku: You have to either expose your app on Port 80 or you have to bind to Herokus ``PORT`` environment variable. +There is one special case when you want to use Heroku: You have to either expose your app on Port 80 or you have to bind to Herokus ``PORT`` environment variable. This can be done easily using a [Procfile](/Procfile) in the repository root which contains ``-Dserver.port=$PORT``. From c8df9803f03d943a79132005e2b3082f92500541 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:10:36 +0200 Subject: [PATCH 62/76] Create Readme.md --- docs/Readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/Readme.md diff --git a/docs/Readme.md b/docs/Readme.md new file mode 100644 index 0000000..bf0297b --- /dev/null +++ b/docs/Readme.md @@ -0,0 +1 @@ +## Test From f18a236b01a2ced7656d8e3adfbf7a1d8b9b027d Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:12:42 +0200 Subject: [PATCH 63/76] Docs --- README.md | 4 ++-- docs/Readme.md | 22 +++++++++++++++++++++- docs/index.md | 21 --------------------- 3 files changed, 23 insertions(+), 24 deletions(-) delete mode 100644 docs/index.md diff --git a/README.md b/README.md index 1f5233e..ebfd01d 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ It is also shipped with a nice UI (openapi-ui) so that no external REST/HTTP cli * [GitHub Actions](https://github.com/features/actions) for CI/CD * [Heroku](https://www.heroku.com/) for hosting the demo -### [Documentation in detail](docs/index.md) -Documentation about this project is [available here](docs/index.md) +### [Documentation in detail](docs/README.md) +Documentation about this project is [available here](docs/README.md) ## [Demo](https://hackathon-ms-fuel-filling.herokuapp.com) [![Deployment Status](https://img.shields.io/github/workflow/status/alb2k/fuel-filling-service/Deploy%20CI?label=deployment)](https://github.com/alb2k/fuel-filling-service/actions/workflows/deploy.yml) The demo is hosted on heroku.
    diff --git a/docs/Readme.md b/docs/Readme.md index bf0297b..01a5a58 100644 --- a/docs/Readme.md +++ b/docs/Readme.md @@ -1 +1,21 @@ -## Test +# Docs +Documentation about this project + +## Details +Each part / Used technology of the project has it's own documentation: +1. [Helidon](Helidon.md)
    +Webservice, CDI, Configuration with Microprofile and more +2. [Microstream](Microstream.md)
    +Graph based binary data storage +3. [OpenAPI (+UI)](OpenAPI.md)
    +Standardized specification to describe REST-conform APIs + UI +4. [Logging](Logging.md) +5. [GitHub Actions](GHActions.md)
    +Continuous Integration (CI) / Continuous Delivery (CD) +6. [Heroku](Heroku.md)
    +How to host a demo online + + +## Overview +A quick overview how the project is designed to work:

    +![Overview](https://user-images.githubusercontent.com/80211953/112724270-d7583e80-8f12-11eb-9506-5e62c647f98d.png) diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 01a5a58..0000000 --- a/docs/index.md +++ /dev/null @@ -1,21 +0,0 @@ -# Docs -Documentation about this project - -## Details -Each part / Used technology of the project has it's own documentation: -1. [Helidon](Helidon.md)
    -Webservice, CDI, Configuration with Microprofile and more -2. [Microstream](Microstream.md)
    -Graph based binary data storage -3. [OpenAPI (+UI)](OpenAPI.md)
    -Standardized specification to describe REST-conform APIs + UI -4. [Logging](Logging.md) -5. [GitHub Actions](GHActions.md)
    -Continuous Integration (CI) / Continuous Delivery (CD) -6. [Heroku](Heroku.md)
    -How to host a demo online - - -## Overview -A quick overview how the project is designed to work:

    -![Overview](https://user-images.githubusercontent.com/80211953/112724270-d7583e80-8f12-11eb-9506-5e62c647f98d.png) From 4eabb524a7c6391997b674c788de49668345d60b Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:14:56 +0200 Subject: [PATCH 64/76] Rename Readme.md to README.md --- docs/{Readme.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{Readme.md => README.md} (100%) diff --git a/docs/Readme.md b/docs/README.md similarity index 100% rename from docs/Readme.md rename to docs/README.md From 520258f050ae369889cc2666952957c79f89bcf0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 03:06:47 +0000 Subject: [PATCH 65/76] Bump helidon-cli-maven-plugin from 2.1.3 to 2.2.1 Bumps helidon-cli-maven-plugin from 2.1.3 to 2.2.1. Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2de9048..1f5ec97 100644 --- a/pom.xml +++ b/pom.xml @@ -228,7 +228,7 @@ io.helidon.build-tools helidon-cli-maven-plugin - 2.1.3 + 2.2.1 From 0baf7bf2f0b320a20f08b773380e326c35f592e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 03:06:49 +0000 Subject: [PATCH 66/76] Bump helidon-maven-plugin from 2.1.3 to 2.2.1 Bumps helidon-maven-plugin from 2.1.3 to 2.2.1. Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2de9048..1acd572 100644 --- a/pom.xml +++ b/pom.xml @@ -223,7 +223,7 @@ io.helidon.build-tools helidon-maven-plugin - 2.1.3 + 2.2.1 io.helidon.build-tools From 111bf8a8c71a30bf3dee134430de789d2ec47a66 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Thu, 13 May 2021 15:50:54 +0200 Subject: [PATCH 67/76] Update Heroku.md --- docs/Heroku.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/Heroku.md b/docs/Heroku.md index 6d1cb64..76d97a0 100644 --- a/docs/Heroku.md +++ b/docs/Heroku.md @@ -51,12 +51,13 @@ The last part is a little bit more tricky: * At first install [Heroku's Java plugin](https://github.com/heroku/plugin-java): ``heroku plugins:install java`` * Deploy the jar with the deploy command ``heroku deploy:jar`` * Select the jar using ``target/fuel-filling-service.jar`` - * Set the JDK explicitly to Java 11 using ``--jdk 11``.
    Heroku trys to deploy by default with JDK 8. + * Set the JDK to Java 11 using ``--jdk 11``.
    Heroku trys to deploy by default with JDK 8. * The libs folder must be included: ``--includes target/libs/`` * Select the app that you want to deploy to with ``--app ${{ secrets.HEROKU_APP_NAME }}`` * Of course Heroku also needs some type of authentication. This is done using ``HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}`` -In the last 2 steps you noted the use of ``${{ secret.XXX }}`` this is the usage of the GitHub secrets we created before. +In the last 2 steps you noted the use of ``${{ secret.XXX }}``.
    +This is the usage of the GitHub secrets we created before. #### Using a Procfile There is one special case when you want to use Heroku: You have to either expose your app on Port 80 or you have to bind to Herokus ``PORT`` environment variable. From ef85edd792820ee382dd3d93501504cb5b79994b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 03:07:09 +0000 Subject: [PATCH 68/76] Bump jmdns from 3.5.6 to 3.5.7 Bumps [jmdns](https://github.com/jmdns/jmdns) from 3.5.6 to 3.5.7. - [Release notes](https://github.com/jmdns/jmdns/releases) - [Changelog](https://github.com/jmdns/jmdns/blob/main/CHANGELOG.txt) - [Commits](https://github.com/jmdns/jmdns/compare/3.5.6...3.5.7) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0007e88..9cad5b3 100644 --- a/pom.xml +++ b/pom.xml @@ -299,7 +299,7 @@ org.jmdns jmdns - 3.5.6 + 3.5.7 From f546f3367abc6fe62ed36512c1cc51083f484530 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Jun 2021 03:06:15 +0000 Subject: [PATCH 69/76] Bump jandex-maven-plugin from 1.0.8 to 1.1.0 Bumps [jandex-maven-plugin](https://github.com/wildfly/jandex-maven-plugin) from 1.0.8 to 1.1.0. - [Release notes](https://github.com/wildfly/jandex-maven-plugin/releases) - [Commits](https://github.com/wildfly/jandex-maven-plugin/compare/1.0.8...1.1.0) --- updated-dependencies: - dependency-name: org.jboss.jandex:jandex-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0007e88..f9a1114 100644 --- a/pom.xml +++ b/pom.xml @@ -210,7 +210,7 @@ org.jboss.jandex jandex-maven-plugin - 1.0.8 + 1.1.0 org.codehaus.mojo From e63f57fa7e63adfc351553ce733ba205ecff525c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Jun 2021 03:07:58 +0000 Subject: [PATCH 70/76] Bump maven-dependency-plugin from 3.1.2 to 3.2.0 Bumps [maven-dependency-plugin](https://github.com/apache/maven-dependency-plugin) from 3.1.2 to 3.2.0. - [Release notes](https://github.com/apache/maven-dependency-plugin/releases) - [Commits](https://github.com/apache/maven-dependency-plugin/compare/maven-dependency-plugin-3.1.2...maven-dependency-plugin-3.2.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-dependency-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0007e88..c4ccadb 100644 --- a/pom.xml +++ b/pom.xml @@ -185,7 +185,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.1.2 + 3.2.0 org.apache.maven.plugins From 4333d0254aa8cd7e0f7c45dd4736399b28f05437 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Jun 2021 03:07:06 +0000 Subject: [PATCH 71/76] Bump org.slf4j.version from 1.7.30 to 1.7.31 Bumps `org.slf4j.version` from 1.7.30 to 1.7.31. Updates `slf4j-api` from 1.7.30 to 1.7.31 - [Release notes](https://github.com/qos-ch/slf4j/releases) - [Commits](https://github.com/qos-ch/slf4j/commits) Updates `jul-to-slf4j` from 1.7.30 to 1.7.31 - [Release notes](https://github.com/qos-ch/slf4j/releases) - [Commits](https://github.com/qos-ch/slf4j/commits) --- updated-dependencies: - dependency-name: org.slf4j:slf4j-api dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.slf4j:jul-to-slf4j dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0007e88..910dcb8 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 2.2.2 - 1.7.30 + 1.7.31 2.14.1 From db3a9df7d3a906f7df92c6c85cd5ee441b19fe99 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Jun 2021 03:06:54 +0000 Subject: [PATCH 72/76] Bump helidon-dependencies from 2.2.2 to 2.3.1 Bumps helidon-dependencies from 2.2.2 to 2.3.1. --- updated-dependencies: - dependency-name: io.helidon:helidon-dependencies dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0007e88..58835ab 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ UTF-8 - 2.2.2 + 2.3.1 1.7.30 2.14.1 From e0bd64acbc9e36e1880ebdbe257ce7b7186b6e82 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 27 Jun 2021 15:35:10 +0200 Subject: [PATCH 73/76] Fix? --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index c4ccadb..79c0205 100644 --- a/pom.xml +++ b/pom.xml @@ -250,7 +250,6 @@ true true runtime - test From 575609769d08052e6ce716a9dbd65869ab04aae0 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 27 Jun 2021 15:56:26 +0200 Subject: [PATCH 74/76] Added dockerhub publish support --- .github/workflows/deployDockerHubDevelop.yml | 27 ++++++++++++++++++++ .github/workflows/release.yml | 20 +++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/deployDockerHubDevelop.yml diff --git a/.github/workflows/deployDockerHubDevelop.yml b/.github/workflows/deployDockerHubDevelop.yml new file mode 100644 index 0000000..f6bb0b0 --- /dev/null +++ b/.github/workflows/deployDockerHubDevelop.yml @@ -0,0 +1,27 @@ +name: Deploy develop to DockerHub + +on: + workflow_dispatch: + push: + branches: [ develop ] + +jobs: + build_publish_docker: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Generate tag vars + id: tagvars + run: | + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "::set-output name=build_datetime::$(date -u +%Y%m%d-%H%M)" + + - name: Builder Dockerimage and publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: alb2k/fuel-filling-service + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + tags: "develop" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a1b197..85241b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,6 +67,26 @@ jobs: asset_name: release.zip asset_content_type: application/octet-stream + build_publish_docker: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Generate tag vars + id: tagvars + run: | + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "::set-output name=build_datetime::$(date -u +%Y%m%d-%H%M)" + + - name: Builder Dockerimage and publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: alb2k/fuel-filling-service + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + tags: "latest,master-${{ steps.tagvars.outputs.sha_short }}-${{ steps.tagvars.outputs.build_datetime }}" + after_release: runs-on: ubuntu-latest needs: [build_release_jar] From cb3aa4e0b3c8fd9939882b099612c6aa64d855d7 Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 27 Jun 2021 16:05:42 +0200 Subject: [PATCH 75/76] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebfd01d..c9ff042 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,11 @@ Requirements: Requirements: * Docker -#### "Normal" Dockerfile +#### Running the prebuilt image from DockerHub [![Latest docker version](https://img.shields.io/badge/docker-latest-%232684ff)](https://hub.docker.com/r/alb2k/fuel-filling-service/tags?name=latest&page=1) [![Develop docker version](https://img.shields.io/badge/docker-develop-%232684ff)](https://hub.docker.com/r/alb2k/fuel-filling-service/tags?name=develop&page=1) +* Run the latest release using ``docker run --rm -p 8080:8080 --name fuel-filling alb2k/fuel-filling-service`` +* Stop/Remove it with ``docker stop fuel-filling`` + +#### Building and running it * Build the image with ``docker build -t fuel-filling .`` * Execute it with ``docker run --rm -p 8080:8080 --name fuel-filling fuel-filling`` * Stop/Remove it with ``docker stop fuel-filling`` From 50c851a5b2e5a9dd0461e33e56434bce227cd38e Mon Sep 17 00:00:00 2001 From: alb2k <80211953+alb2k@users.noreply.github.com> Date: Sun, 27 Jun 2021 16:06:19 +0200 Subject: [PATCH 76/76] Update deployDockerHubDevelop.yml --- .github/workflows/deployDockerHubDevelop.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deployDockerHubDevelop.yml b/.github/workflows/deployDockerHubDevelop.yml index f6bb0b0..b484618 100644 --- a/.github/workflows/deployDockerHubDevelop.yml +++ b/.github/workflows/deployDockerHubDevelop.yml @@ -4,6 +4,8 @@ on: workflow_dispatch: push: branches: [ develop ] + paths-ignore: + - '**.md' jobs: build_publish_docker: