From cb36a7a3f0d8da5b494240ee49493c0383375114 Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Fri, 17 Nov 2023 16:56:54 -0500 Subject: [PATCH 1/7] Merge Signed-off-by: Eric Deandrea --- .../workflows/build-push-container-images.yml | 22 +++-- .github/workflows/simple-build-test.yml | 31 +++---- README.md | 4 +- event-statistics/README.md | 24 +++-- .../src/main/docker-compose/java21.yml | 26 ++++++ .../src/main/docker/Dockerfile.jvm21 | 92 +++++++++++++++++++ .../src/main/resources/application.properties | 16 ++++ grpc-locations/README.md | 21 +++-- .../src/main/docker/Dockerfile.jvm21 | 92 +++++++++++++++++++ .../src/main/resources/application.yml | 52 +++++++++++ rest-fights/README.md | 32 ++++--- .../src/main/docker-compose/java21.yml | 37 ++++++++ rest-fights/src/main/docker/Dockerfile.jvm21 | 92 +++++++++++++++++++ .../src/main/resources/application.properties | 16 ++++ rest-heroes/README.md | 27 ++++-- .../src/main/docker-compose/java21.yml | 28 ++++++ rest-heroes/src/main/docker/Dockerfile.jvm21 | 92 +++++++++++++++++++ .../src/main/resources/application.yml | 52 +++++++++++ rest-narration/README.md | 22 +++-- .../src/main/docker-compose/java21.yml | 21 +++++ .../src/main/docker/Dockerfile.jvm21 | 92 +++++++++++++++++++ .../src/main/resources/application.properties | 16 ++++ rest-villains/README.md | 27 ++++-- .../src/main/docker-compose/java21.yml | 28 ++++++ .../src/main/docker/Dockerfile.jvm21 | 92 +++++++++++++++++++ .../src/main/resources/application.properties | 16 ++++ scripts/generate-docker-compose-resources.sh | 6 +- scripts/generate-k8s-resources.sh | 6 +- ui-super-heroes/README.md | 45 ++++----- .../src/main/docker-compose/java17.yml | 2 +- .../src/main/docker-compose/java21.yml | 9 ++ .../src/main/docker-compose/native.yml | 2 +- .../src/main/docker/Dockerfile.jvm21 | 92 +++++++++++++++++++ .../src/main/resources/application.properties | 16 ++++ 34 files changed, 1139 insertions(+), 109 deletions(-) create mode 100644 event-statistics/src/main/docker-compose/java21.yml create mode 100644 event-statistics/src/main/docker/Dockerfile.jvm21 create mode 100644 grpc-locations/src/main/docker/Dockerfile.jvm21 create mode 100644 rest-fights/src/main/docker-compose/java21.yml create mode 100644 rest-fights/src/main/docker/Dockerfile.jvm21 create mode 100644 rest-heroes/src/main/docker-compose/java21.yml create mode 100644 rest-heroes/src/main/docker/Dockerfile.jvm21 create mode 100644 rest-narration/src/main/docker-compose/java21.yml create mode 100644 rest-narration/src/main/docker/Dockerfile.jvm21 create mode 100644 rest-villains/src/main/docker-compose/java21.yml create mode 100644 rest-villains/src/main/docker/Dockerfile.jvm21 create mode 100644 ui-super-heroes/src/main/docker-compose/java21.yml create mode 100644 ui-super-heroes/src/main/docker/Dockerfile.jvm21 diff --git a/.github/workflows/build-push-container-images.yml b/.github/workflows/build-push-container-images.yml index 4d2922aea..74d257ed7 100644 --- a/.github/workflows/build-push-container-images.yml +++ b/.github/workflows/build-push-container-images.yml @@ -2,8 +2,7 @@ name: Build and Push Container images env: IMAGE_BASE_NAME: "quay.io/quarkus-super-heroes" - MANDREL_IMAGE: "quay.io/quarkus/ubi-quarkus-mandrel-builder-image" - MANDREL_VERSION: "23.0" + GRAALVM_IMAGE: "quay.io/quarkus/ubi-quarkus-graalvmce-builder-image" LATEST_IMAGE_TAG: "latest" on: @@ -28,6 +27,7 @@ jobs: matrix: java: - '17' + - '21' project: - event-statistics - rest-fights @@ -62,7 +62,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} - distribution: temurin + distribution: zulu cache: maven - name: Create env vars @@ -115,7 +115,7 @@ jobs: fail-fast: false matrix: java: - - '17' + - '21' project: - event-statistics - rest-fights @@ -151,7 +151,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} - distribution: temurin + distribution: zulu cache: maven - name: Create env vars @@ -182,7 +182,7 @@ jobs: -Dmaven.compiler.release=${{ matrix.java }} \ -Dquarkus.http.host=0.0.0.0 \ -Dquarkus.native.container-build=true \ - -Dquarkus.native.builder-image=${{ env.MANDREL_IMAGE }}:${{ env.MANDREL_VERSION }}-java${{ matrix.java }} \ + -Dquarkus.native.builder-image=${{ env.GRAALVM_IMAGE }}:jdk-${{ matrix.java }} \ -Dquarkus.native.container-runtime-options=--platform=linux/${{ matrix.arch }} \ -Dquarkus.container-image.build=true \ -Dquarkus.container-image.push=false \ @@ -204,6 +204,7 @@ jobs: matrix: java: - '17' + - '21' kind: - "" - "native-" @@ -218,10 +219,12 @@ jobs: arch: - amd64 - arm64 -# Until https://github.com/microsoft/semantic-kernel/issues/2885 is resolved exclude: +# Until https://github.com/microsoft/semantic-kernel/issues/2885 is resolved - project: rest-narration kind: "native-" + - java: 17 + kind: "native-" name: "Push app images (${{ matrix.arch }}-${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }})" steps: - name: Calculate Branch (workflow_run event) @@ -312,6 +315,7 @@ jobs: matrix: java: - '17' + - '21' kind: - "" - "native-" @@ -323,10 +327,12 @@ jobs: - rest-narration - grpc-locations - ui-super-heroes -# Until https://github.com/microsoft/semantic-kernel/issues/2885 is resolved exclude: +# Until https://github.com/microsoft/semantic-kernel/issues/2885 is resolved - project: rest-narration kind: "native-" + - java: 17 + kind: "native-" name: Create app multiarch manifests (${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }}) steps: - name: Calculate Branch (workflow_run event) diff --git a/.github/workflows/simple-build-test.yml b/.github/workflows/simple-build-test.yml index b799d738a..6a05f35dc 100644 --- a/.github/workflows/simple-build-test.yml +++ b/.github/workflows/simple-build-test.yml @@ -1,8 +1,5 @@ name: Basic build and test -env: - MANDREL_VERSION: "23.0.1.2-Final" - on: push: paths-ignore: @@ -56,6 +53,7 @@ jobs: matrix: java: - '17' + - '21' project: - event-statistics - rest-fights @@ -72,7 +70,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} - distribution: temurin + distribution: zulu cache: maven - name: "build-test-jvm-${{ matrix.project }}-java-${{ matrix.java }}" @@ -89,7 +87,8 @@ jobs: fail-fast: false matrix: java: - - '17' + - { graal: '17.0.8', java: '17' } + - { graal: '21.0.0', java: '21'} project: - event-statistics - rest-fights @@ -103,25 +102,25 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Cache and restore Mandrel distro - id: check-mandrel-cache + - name: Cache and restore GraalVM CE (${{ matrix.java.graal }}) + id: check-graal-cache uses: actions/cache@v3 with: - path: mandrel-${{ env.MANDREL_VERSION }}-${{ matrix.java }}.tar.gz - key: mandrel-distro-${{ env.MANDREL_VERSION }}-${{ matrix.java }} + path: graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz + key: graal-distro-${{ matrix.java.graal }} - - name: Download Mandrel - if: steps.check-mandrel-cache.outputs.cache-hit != 'true' + - name: Download GraalVM CE ${{ matrix.java.graal }} + if: steps.check-graal-cache.outputs.cache-hit != 'true' run: | - download_url="https://github.com/graalvm/mandrel/releases/download/mandrel-${MANDREL_VERSION}/mandrel-java${{ matrix.java }}-linux-amd64-${MANDREL_VERSION}.tar.gz" - wget -q -O mandrel-${{ env.MANDREL_VERSION }}-${{ matrix.java }}.tar.gz $download_url + download_url="https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${{ matrix.java.graal }}/graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz" + wget -q -O graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz $download_url - - name: Setup Maven+OpenJDK Distro + - name: Setup GraalVM CE ${{ matrix.java.graal }} distro uses: actions/setup-java@v3 with: distribution: 'jdkfile' - jdkFile: mandrel-${{ env.MANDREL_VERSION }}-${{ matrix.java }}.tar.gz - java-version: ${{ matrix.java }} + jdkFile: graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz + java-version: ${{ matrix.java.java }} architecture: x64 cache: maven diff --git a/README.md b/README.md index 38861c9c2..db2a7e465 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ Pick one of the 4 versions of the application from the table below and execute t | Description | Image Tag | Docker Compose Run Command | Docker Compose Run Command with Monitoring | |-------------|-----------------|--------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17.yml up --remove-orphans` | `docker compose -f deploy/docker-compose/java17.yml -f deploy/docker-compose/monitoring.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f deploy/docker-compose/java21.yml up --remove-orphans` | `docker compose -f deploy/docker-compose/java21.yml -f deploy/docker-compose/monitoring.yml up --remove-orphans` | | Native | `native-latest` | `docker compose -f deploy/docker-compose/native.yml up --remove-orphans` | `docker compose -f deploy/docker-compose/native.yml -f deploy/docker-compose/monitoring.yml up --remove-orphans` | > [!TIP] @@ -131,9 +132,10 @@ Pick one of the 4 versions of the system from the table below and deploy the app > > For a production-ready Apicurio Schema Registry, please see the [Apicurio Registry Operator documentation](https://www.apicur.io/registry/docs/apicurio-registry-operator/1.0.0/index.html). You can also try out a [fully hosted and managed Schema Registry service](https://console.redhat.com/application-services/service-registry)! -| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | +| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | KNative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | | Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) | ### Monitoring diff --git a/event-statistics/README.md b/event-statistics/README.md index 4255bf9f5..1afccfa1a 100644 --- a/event-statistics/README.md +++ b/event-statistics/README.md @@ -84,7 +84,7 @@ By default, the application is configured with the following: ## Running Locally via Docker Compose Pre-built images for this application can be found at [`quay.io/quarkus-super-heroes/event-statistics`](https://quay.io/repository/quarkus-super-heroes/event-statistics?tab=tags). -Pick one of the 4 versions of the application from the table below and execute the appropriate docker compose command from the `quarkus-super-heroes/event-statistics` directory. +Pick one of the versions of the application from the table below and execute the appropriate docker compose command from the `quarkus-super-heroes/event-statistics` directory. > [!NOTE] > You may see errors as the applications start up. This may happen if an application completes startup before one if its required services (i.e. database, kafka, etc). This is fine. Once everything completes startup things will work fine. @@ -92,6 +92,7 @@ Pick one of the 4 versions of the application from the table below and execute t | Description | Image Tag | Docker Compose Run Command | |-------------|-----------------|--------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f deploy/docker-compose/java21.yml up --remove-orphans` | | Native | `native-latest` | `docker compose -f deploy/docker-compose/native.yml up --remove-orphans` | These Docker Compose files are meant for standing up this application and the required Kafka broker only. If you want to stand up the entire system, [follow these instructions](../README.md#running-locally-via-docker-compose). @@ -109,11 +110,12 @@ Deployment descriptors for these images are provided in the [`deploy/k8s`](deplo > [!NOTE] > The [Knative](https://knative.dev/docs/) variant can be used on any Knative installation that runs on top of Kubernetes or OpenShift. For OpenShift, you need [OpenShift Serverless](https://docs.openshift.com/serverless/latest/about/about-serverless.html) installed from the OpenShift operator catalog. Using Knative has the benefit that services are scaled down to zero replicas when they are not used. -Pick one of the 4 versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). +Pick one of the versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). | Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | | Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) | The application is exposed outside of the cluster on port `80`. @@ -126,13 +128,17 @@ Following the [deployment section](https://quarkus.io/guides/deploying-to-kubern > [!NOTE] > For non-OpenShift or minikube Kubernetes variants, you will most likely need to [push the image to a container registry](https://quarkus.io/guides/container-image#pushing) by adding the `-Dquarkus.container-image.push=true` flag, as well as setting the `quarkus.container-image.registry`, `quarkus.container-image.group`, and/or the `quarkus.container-image.name` properties to different values. -| Target Platform | Java Version | Command | -|------------------------|:------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | -| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Target Platform | Java Version | Command | +|------------------------|:------------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Kubernetes | 21 | `./mvnw clean package -Dquarkus.profile=kubernetes-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 21 | `./mvnw clean package -Dquarkus.profile=openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 21 | `./mvnw clean package -Dquarkus.profile=minikube-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 21 | `./mvnw clean package -Dquarkus.profile=knative-openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | You may need to adjust other configuration options as well (see [Quarkus Kubernetes Extension configuration options](https://quarkus.io/guides/deploying-to-kubernetes#configuration-options) and [Quarkus OpenShift Extension configuration options](https://quarkus.io/guides/deploying-to-openshift#configuration-reference)). diff --git a/event-statistics/src/main/docker-compose/java21.yml b/event-statistics/src/main/docker-compose/java21.yml new file mode 100644 index 000000000..060395354 --- /dev/null +++ b/event-statistics/src/main/docker-compose/java21.yml @@ -0,0 +1,26 @@ + + event-statistics-java21: + image: quay.io/quarkus-super-heroes/event-statistics:java21-latest + container_name: event-statistics-java21 + depends_on: + - apicurio + - fights-kafka + ports: + - "8085:8085" + environment: + KAFKA_BOOTSTRAP_SERVERS: PLAINTEXT://fights-kafka:9092 + MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_APICURIO_REGISTRY_URL: http://apicurio:8086/apis/registry/v2 + QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317 + restart: on-failure + networks: + default: + aliases: + - event-statistics + deploy: + resources: + limits: + memory: 1G + cpus: '1' + reservations: + memory: 256M + cpus: '0.5' diff --git a/event-statistics/src/main/docker/Dockerfile.jvm21 b/event-statistics/src/main/docker/Dockerfile.jvm21 new file mode 100644 index 000000000..bee3fb67e --- /dev/null +++ b/event-statistics/src/main/docker/Dockerfile.jvm21 @@ -0,0 +1,92 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode with Java 21 +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/event-statistics-jvm21 . +# +# Then run the container using: +# +# docker run -i --rm -p 8085:8085 quarkus/event-statistics-jvm21 +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8085 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8085:8085 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/event-statistics-jvm21 +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.17 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8085 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/event-statistics/src/main/resources/application.properties b/event-statistics/src/main/resources/application.properties index f6912d403..6cd1345f6 100644 --- a/event-statistics/src/main/resources/application.properties +++ b/event-statistics/src/main/resources/application.properties @@ -29,10 +29,14 @@ quarkus.container-image.builder=docker quarkus.container-image.registry=quay.io quarkus.container-image.group=quarkus-super-heroes quarkus.container-image.name=${quarkus.application.name} +paths.dockerfile.jvm-21=src/main/docker/Dockerfile.jvm21 +paths.base-image.jvm-21=registry.access.redhat.com/ubi9/openjdk-21:1.17 # Kubernetes %kubernetes.quarkus.config.profile.parent=prod %kubernetes.quarkus.kubernetes.deployment-target=kubernetes +%kubernetes-21.quarkus.config.profile.parent=kubernetes +%kubernetes-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.kubernetes.part-of=event-stats quarkus.kubernetes.annotations."app.openshift.io/connects-to"=fights-kafka,apicurio,otel-collector quarkus.kubernetes.env.configmaps=${quarkus.application.name}-config @@ -45,6 +49,10 @@ quarkus.kubernetes.labels.system=quarkus-super-heroes %openshift.quarkus.config.profile.parent=prod %openshift.quarkus.kubernetes.deployment-target=openshift %openshift.quarkus.container-image.builder=openshift +%openshift-21.quarkus.config.profile.parent=openshift +%openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} quarkus.openshift.base-jvm-image=registry.access.redhat.com/ubi9/openjdk-17:1.16 quarkus.openshift.base-native-image=quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0 quarkus.openshift.deployment-kind=deployment @@ -57,6 +65,8 @@ quarkus.openshift.labels.system=${quarkus.kubernetes.labels.system} # Knative %knative.quarkus.config.profile.parent=prod %knative.quarkus.kubernetes.deployment-target=knative +%knative-21.quarkus.config.profile.parent=knative +%knative-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.knative.annotations."app.openshift.io/connects-to"=fights-kafka,apicurio,otel-collector quarkus.knative.labels.app=${quarkus.kubernetes.labels.app} quarkus.knative.labels.application=${quarkus.kubernetes.labels.application} @@ -65,7 +75,13 @@ quarkus.knative.labels.system=${quarkus.kubernetes.labels.system} # Knative on OpenShift %knative-openshift.quarkus.config.profile.parent=knative %knative-openshift.quarkus.container-image.builder=openshift +%knative-openshift-21.quarkus.config.profile.parent=knative-openshift +%knative-openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} # Minikube %minikube.quarkus.config.profile.parent=prod %minikube.quarkus.kubernetes.deployment-target=minikube +%minikube-21.quarkus.config.profile.parent=minikube +%minikube-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} diff --git a/grpc-locations/README.md b/grpc-locations/README.md index 79f743a60..e2ed40183 100644 --- a/grpc-locations/README.md +++ b/grpc-locations/README.md @@ -47,6 +47,7 @@ Pick one of the versions of the application from the table below and execute the | Description | Image Tag | Docker Compose Run Command | |-------------|-----------------|--------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f deploy/docker-compose/java21.yml up --remove-orphans` | | Native | `native-latest` | `docker compose -f deploy/docker-compose/native.yml up --remove-orphans` | These Docker Compose files are meant for standing up this application and the required database only. If you want to stand up the entire system, [follow these instructions](../README.md#running-locally-via-docker-compose). @@ -69,6 +70,7 @@ Pick one of the versions of the application from the table below and deploy the | Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | | Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) | The application is exposed outside of the cluster on port `80`. @@ -81,13 +83,18 @@ Following the [deployment section](https://quarkus.io/guides/deploying-to-kubern > [!NOTE] > For non-OpenShift or minikube Kubernetes variants, you will most likely need to [push the image to a container registry](https://quarkus.io/guides/container-image#pushing) by adding the `-Dquarkus.container-image.push=true` flag, as well as setting the `quarkus.container-image.registry`, `quarkus.container-image.group`, and/or the `quarkus.container-image.name` properties to different values. -| Target Platform | Java Version | Command | -|------------------------|:------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | -| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Target Platform | Java Version | Command | +|------------------------|:------------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Kubernetes | 21 | `./mvnw clean package -Dquarkus.profile=kubernetes-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 21 | `./mvnw clean package -Dquarkus.profile=openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 21 | `./mvnw clean package -Dquarkus.profile=minikube-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 21 | `./mvnw clean package -Dquarkus.profile=knative-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 21 | `./mvnw clean package -Dquarkus.profile=knative-openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | You may need to adjust other configuration options as well (see [Quarkus Kubernetes Extension configuration options](https://quarkus.io/guides/deploying-to-kubernetes#configuration-options) and [Quarkus OpenShift Extension configuration options](https://quarkus.io/guides/deploying-to-openshift#configuration-reference)). diff --git a/grpc-locations/src/main/docker/Dockerfile.jvm21 b/grpc-locations/src/main/docker/Dockerfile.jvm21 new file mode 100644 index 000000000..e47a3ed10 --- /dev/null +++ b/grpc-locations/src/main/docker/Dockerfile.jvm21 @@ -0,0 +1,92 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode with Java 21 +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/grpc-locations-jvm21 . +# +# Then run the container using: +# +# docker run -i --rm -p 8089:8089 quarkus/grpc-locations-jvm21 +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8089 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8089:8089 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/grpc-locations-jvm21 +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.17 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8089 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/grpc-locations/src/main/resources/application.yml b/grpc-locations/src/main/resources/application.yml index 6332883c8..5c57bcab6 100644 --- a/grpc-locations/src/main/resources/application.yml +++ b/grpc-locations/src/main/resources/application.yml @@ -1,3 +1,9 @@ +paths: + dockerfile: + jvm-21: src/main/docker/Dockerfile.jvm21 + base-image: + jvm-21: registry.access.redhat.com/ubi9/openjdk-21:1.17 + quarkus: application: name: grpc-locations @@ -92,6 +98,14 @@ quarkus: kubernetes: deployment-target: kubernetes +"%kubernetes-21": + quarkus: + config: + profile: + parent: kubernetes + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + "%openshift": quarkus: config: @@ -102,6 +116,17 @@ quarkus: kubernetes: deployment-target: openshift +"%openshift-21": + quarkus: + config: + profile: + parent: openshift + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + openshift: + jvm-dockerfile: "${paths.dockerfile.jvm-21}" + base-jvm-image: "${paths.base-image.jvm-21}" + "%knative": quarkus: config: @@ -110,6 +135,14 @@ quarkus: kubernetes: deployment-target: knative +"%knative-21": + quarkus: + config: + profile: + parent: knative + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + "%knative-openshift": quarkus: config: @@ -118,6 +151,17 @@ quarkus: container-image: builder: openshift +"%knative-openshift-21": + quarkus: + config: + profile: + parent: knative-openshift + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + openshift: + jvm-dockerfile: "${paths.dockerfile.jvm-21}" + base-jvm-image: "${paths.base-image.jvm-21}" + "%minikube": quarkus: config: @@ -125,3 +169,11 @@ quarkus: parent: prod kubernetes: deployment-target: minikube + +"%minikube-21": + quarkus: + config: + profile: + parent: minikube + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" diff --git a/rest-fights/README.md b/rest-fights/README.md index 3aaaab6a5..ee9013cbb 100644 --- a/rest-fights/README.md +++ b/rest-fights/README.md @@ -186,6 +186,7 @@ Pick one of the versions of the application from the table below and execute the | Description | Image Tag | Docker Compose Run Command | |-------------|-----------------|--------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17.yml up --remove-orphans` | +| JVM Java 21 | `java17-latest` | `docker compose -f deploy/docker-compose/java21.yml up --remove-orphans` | | Native | `native-latest` | `docker compose -f deploy/docker-compose/native.yml up --remove-orphans` | ### Fights Service and all Downstream Dependencies @@ -197,6 +198,7 @@ The above Docker Compose files are meant for standing up this application and th | Description | Image Tag | Docker Compose Run Command | |-------------|-----------------|-----------------------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17-all-downstream.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f deploy/docker-compose/java21-all-downstream.yml up --remove-orphans` | | Native | `native-latest` | `docker compose -f deploy/docker-compose/native-all-downstream.yml up --remove-orphans` | ### Only Downstream Dependencies @@ -205,10 +207,11 @@ If you want to develop the Fights service (i.e. via [Quarkus Dev Mode](https://q > [!NOTE] > You may see errors as the applications start up. This may happen if an application completes startup before one if its required services (i.e. database, kafka, etc). This is fine. Once everything completes startup things will work fine. -| Description | Image Tag | Docker Compose Run Command | -|-------------|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| JVM Java 17 | `java17-latest` | `docker compose -f rest-heroes/deploy/docker-compose/java17.yml -f rest-villains/deploy/docker-compose/java17.yml -f rest-narration/deploy/docker-compose/java17.yml -f grpc-locations/deploy/docker-compose/java17.yml up --remove-orphans` | -| Native | `native-latest` | `docker compose -f rest-heroes/deploy/docker-compose/native.yml -f rest-villains/deploy/docker-compose/native.yml -f rest-narration/deploy/docker-compose/native.yml -f grpc-locations/deploy/docker-compose/java17.yml up --remove-orphans` | +| Description | Image Tag | Docker Compose Run Command | +|-------------|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| JVM Java 17 | `java17-latest` | `docker compose -f rest-heroes/deploy/docker-compose/java17.yml -f rest-villains/deploy/docker-compose/java17.yml -f rest-narration/deploy/docker-compose/java17.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f rest-heroes/deploy/docker-compose/java21.yml -f rest-villains/deploy/docker-compose/java21.yml -f rest-narration/deploy/docker-compose/java21.yml up --remove-orphans` | +| Native | `native-latest` | `docker compose -f rest-heroes/deploy/docker-compose/native.yml -f rest-villains/deploy/docker-compose/native.yml -f rest-narration/deploy/docker-compose/native.yml up --remove-orphans` | If you want to stand up the entire system, [follow these instructions](../README.md#running-locally-via-docker-compose). @@ -230,6 +233,7 @@ Pick one of the versions of the application from the table below and deploy the | Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | | Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) | The application is exposed outside of the cluster on port `80`. @@ -239,6 +243,7 @@ These are only the descriptors for this application and the required database, K | Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | |-------------|-----------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift-all-downstream.yml`](deploy/k8s/java17-openshift-all-downstream.yml) | [`java17-minikube-all-downstream.yml`](deploy/k8s/java17-minikube-all-downstream.yml) | [`java17-kubernetes-all-downstream.yml`](deploy/k8s/java17-kubernetes-all-downstream.yml) | [`java17-knative-all-downstream.yml`](deploy/k8s/java17-knative-all-downstream.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift-all-downstream.yml`](deploy/k8s/java21-openshift-all-downstream.yml) | [`java21-minikube-all-downstream.yml`](deploy/k8s/java21-minikube-all-downstream.yml) | [`java21-kubernetes-all-downstream.yml`](deploy/k8s/java21-kubernetes-all-downstream.yml) | [`java21-knative-all-downstream.yml`](deploy/k8s/java21-knative-all-downstream.yml) | | Native | `native-latest` | [`native-openshift-all-downstream.yml`](deploy/k8s/native-openshift-all-downstream.yml) | [`native-minikube-all-downstream.yml`](deploy/k8s/native-minikube-all-downstream.yml) | [`native-kubernetes-all-downstream.yml`](deploy/k8s/native-kubernetes-all-downstream.yml) | [`native-knative-all-downstream.yml`](deploy/k8s/native-knative-all-downstream.yml) | Each application is exposed outside of the cluster on port `80`. @@ -251,13 +256,18 @@ Following the [deployment section](https://quarkus.io/guides/deploying-to-kubern > [!NOTE] > For non-OpenShift or minikube Kubernetes variants, you will most likely need to [push the image to a container registry](https://quarkus.io/guides/container-image#pushing) by adding the `-Dquarkus.container-image.push=true` flag, as well as setting the `quarkus.container-image.registry`, `quarkus.container-image.group`, and/or the `quarkus.container-image.name` properties to different values. -| Target Platform | Java Version | Command | -|------------------------|:------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | -| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Target Platform | Java Version | Command | +|------------------------|:------------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Kubernetes | 21 | `./mvnw clean package -Dquarkus.profile=kubernetes-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 21 | `./mvnw clean package -Dquarkus.profile=openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 21 | `./mvnw clean package -Dquarkus.profile=minikube-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 21 | `./mvnw clean package -Dquarkus.profile=knative-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 21 | `./mvnw clean package -Dquarkus.profile=knative-openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | You may need to adjust other configuration options as well (see [Quarkus Kubernetes Extension configuration options](https://quarkus.io/guides/deploying-to-kubernetes#configuration-options) and [Quarkus OpenShift Extension configuration options](https://quarkus.io/guides/deploying-to-openshift#configuration-reference)). diff --git a/rest-fights/src/main/docker-compose/java21.yml b/rest-fights/src/main/docker-compose/java21.yml new file mode 100644 index 000000000..73d618f75 --- /dev/null +++ b/rest-fights/src/main/docker-compose/java21.yml @@ -0,0 +1,37 @@ + + rest-fights-java21: + image: quay.io/quarkus-super-heroes/rest-fights:java21-latest + container_name: rest-fights-java21 + depends_on: + - fights-db + - apicurio + - fights-kafka + - rest-heroes-java21 + - rest-villains-java21 + - rest-narration-java21 + ports: + - "8082:8082" + environment: + QUARKUS_MONGODB_HOSTS: fights-db:27017 + KAFKA_BOOTSTRAP_SERVERS: PLAINTEXT://fights-kafka:9092 + QUARKUS_LIQUIBASE_MONGODB_MIGRATE_AT_START: "false" + QUARKUS_MONGODB_CREDENTIALS_USERNAME: superfight + QUARKUS_MONGODB_CREDENTIALS_PASSWORD: superfight + QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-heroes:8083 + QUARKUS_STORK_VILLAIN_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-villains:8084 + QUARKUS_STORK_NARRATION_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-narration:8087 + MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_APICURIO_REGISTRY_URL: http://apicurio:8086/apis/registry/v2 + QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317 + restart: on-failure + networks: + default: + aliases: + - rest-fights + deploy: + resources: + limits: + memory: 1G + cpus: '1' + reservations: + memory: 256M + cpus: '0.5' diff --git a/rest-fights/src/main/docker/Dockerfile.jvm21 b/rest-fights/src/main/docker/Dockerfile.jvm21 new file mode 100644 index 000000000..7d0d346e6 --- /dev/null +++ b/rest-fights/src/main/docker/Dockerfile.jvm21 @@ -0,0 +1,92 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode with Java 21 +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/rest-fights-jvm21 . +# +# Then run the container using: +# +# docker run -i --rm -p 8082:8082 quarkus/rest-fights-jvm21 +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8082 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8082:8082 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/rest-fights-jvm21 +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.17 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8082 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/rest-fights/src/main/resources/application.properties b/rest-fights/src/main/resources/application.properties index b01b0626e..2215cd96a 100644 --- a/rest-fights/src/main/resources/application.properties +++ b/rest-fights/src/main/resources/application.properties @@ -99,12 +99,16 @@ quarkus.container-image.builder=docker quarkus.container-image.registry=quay.io quarkus.container-image.group=quarkus-super-heroes quarkus.container-image.name=${quarkus.application.name} +paths.dockerfile.jvm-21=src/main/docker/Dockerfile.jvm21 +paths.base-image.jvm-21=registry.access.redhat.com/ubi9/openjdk-21:1.17 # Kubernetes quarkus.kubernetes-client.devservices.enabled=false quarkus.kubernetes-client.generate-rbac=false %kubernetes.quarkus.config.profile.parent=prod %kubernetes.quarkus.kubernetes.deployment-target=kubernetes +%kubernetes-21.quarkus.config.profile.parent=kubernetes +%kubernetes-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.kubernetes.part-of=fights-service quarkus.kubernetes.externalize-init=false quarkus.kubernetes.env.configmaps=${quarkus.application.name}-config @@ -118,6 +122,10 @@ quarkus.kubernetes.labels.system=quarkus-super-heroes %openshift.quarkus.config.profile.parent=prod %openshift.quarkus.kubernetes.deployment-target=openshift %openshift.quarkus.container-image.builder=openshift +%openshift-21.quarkus.config.profile.parent=openshift +%openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} quarkus.openshift.base-jvm-image=registry.access.redhat.com/ubi9/openjdk-17:1.16 quarkus.openshift.base-native-image=quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0 quarkus.openshift.deployment-kind=deployment @@ -130,6 +138,8 @@ quarkus.openshift.labels.system=${quarkus.kubernetes.labels.system} # Knative %knative.quarkus.config.profile.parent=prod %knative.quarkus.kubernetes.deployment-target=knative +%knative-21.quarkus.config.profile.parent=knative +%knative-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.knative.min-scale=1 quarkus.knative.annotations."app.openshift.io/connects-to"=fights-db,fights-kafka,apicurio,rest-villains,rest-heroes,rest-narration,grpc-locations,otel-collector quarkus.knative.labels.app=${quarkus.kubernetes.labels.app} @@ -139,7 +149,13 @@ quarkus.knative.labels.system=${quarkus.kubernetes.labels.system} # Knative on OpenShift %knative-openshift.quarkus.config.profile.parent=knative %knative-openshift.quarkus.container-image.builder=openshift +%knative-openshift-21.quarkus.config.profile.parent=knative-openshift +%knative-openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} # Minikube %minikube.quarkus.config.profile.parent=prod %minikube.quarkus.kubernetes.deployment-target=minikube +%minikube-21.quarkus.config.profile.parent=minikube +%minikube-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} diff --git a/rest-heroes/README.md b/rest-heroes/README.md index 00ef1bf91..58136b05a 100644 --- a/rest-heroes/README.md +++ b/rest-heroes/README.md @@ -81,7 +81,7 @@ The application also contains a simple UI, showing the list of Heroes currently ## Running Locally via Docker Compose Pre-built images for this application can be found at [`quay.io/quarkus-super-heroes/rest-heroes`](https://quay.io/repository/quarkus-super-heroes/rest-heroes?tab=tags). -Pick one of the 4 versions of the application from the table below and execute the appropriate docker compose command from the `quarkus-super-heroes/rest-heroes` directory. +Pick one of the versions of the application from the table below and execute the appropriate docker compose command from the `quarkus-super-heroes/rest-heroes` directory. > [!NOTE] > You may see errors as the applications start up. This may happen if an application completes startup before one if its required services (i.e. database, kafka, etc). This is fine. Once everything completes startup things will work fine. @@ -89,6 +89,7 @@ Pick one of the 4 versions of the application from the table below and execute t | Description | Image Tag | Docker Compose Run Command | |-------------|-----------------|--------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f deploy/docker-compose/java21.yml up --remove-orphans` | | Native | `native-latest` | `docker compose -f deploy/docker-compose/native.yml up --remove-orphans` | These Docker Compose files are meant for standing up this application and the required database only. If you want to stand up the entire system, [follow these instructions](../README.md#running-locally-via-docker-compose). @@ -106,11 +107,12 @@ Deployment descriptors for these images are provided in the [`deploy/k8s`](deplo > [!NOTE] > The [Knative](https://knative.dev/docs/) variant can be used on any Knative installation that runs on top of Kubernetes or OpenShift. For OpenShift, you need [OpenShift Serverless](https://docs.openshift.com/serverless/latest/about/about-serverless.html) installed from the OpenShift operator catalog. Using Knative has the benefit that services are scaled down to zero replicas when they are not used. -Pick one of the 4 versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). +Pick one of the versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). -| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | +| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | KNative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | | Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) | The application is exposed outside of the cluster on port `80`. @@ -123,13 +125,18 @@ Following the [deployment section](https://quarkus.io/guides/deploying-to-kubern > [!NOTE] > For non-OpenShift or minikube Kubernetes variants, you will most likely need to [push the image to a container registry](https://quarkus.io/guides/container-image#pushing) by adding the `-Dquarkus.container-image.push=true` flag, as well as setting the `quarkus.container-image.registry`, `quarkus.container-image.group`, and/or the `quarkus.container-image.name` properties to different values. -| Target Platform | Java Version | Command | -|------------------------|:------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | -| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Target Platform | Java Version | Command | +|------------------------|:------------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Kubernetes | 21 | `./mvnw clean package -Dquarkus.profile=kubernetes-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 21 | `./mvnw clean package -Dquarkus.profile=openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 21 | `./mvnw clean package -Dquarkus.profile=minikube-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 21 | `./mvnw clean package -Dquarkus.profile=knative-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 21 | `./mvnw clean package -Dquarkus.profile=knative-openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | You may need to adjust other configuration options as well (see [Quarkus Kubernetes Extension configuration options](https://quarkus.io/guides/deploying-to-kubernetes#configuration-options) and [Quarkus OpenShift Extension configuration options](https://quarkus.io/guides/deploying-to-openshift#configuration-reference)). diff --git a/rest-heroes/src/main/docker-compose/java21.yml b/rest-heroes/src/main/docker-compose/java21.yml new file mode 100644 index 000000000..e9e3dd9fb --- /dev/null +++ b/rest-heroes/src/main/docker-compose/java21.yml @@ -0,0 +1,28 @@ + + rest-heroes-java21: + image: quay.io/quarkus-super-heroes/rest-heroes:java21-latest + container_name: rest-heroes-java21 + depends_on: + - heroes-db + ports: + - "8083:8083" + environment: + QUARKUS_DATASOURCE_REACTIVE_URL: postgresql://heroes-db:5432/heroes_database + QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION: validate + QUARKUS_DATASOURCE_USERNAME: superman + QUARKUS_DATASOURCE_PASSWORD: superman + QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT: no-file + QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317 + restart: on-failure + networks: + default: + aliases: + - rest-heroes + deploy: + resources: + limits: + memory: 1G + cpus: '1' + reservations: + memory: 256M + cpus: '0.5' diff --git a/rest-heroes/src/main/docker/Dockerfile.jvm21 b/rest-heroes/src/main/docker/Dockerfile.jvm21 new file mode 100644 index 000000000..932421973 --- /dev/null +++ b/rest-heroes/src/main/docker/Dockerfile.jvm21 @@ -0,0 +1,92 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode with Java 21 +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/rest-heroes-jvm21 . +# +# Then run the container using: +# +# docker run -i --rm -p 8083:8083 quarkus/rest-heroes-jvm21 +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8083 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8083:8083 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/rest-heroes-jvm21 +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.17 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8083 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/rest-heroes/src/main/resources/application.yml b/rest-heroes/src/main/resources/application.yml index 0c50050e3..0f2a23b4a 100644 --- a/rest-heroes/src/main/resources/application.yml +++ b/rest-heroes/src/main/resources/application.yml @@ -1,3 +1,9 @@ +paths: + dockerfile: + jvm-21: src/main/docker/Dockerfile.jvm21 + base-image: + jvm-21: registry.access.redhat.com/ubi9/openjdk-21:1.17 + quarkus: application: name: rest-heroes @@ -92,6 +98,14 @@ quarkus: kubernetes: deployment-target: kubernetes +"%kubernetes-21": + quarkus: + config: + profile: + parent: kubernetes + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + "%openshift": quarkus: config: @@ -102,6 +116,17 @@ quarkus: kubernetes: deployment-target: openshift +"%openshift-21": + quarkus: + config: + profile: + parent: openshift + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + openshift: + jvm-dockerfile: "${paths.dockerfile.jvm-21}" + base-jvm-image: "${paths.base-image.jvm-21}" + "%knative": quarkus: config: @@ -110,6 +135,14 @@ quarkus: kubernetes: deployment-target: knative +"%knative-21": + quarkus: + config: + profile: + parent: knative + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + "%knative-openshift": quarkus: config: @@ -118,6 +151,17 @@ quarkus: container-image: builder: openshift +"%knative-openshift-21": + quarkus: + config: + profile: + parent: knative-openshift + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" + openshift: + jvm-dockerfile: "${paths.dockerfile.jvm-21}" + base-jvm-image: "${paths.base-image.jvm-21}" + "%minikube": quarkus: config: @@ -125,3 +169,11 @@ quarkus: parent: prod kubernetes: deployment-target: minikube + +"%minikube-21": + quarkus: + config: + profile: + parent: minikube + docker: + dockerfile-jvm-path: "${paths.dockerfile.jvm-21}" diff --git a/rest-narration/README.md b/rest-narration/README.md index 5c0c64cf5..dd4016bd7 100644 --- a/rest-narration/README.md +++ b/rest-narration/README.md @@ -116,9 +116,10 @@ Deployment descriptors for these images are provided in the [`deploy/k8s`](deplo Pick one of the versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). -| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | +| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | KNative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | [//]: # (| Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) |) @@ -132,13 +133,18 @@ Following the [deployment section](https://quarkus.io/guides/deploying-to-kubern > [!NOTE] > For non-OpenShift or minikube Kubernetes variants, you will most likely need to [push the image to a container registry](https://quarkus.io/guides/container-image#pushing) by adding the `-Dquarkus.container-image.push=true` flag, as well as setting the `quarkus.container-image.registry`, `quarkus.container-image.group`, and/or the `quarkus.container-image.name` properties to different values. -| Target Platform | Java Version | Command | -|------------------------|:------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | -| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Target Platform | Java Version | Command | +|------------------------|:------------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Kubernetes | 21 | `./mvnw clean package -Dquarkus.profile=kubernetes-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 21 | `./mvnw clean package -Dquarkus.profile=openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 21 | `./mvnw clean package -Dquarkus.profile=minikube-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 21 | `./mvnw clean package -Dquarkus.profile=knative-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 21 | `./mvnw clean package -Dquarkus.profile=knative-openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | You may need to adjust other configuration options as well (see [Quarkus Kubernetes Extension configuration options](https://quarkus.io/guides/deploying-to-kubernetes#configuration-options) and [Quarkus OpenShift Extension configuration options](https://quarkus.io/guides/deploying-to-openshift#configuration-reference)). diff --git a/rest-narration/src/main/docker-compose/java21.yml b/rest-narration/src/main/docker-compose/java21.yml new file mode 100644 index 000000000..5a8013f41 --- /dev/null +++ b/rest-narration/src/main/docker-compose/java21.yml @@ -0,0 +1,21 @@ + + rest-narration-java21: + image: quay.io/quarkus-super-heroes/rest-narration:java21-latest + container_name: rest-narration-java21 + ports: + - "8087:8087" + environment: + QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317 + restart: on-failure + networks: + default: + aliases: + - rest-narration + deploy: + resources: + limits: + memory: 1G + cpus: '1' + reservations: + memory: 256M + cpus: '0.5' diff --git a/rest-narration/src/main/docker/Dockerfile.jvm21 b/rest-narration/src/main/docker/Dockerfile.jvm21 new file mode 100644 index 000000000..ad17fb0bc --- /dev/null +++ b/rest-narration/src/main/docker/Dockerfile.jvm21 @@ -0,0 +1,92 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode with Java 21 +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/rest-narration-jvm21 . +# +# Then run the container using: +# +# docker run -i --rm -p 8087:8087 quarkus/rest-narration-jvm21 +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8087 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8087:8087 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/rest-narration-jvm21 +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.17 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8087 +USER 185 +ENV JAVA_OPTS_APPPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/rest-narration/src/main/resources/application.properties b/rest-narration/src/main/resources/application.properties index 733e56043..cfce873a2 100644 --- a/rest-narration/src/main/resources/application.properties +++ b/rest-narration/src/main/resources/application.properties @@ -39,10 +39,14 @@ quarkus.container-image.builder=docker quarkus.container-image.registry=quay.io quarkus.container-image.group=quarkus-super-heroes quarkus.container-image.name=${quarkus.application.name} +paths.dockerfile.jvm-21=src/main/docker/Dockerfile.jvm21 +paths.base-image.jvm-21=registry.access.redhat.com/ubi9/openjdk-21:1.17 # Kubernetes %kubernetes.quarkus.config.profile.parent=prod %kubernetes.quarkus.kubernetes.deployment-target=kubernetes +%kubernetes-21.quarkus.config.profile.parent=kubernetes +%kubernetes-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.kubernetes.part-of=narration-service quarkus.kubernetes.annotations."app.openshift.io/connects-to"=otel-collector quarkus.kubernetes.env.configmaps=${quarkus.application.name}-config @@ -54,6 +58,10 @@ quarkus.kubernetes.labels.system=quarkus-super-heroes %openshift.quarkus.config.profile.parent=prod %openshift.quarkus.kubernetes.deployment-target=openshift %openshift.quarkus.container-image.builder=openshift +%openshift-21.quarkus.config.profile.parent=openshift +%openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} quarkus.openshift.base-jvm-image=registry.access.redhat.com/ubi9/openjdk-17:1.16 quarkus.openshift.base-native-image=quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0 quarkus.openshift.deployment-kind=deployment @@ -66,6 +74,8 @@ quarkus.openshift.labels.system=${quarkus.kubernetes.labels.system} # Knative %knative.quarkus.config.profile.parent=prod %knative.quarkus.kubernetes.deployment-target=knative +%knative-21.quarkus.config.profile.parent=knative +%knative-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.knative.annotations."app.openshift.io/connects-to"=otel-collector quarkus.knative.labels.app=${quarkus.kubernetes.labels.app} quarkus.knative.labels.application=${quarkus.kubernetes.labels.application} @@ -74,7 +84,13 @@ quarkus.knative.labels.system=${quarkus.kubernetes.labels.system} # Knative on OpenShift %knative-openshift.quarkus.config.profile.parent=knative %knative-openshift.quarkus.container-image.builder=openshift +%knative-openshift-21.quarkus.config.profile.parent=knative-openshift +%knative-openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} # Minikube %minikube.quarkus.config.profile.parent=prod %minikube.quarkus.kubernetes.deployment-target=minikube +%minikube-21.quarkus.config.profile.parent=minikube +%minikube-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} diff --git a/rest-villains/README.md b/rest-villains/README.md index e80182a4e..56dada180 100644 --- a/rest-villains/README.md +++ b/rest-villains/README.md @@ -79,7 +79,7 @@ The application also contains a simple UI, showing the list of Villains currentl ## Running Locally via Docker Compose Pre-built images for this application can be found at [`quay.io/quarkus-super-heroes/rest-villains`](https://quay.io/repository/quarkus-super-heroes/rest-villains?tab=tags). -Pick one of the 4 versions of the application from the table below and execute the appropriate docker compose command from the `quarkus-super-heroes/rest-villains` directory. +Pick one of the versions of the application from the table below and execute the appropriate docker compose command from the `quarkus-super-heroes/rest-villains` directory. > [!NOTE] > You may see errors as the applications start up. This may happen if an application completes startup before one if its required services (i.e. database, kafka, etc). This is fine. Once everything completes startup things will work fine. @@ -87,6 +87,7 @@ Pick one of the 4 versions of the application from the table below and execute t | Description | Image Tag | Docker Compose Run Command | |-------------|-----------------|--------------------------------------------------------------------------| | JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f deploy/docker-compose/java21.yml up --remove-orphans` | | Native | `native-latest` | `docker compose -f deploy/docker-compose/native.yml up --remove-orphans` | These Docker Compose files are meant for standing up this application and the required database only. If you want to stand up the entire system, [follow these instructions](../README.md#running-locally-via-docker-compose). @@ -104,11 +105,12 @@ Deployment descriptors for these images are provided in the [`deploy/k8s`](deplo > [!NOTE] > The [Knative](https://knative.dev/docs/) variant can be used on any Knative installation that runs on top of Kubernetes or OpenShift. For OpenShift, you need [OpenShift Serverless](https://docs.openshift.com/serverless/latest/about/about-serverless.html) installed from the OpenShift operator catalog. Using Knative has the benefit that services are scaled down to zero replicas when they are not used. -Pick one of the 4 versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). +Pick one of the versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). -| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | +| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | KNative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | | Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) | The application is exposed outside of the cluster on port `80`. @@ -121,13 +123,18 @@ Following the [deployment section](https://quarkus.io/guides/deploying-to-kubern > [!NOTE] > For non-OpenShift or minikube Kubernetes variants, you will most likely need to [push the image to a container registry](https://quarkus.io/guides/container-image#pushing) by adding the `-Dquarkus.container-image.push=true` flag, as well as setting the `quarkus.container-image.registry`, `quarkus.container-image.group`, and/or the `quarkus.container-image.name` properties to different values. -| Target Platform | Java Version | Command | -|------------------------|:------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | -| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Target Platform | Java Version | Command | +|------------------------|:------------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Kubernetes | 21 | `./mvnw clean package -Dquarkus.profile=kubernetes-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 21 | `./mvnw clean package -Dquarkus.profile=openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 21 | `./mvnw clean package -Dquarkus.profile=minikube-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 21 | `./mvnw clean package -Dquarkus.profile=knative-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 21 | `./mvnw clean package -Dquarkus.profile=knative-openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | You may need to adjust other configuration options as well (see [Quarkus Kubernetes Extension configuration options](https://quarkus.io/guides/deploying-to-kubernetes#configuration-options) and [Quarkus OpenShift Extension configuration options](https://quarkus.io/guides/deploying-to-openshift#configuration-reference)). diff --git a/rest-villains/src/main/docker-compose/java21.yml b/rest-villains/src/main/docker-compose/java21.yml new file mode 100644 index 000000000..9a65b00e8 --- /dev/null +++ b/rest-villains/src/main/docker-compose/java21.yml @@ -0,0 +1,28 @@ + + rest-villains-java21: + image: quay.io/quarkus-super-heroes/rest-villains:java21-latest + container_name: rest-villains-java21 + depends_on: + - villains-db + ports: + - "8084:8084" + environment: + QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://villains-db:5432/villains_database + QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION: validate + QUARKUS_DATASOURCE_USERNAME: superbad + QUARKUS_DATASOURCE_PASSWORD: superbad + QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT: no-file + QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317 + restart: on-failure + networks: + default: + aliases: + - rest-villains + deploy: + resources: + limits: + memory: 1G + cpus: '1' + reservations: + memory: 256M + cpus: '0.5' diff --git a/rest-villains/src/main/docker/Dockerfile.jvm21 b/rest-villains/src/main/docker/Dockerfile.jvm21 new file mode 100644 index 000000000..17184e64f --- /dev/null +++ b/rest-villains/src/main/docker/Dockerfile.jvm21 @@ -0,0 +1,92 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode with Java 21 +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/rest-villains-jvm21 . +# +# Then run the container using: +# +# docker run -i --rm -p 8084:8084 quarkus/rest-villains-jvm21 +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8084 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8084:8084 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/rest-villains-jvm21 +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.17 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8084 +USER 185 +ENV JAVA_OPTS_APPPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/rest-villains/src/main/resources/application.properties b/rest-villains/src/main/resources/application.properties index 098fcc05d..331fa05f2 100644 --- a/rest-villains/src/main/resources/application.properties +++ b/rest-villains/src/main/resources/application.properties @@ -46,10 +46,14 @@ quarkus.container-image.builder=docker quarkus.container-image.registry=quay.io quarkus.container-image.group=quarkus-super-heroes quarkus.container-image.name=${quarkus.application.name} +paths.dockerfile.jvm-21=src/main/docker/Dockerfile.jvm21 +paths.base-image.jvm-21=registry.access.redhat.com/ubi9/openjdk-21:1.17 # Kubernetes %kubernetes.quarkus.config.profile.parent=prod %kubernetes.quarkus.kubernetes.deployment-target=kubernetes +%kubernetes-21.quarkus.config.profile.parent=kubernetes +%kubernetes-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.kubernetes.part-of=villains-service quarkus.kubernetes.annotations."app.openshift.io/connects-to"=villains-db,otel-collector quarkus.kubernetes.env.configmaps=${quarkus.application.name}-config @@ -62,6 +66,10 @@ quarkus.kubernetes.labels.system=quarkus-super-heroes %openshift.quarkus.config.profile.parent=prod %openshift.quarkus.kubernetes.deployment-target=openshift %openshift.quarkus.container-image.builder=openshift +%openshift-21.quarkus.config.profile.parent=openshift +%openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} quarkus.openshift.base-jvm-image=registry.access.redhat.com/ubi9/openjdk-17:1.16 quarkus.openshift.base-native-image=quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0 quarkus.openshift.deployment-kind=deployment @@ -74,6 +82,8 @@ quarkus.openshift.labels.system=${quarkus.kubernetes.labels.system} # Knative %knative.quarkus.config.profile.parent=prod %knative.quarkus.kubernetes.deployment-target=knative +%knative-21.quarkus.config.profile.parent=knative +%knative-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.knative.annotations."app.openshift.io/connects-to"=villains-db,otel-collector quarkus.knative.labels.app=${quarkus.kubernetes.labels.app} quarkus.knative.labels.application=${quarkus.kubernetes.labels.application} @@ -82,7 +92,13 @@ quarkus.knative.labels.system=${quarkus.kubernetes.labels.system} # Knative on OpenShift %knative-openshift.quarkus.config.profile.parent=knative %knative-openshift.quarkus.container-image.builder=openshift +%knative-openshift-21.quarkus.config.profile.parent=knative-openshift +%knative-openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} # Minikube %minikube.quarkus.config.profile.parent=prod %minikube.quarkus.kubernetes.deployment-target=minikube +%minikube-21.quarkus.config.profile.parent=minikube +%minikube-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} diff --git a/scripts/generate-docker-compose-resources.sh b/scripts/generate-docker-compose-resources.sh index a533b2a7a..331426a4f 100755 --- a/scripts/generate-docker-compose-resources.sh +++ b/scripts/generate-docker-compose-resources.sh @@ -162,10 +162,10 @@ do do # Keeping this if/else here for the future when we might want to build multiple java versions if [[ "$kind" == "native-" ]]; then - javaVersions=(17) + javaVersions=(21) else - javaVersions=(17) - # javaVersions=(11 17) +# javaVersions=(17) + javaVersions=(17 21) fi for javaVersion in ${javaVersions[@]} diff --git a/scripts/generate-k8s-resources.sh b/scripts/generate-k8s-resources.sh index 6fb8ec5fe..b55801654 100755 --- a/scripts/generate-k8s-resources.sh +++ b/scripts/generate-k8s-resources.sh @@ -163,13 +163,13 @@ for kind in "" "native-" do # Keeping this if/else here for the future when we might want to build multiple java versions if [[ "$kind" == "native-" ]]; then - javaVersions=(17) + javaVersions=(21) # Until https://github.com/microsoft/semantic-kernel/issues/2885 is resolved projects=("grpc-locations" "rest-villains" "rest-heroes" "rest-fights" "event-statistics" "ui-super-heroes") else - javaVersions=(17) +# javaVersions=(17) projects=("grpc-locations" "rest-narration" "rest-villains" "rest-heroes" "rest-fights" "event-statistics" "ui-super-heroes") -# javaVersions=(11 17) + javaVersions=(17 21) fi for javaVersion in "${javaVersions[@]}" diff --git a/ui-super-heroes/README.md b/ui-super-heroes/README.md index a1ad74bf6..34d0146b6 100644 --- a/ui-super-heroes/README.md +++ b/ui-super-heroes/README.md @@ -69,21 +69,18 @@ docker run -p 8080:8080 -e API_BASE_URL=http://localhost:8082 quay.io/quarkus-su ## Running Locally via Docker Compose Pre-built images for this application can be found at [`quay.io/quarkus-super-heroes/ui-super-heroes`](https://quay.io/repository/quarkus-super-heroes/ui-super-heroes?tab=tags). -The application can be started outside of docker compose simply with `docker run -p 8080:8080 quay.io/quarkus-super-heroes/ui-super-heroes:latest`. +Pick one of the versions of the application from the table below and execute the appropriate docker compose command from the `quarkus-super-heroes/ui-super-heroes` directory. -If you want to use docker compose, from the `quarkus-super-heroes/ui-super-heroes` directory run: + > [!NOTE] + > You may see errors as the applications start up. This may happen if an application completes startup before one if its required services (i.e. database, kafka, etc). This is fine. Once everything completes startup things will work fine. -```bash -docker-compose -f deploy/docker-compose/java17.yml up -``` - -or - -```bash -docker-compose -f deploy/docker-compose/native.yml up -``` +| Description | Image Tag | Docker Compose Run Command | +|-------------|-----------------|--------------------------------------------------------------------------| +| JVM Java 17 | `java17-latest` | `docker compose -f deploy/docker-compose/java17.yml up --remove-orphans` | +| JVM Java 21 | `java21-latest` | `docker compose -f deploy/docker-compose/java21.yml up --remove-orphans` | +| Native | `native-latest` | `docker compose -f deploy/docker-compose/native.yml up --remove-orphans` | -If you want to stand up the entire system, [follow these instructions](../README.md#running-locally-via-docker-compose). +These Docker Compose files are meant for standing up this application and the required database only. If you want to stand up the entire system, [follow these instructions](../README.md#running-locally-via-docker-compose). Once started the application will be exposed at `http://localhost:8080`. @@ -98,11 +95,12 @@ Deployment descriptors for these images are provided in the [`deploy/k8s`](deplo > [!NOTE] > The [Knative](https://knative.dev/docs/) variant can be used on any Knative installation that runs on top of Kubernetes or OpenShift. For OpenShift, you need [OpenShift Serverless](https://docs.openshift.com/serverless/latest/about/about-serverless.html) installed from the OpenShift operator catalog. Using Knative has the benefit that services are scaled down to zero replicas when they are not used. -Pick one of the 4 versions of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). +Pick one of the java21 of the application from the table below and deploy the appropriate descriptor from the [`deploy/k8s` directory](deploy/k8s). -| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | Knative Descriptor | +| Description | Image Tag | OpenShift Descriptor | Minikube Descriptor | Kubernetes Descriptor | KNative Descriptor | |-------------|-----------------|-----------------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | JVM Java 17 | `java17-latest` | [`java17-openshift.yml`](deploy/k8s/java17-openshift.yml) | [`java17-minikube.yml`](deploy/k8s/java17-minikube.yml) | [`java17-kubernetes.yml`](deploy/k8s/java17-kubernetes.yml) | [`java17-knative.yml`](deploy/k8s/java17-knative.yml) | +| JVM Java 21 | `java21-latest` | [`java21-openshift.yml`](deploy/k8s/java21-openshift.yml) | [`java21-minikube.yml`](deploy/k8s/java21-minikube.yml) | [`java21-kubernetes.yml`](deploy/k8s/java21-kubernetes.yml) | [`java21-knative.yml`](deploy/k8s/java21-knative.yml) | | Native | `native-latest` | [`native-openshift.yml`](deploy/k8s/native-openshift.yml) | [`native-minikube.yml`](deploy/k8s/native-minikube.yml) | [`native-kubernetes.yml`](deploy/k8s/native-kubernetes.yml) | [`native-knative.yml`](deploy/k8s/native-knative.yml) | The application is exposed outside of the cluster on port `80`. @@ -115,13 +113,18 @@ Following the [deployment section](https://quarkus.io/guides/deploying-to-kubern > [!NOTE] > For non-OpenShift or minikube Kubernetes variants, you will most likely need to [push the image to a container registry](https://quarkus.io/guides/container-image#pushing) by adding the `-Dquarkus.container-image.push=true` flag, as well as setting the `quarkus.container-image.registry`, `quarkus.container-image.group`, and/or the `quarkus.container-image.name` properties to different values. -| Target Platform | Java Version | Command | -|------------------------|:------------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | -| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | -| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Target Platform | Java Version | Command | +|------------------------|:------------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Kubernetes | 17 | `./mvnw clean package -Dquarkus.profile=kubernetes -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Kubernetes | 21 | `./mvnw clean package -Dquarkus.profile=kubernetes-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 17 | `./mvnw clean package -Dquarkus.profile=openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| OpenShift | 21 | `./mvnw clean package -Dquarkus.profile=openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 17 | `./mvnw clean package -Dquarkus.profile=minikube -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Minikube | 21 | `./mvnw clean package -Dquarkus.profile=minikube-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 17 | `./mvnw clean package -Dquarkus.profile=knative -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative | 21 | `./mvnw clean package -Dquarkus.profile=knative-21 -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 17 | `./mvnw clean package -Dquarkus.profile=knative-openshift -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | +| Knative (on OpenShift) | 21 | `./mvnw clean package -Dquarkus.profile=knative-openshift-21 -Dquarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000 -Dquarkus.container-image.group=$(oc project -q) -Dquarkus.kubernetes.deploy=true -DskipTests` | You may need to adjust other configuration options as well (see [Quarkus Kubernetes Extension configuration options](https://quarkus.io/guides/deploying-to-kubernetes#configuration-options) and [Quarkus OpenShift Extension configuration options](https://quarkus.io/guides/deploying-to-openshift#configuration-reference)). diff --git a/ui-super-heroes/src/main/docker-compose/java17.yml b/ui-super-heroes/src/main/docker-compose/java17.yml index 0b0370423..5acd968dc 100644 --- a/ui-super-heroes/src/main/docker-compose/java17.yml +++ b/ui-super-heroes/src/main/docker-compose/java17.yml @@ -1,7 +1,7 @@ ui-super-heroes-java17: image: quay.io/quarkus-super-heroes/ui-super-heroes:java17-latest - container_name: ui-super-heroes + container_name: ui-super-heroes-java17 ports: - "8080:8080" restart: on-failure diff --git a/ui-super-heroes/src/main/docker-compose/java21.yml b/ui-super-heroes/src/main/docker-compose/java21.yml new file mode 100644 index 000000000..1e9b1bd6d --- /dev/null +++ b/ui-super-heroes/src/main/docker-compose/java21.yml @@ -0,0 +1,9 @@ + + ui-super-heroes-java21: + image: quay.io/quarkus-super-heroes/ui-super-heroes:java21-latest + container_name: ui-super-heroes-java21 + ports: + - "8080:8080" + restart: on-failure + environment: + API_BASE_URL: http://localhost:8082 diff --git a/ui-super-heroes/src/main/docker-compose/native.yml b/ui-super-heroes/src/main/docker-compose/native.yml index 22bed5e7d..6382dca59 100644 --- a/ui-super-heroes/src/main/docker-compose/native.yml +++ b/ui-super-heroes/src/main/docker-compose/native.yml @@ -1,7 +1,7 @@ ui-super-heroes-native: image: quay.io/quarkus-super-heroes/ui-super-heroes:native-latest - container_name: ui-super-heroes + container_name: ui-super-heroes-native ports: - "8080:8080" restart: on-failure diff --git a/ui-super-heroes/src/main/docker/Dockerfile.jvm21 b/ui-super-heroes/src/main/docker/Dockerfile.jvm21 new file mode 100644 index 000000000..77bb6f909 --- /dev/null +++ b/ui-super-heroes/src/main/docker/Dockerfile.jvm21 @@ -0,0 +1,92 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/ui-super-heroes-jvm21 . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/ui-super-heroes-jvm21 +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/ui-super-heroes-jvm21 +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi9/openjdk-21:1.17 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/ui-super-heroes/src/main/resources/application.properties b/ui-super-heroes/src/main/resources/application.properties index b0f509697..a9a7f58fa 100644 --- a/ui-super-heroes/src/main/resources/application.properties +++ b/ui-super-heroes/src/main/resources/application.properties @@ -28,10 +28,14 @@ quarkus.container-image.builder=docker quarkus.container-image.registry=quay.io quarkus.container-image.group=quarkus-super-heroes quarkus.container-image.name=${quarkus.application.name} +paths.dockerfile.jvm-21=src/main/docker/Dockerfile.jvm21 +paths.base-image.jvm-21=registry.access.redhat.com/ubi9/openjdk-21:1.17 # Kubernetes %kubernetes.quarkus.config.profile.parent=prod %kubernetes.quarkus.kubernetes.deployment-target=kubernetes +%kubernetes-21.quarkus.config.profile.parent=kubernetes +%kubernetes-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.kubernetes.part-of=ui-super-heroes quarkus.kubernetes.annotations."app.openshift.io/connects-to"=rest-fights,otel-collector quarkus.kubernetes.labels.app=${quarkus.application.name} @@ -42,6 +46,10 @@ quarkus.kubernetes.labels.system=quarkus-super-heroes %openshift.quarkus.config.profile.parent=prod %openshift.quarkus.kubernetes.deployment-target=openshift %openshift.quarkus.container-image.builder=openshift +%openshift-21.quarkus.config.profile.parent=openshift +%openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} quarkus.openshift.base-jvm-image=registry.access.redhat.com/ubi9/openjdk-17:1.16 quarkus.openshift.base-native-image=quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0 quarkus.openshift.deployment-kind=deployment @@ -55,6 +63,8 @@ quarkus.openshift.env.vars.CALCULATE_API_BASE_URL=true # Knative %knative.quarkus.config.profile.parent=prod %knative.quarkus.kubernetes.deployment-target=knative +%knative-21.quarkus.config.profile.parent=knative +%knative-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} quarkus.knative.annotations."app.openshift.io/connects-to"=rest-fights,otel-collector quarkus.knative.labels.app=${quarkus.kubernetes.labels.app} quarkus.knative.labels.application=${quarkus.kubernetes.labels.application} @@ -65,7 +75,13 @@ quarkus.knative.env.vars.CALCULATE_API_BASE_URL=true # Knative on OpenShift %knative-openshift.quarkus.config.profile.parent=knative %knative-openshift.quarkus.container-image.builder=openshift +%knative-openshift-21.quarkus.config.profile.parent=knative-openshift +%knative-openshift-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.jvm-dockerfile=${paths.dockerfile.jvm-21} +%knative-openshift-21.quarkus.openshift.base-jvm-image=${paths.base-image.jvm-21} # Minikube %minikube.quarkus.config.profile.parent=prod %minikube.quarkus.kubernetes.deployment-target=minikube +%minikube-21.quarkus.config.profile.parent=minikube +%minikube-21.quarkus.docker.dockerfile-jvm-path=${paths.dockerfile.jvm-21} From 15ebdc86e3d739cb602f2844834437859c86df59 Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Fri, 6 Oct 2023 14:19:27 -0400 Subject: [PATCH 2/7] Fix build workflow --- .github/workflows/simple-build-test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/simple-build-test.yml b/.github/workflows/simple-build-test.yml index 6a05f35dc..8beeb422f 100644 --- a/.github/workflows/simple-build-test.yml +++ b/.github/workflows/simple-build-test.yml @@ -87,7 +87,6 @@ jobs: fail-fast: false matrix: java: - - { graal: '17.0.8', java: '17' } - { graal: '21.0.0', java: '21'} project: - event-statistics @@ -124,10 +123,10 @@ jobs: architecture: x64 cache: maven - - name: "build-test-native-${{ matrix.project }}-java-${{ matrix.java }}" + - name: "build-test-native-${{ matrix.project }}-java-${{ matrix.java.java }}" working-directory: ${{ matrix.project }} run: | ./mvnw -B clean verify -Pnative \ -Dquarkus.http.host=0.0.0.0 \ - -Dmaven.compiler.release=${{ matrix.java }} + -Dmaven.compiler.release=${{ matrix.java.java }} From 919c28a443a1409b51cbc0a0f3dd977d8df2afc4 Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Fri, 6 Oct 2023 14:41:14 -0400 Subject: [PATCH 3/7] Fix build workflow --- .github/workflows/create-deploy-resources.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-deploy-resources.yml b/.github/workflows/create-deploy-resources.yml index d674e5ddc..b5281d1aa 100644 --- a/.github/workflows/create-deploy-resources.yml +++ b/.github/workflows/create-deploy-resources.yml @@ -45,8 +45,8 @@ jobs: - name: Setup Java uses: actions/setup-java@v3 with: - java-version: 17 - distribution: temurin + java-version: 21 + distribution: zulu cache: maven - name: Create k8s resources From 6575a9a704bb9f0fd6bd1f1abe37b78e1d519a34 Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Wed, 11 Oct 2023 16:22:01 -0400 Subject: [PATCH 4/7] GH action builds back to temurin --- .github/workflows/build-push-container-images.yml | 4 ++-- .github/workflows/create-deploy-resources.yml | 2 +- .github/workflows/simple-build-test.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-push-container-images.yml b/.github/workflows/build-push-container-images.yml index 74d257ed7..c81ee8c31 100644 --- a/.github/workflows/build-push-container-images.yml +++ b/.github/workflows/build-push-container-images.yml @@ -62,7 +62,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} - distribution: zulu + distribution: temurin cache: maven - name: Create env vars @@ -151,7 +151,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} - distribution: zulu + distribution: temurin cache: maven - name: Create env vars diff --git a/.github/workflows/create-deploy-resources.yml b/.github/workflows/create-deploy-resources.yml index b5281d1aa..0844ab461 100644 --- a/.github/workflows/create-deploy-resources.yml +++ b/.github/workflows/create-deploy-resources.yml @@ -46,7 +46,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: 21 - distribution: zulu + distribution: temurin cache: maven - name: Create k8s resources diff --git a/.github/workflows/simple-build-test.yml b/.github/workflows/simple-build-test.yml index 8beeb422f..884ab6946 100644 --- a/.github/workflows/simple-build-test.yml +++ b/.github/workflows/simple-build-test.yml @@ -70,7 +70,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} - distribution: zulu + distribution: temurin cache: maven - name: "build-test-jvm-${{ matrix.project }}-java-${{ matrix.java }}" From 11ec6ea8da0406fd06f1dbc31f23155f9ea7c642 Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Fri, 17 Nov 2023 16:59:11 -0500 Subject: [PATCH 5/7] Merge Signed-off-by: Eric Deandrea --- .github/quarkus-ecosystem-test | 6 ++++++ .github/workflows/build-push-container-images.yml | 2 +- .github/workflows/quarkus-snapshot.yaml | 6 ++++++ .github/workflows/simple-build-test.yml | 12 ++++++------ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/quarkus-ecosystem-test b/.github/quarkus-ecosystem-test index 235bc375b..13bf11847 100755 --- a/.github/quarkus-ecosystem-test +++ b/.github/quarkus-ecosystem-test @@ -19,3 +19,9 @@ run_build() { echo "Running build for Java 17" echo "JAVA_HOME=${JAVA_HOME}" run_build 17 + +# Now do it again for Java 21 +JAVA_HOME=../${JAVA_21_PATH} +echo "Running build for Java 21" +echo "JAVA_HOME=${JAVA_HOME}" +run_build 21 diff --git a/.github/workflows/build-push-container-images.yml b/.github/workflows/build-push-container-images.yml index c81ee8c31..3285d59ee 100644 --- a/.github/workflows/build-push-container-images.yml +++ b/.github/workflows/build-push-container-images.yml @@ -2,7 +2,7 @@ name: Build and Push Container images env: IMAGE_BASE_NAME: "quay.io/quarkus-super-heroes" - GRAALVM_IMAGE: "quay.io/quarkus/ubi-quarkus-graalvmce-builder-image" + GRAALVM_IMAGE: "quay.io/quarkus/ubi-quarkus-mandrel-builder-image" LATEST_IMAGE_TAG: "latest" on: diff --git a/.github/workflows/quarkus-snapshot.yaml b/.github/workflows/quarkus-snapshot.yaml index e15c8c32e..002aea8f4 100644 --- a/.github/workflows/quarkus-snapshot.yaml +++ b/.github/workflows/quarkus-snapshot.yaml @@ -8,6 +8,8 @@ env: ECOSYSTEM_CI_REPO: quarkusio/quarkus-ecosystem-ci ECOSYSTEM_CI_REPO_FILE: context.yaml ECOSYSTEM_CI_REPO_PATH: quarkus-super-heroes + JAVA_21_DOWNLOAD_URL: https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12/OpenJDK21U-jdk_x64_linux_hotspot_21.0.1_12.tar.gz + JAVA_21_PATH: jdk-21.0.1+12 jobs: build: @@ -23,6 +25,9 @@ jobs: with: java-version: 17 distribution: temurin + + - name: Set up Java 21 + run: wget -c ${{ env.JAVA_21_DOWNLOAD_URL }} -O - | tar -xz - name: Checkout repo uses: actions/checkout@v4 @@ -41,3 +46,4 @@ jobs: ECOSYSTEM_CI_TOKEN: ${{ secrets.ECOSYSTEM_CI_TOKEN }} QUARKUS_VERSION_POM_PATH: rest-fights QUARKUS_VERSION_POM_PROPERTY: quarkus.platform.version + JAVA_21_PATH: ${{ env.JAVA_21_PATH }} diff --git a/.github/workflows/simple-build-test.yml b/.github/workflows/simple-build-test.yml index 884ab6946..ce8edc6a6 100644 --- a/.github/workflows/simple-build-test.yml +++ b/.github/workflows/simple-build-test.yml @@ -87,7 +87,7 @@ jobs: fail-fast: false matrix: java: - - { graal: '21.0.0', java: '21'} + - { graal: '23.1.1.0', java: '21'} project: - event-statistics - rest-fights @@ -105,20 +105,20 @@ jobs: id: check-graal-cache uses: actions/cache@v3 with: - path: graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz - key: graal-distro-${{ matrix.java.graal }} + path: mandrel-java${{ matrix.java.java}}-linux-amd64-${{ matrix.java.graal }}-Final.tar.gz + key: mandrel-distro-${{ matrix.java.graal }} - name: Download GraalVM CE ${{ matrix.java.graal }} if: steps.check-graal-cache.outputs.cache-hit != 'true' run: | - download_url="https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${{ matrix.java.graal }}/graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz" - wget -q -O graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz $download_url + download_url="https://github.com/graalvm/mandrel/releases/download/mandrel-${{ matrix.java.graal }}-Final/mandrel-java${{ matrix.java.java }}-linux-amd64-${{ matrix.java.graal }}-Final.tar.gz" + wget -q -O mandrel-java${{ matrix.java.java }}-linux-amd64-${{ matrix.java.graal }}-Final.tar.gz $download_url - name: Setup GraalVM CE ${{ matrix.java.graal }} distro uses: actions/setup-java@v3 with: distribution: 'jdkfile' - jdkFile: graalvm-community-jdk-${{ matrix.java.graal }}_linux-x64_bin.tar.gz + jdkFile: mandrel-java${{ matrix.java.java }}-linux-amd64-${{ matrix.java.graal }}-Final.tar.gz java-version: ${{ matrix.java.java }} architecture: x64 cache: maven From 2efd5399d27ff09159df04aefb8951f067eba3dc Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Fri, 17 Nov 2023 16:59:28 -0500 Subject: [PATCH 6/7] Merge Signed-off-by: Eric Deandrea --- .../src/main/docker-compose/java21.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 grpc-locations/src/main/docker-compose/java21.yml diff --git a/grpc-locations/src/main/docker-compose/java21.yml b/grpc-locations/src/main/docker-compose/java21.yml new file mode 100644 index 000000000..8410e4858 --- /dev/null +++ b/grpc-locations/src/main/docker-compose/java21.yml @@ -0,0 +1,28 @@ + + grpc-locations-java21: + image: quay.io/quarkus-super-heroes/grpc-locations:java21-latest + container_name: grpc-locations-java21 + depends_on: + - locations-db + ports: + - "8089:8089" + environment: + QUARKUS_DATASOURCE_JDBC_URL: jdbc:mariadb://locations-db:3306/locations_database + QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION: validate + QUARKUS_DATASOURCE_USERNAME: locations + QUARKUS_DATASOURCE_PASSWORD: locations + QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT: no-file + QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317 + restart: on-failure + networks: + default: + aliases: + - grpc-locations + deploy: + resources: + limits: + memory: 1G + cpus: '1' + reservations: + memory: 256M + cpus: '0.5' From 1e65d2ac26a3cc0764627a1050798841c701af58 Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Fri, 17 Nov 2023 17:00:00 -0500 Subject: [PATCH 7/7] Merge Signed-off-by: Eric Deandrea --- .github/workflows/simple-build-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/simple-build-test.yml b/.github/workflows/simple-build-test.yml index ce8edc6a6..626154010 100644 --- a/.github/workflows/simple-build-test.yml +++ b/.github/workflows/simple-build-test.yml @@ -101,14 +101,14 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Cache and restore GraalVM CE (${{ matrix.java.graal }}) + - name: Cache and restore GraalVM (${{ matrix.java.graal }}) id: check-graal-cache uses: actions/cache@v3 with: path: mandrel-java${{ matrix.java.java}}-linux-amd64-${{ matrix.java.graal }}-Final.tar.gz key: mandrel-distro-${{ matrix.java.graal }} - - name: Download GraalVM CE ${{ matrix.java.graal }} + - name: Download GraalVM ${{ matrix.java.graal }} if: steps.check-graal-cache.outputs.cache-hit != 'true' run: | download_url="https://github.com/graalvm/mandrel/releases/download/mandrel-${{ matrix.java.graal }}-Final/mandrel-java${{ matrix.java.java }}-linux-amd64-${{ matrix.java.graal }}-Final.tar.gz"