From faa46dc8ba41beac6e0fb91e97881890ceb0c442 Mon Sep 17 00:00:00 2001 From: Sven Boeckelmann Date: Sun, 9 Jun 2024 13:50:43 +0200 Subject: [PATCH] add quarkus-converter-service app --- pom.xml | 1 + .../convert/OpenEPCISConverterProcessor.java | 2 +- .../resource/DocumentConverterResource.java | 2 + .../resource/IdentifierConverterResource.java | 2 + .../DocumentVersionConverterResourceTest.java | 23 --- service/converter-service-servlet/pom.xml | 6 + .../servlet/DocumentConverterServlet.java | 2 +- .../servlet/IdentifierConverterServlets.java | 2 +- service/quarkus-converter-service/pom.xml | 160 ++++++++++++++++++ .../src/main/docker/Dockerfile.jvm | 97 +++++++++++ .../src/main/docker/Dockerfile.legacy-jar | 93 ++++++++++ .../src/main/docker/Dockerfile.native | 27 +++ .../src/main/docker/Dockerfile.native-micro | 30 ++++ .../epc/converter/RESTApplication.java | 26 +++ .../src/main/resources/META-INF/beans.xml | 12 ++ .../src/main/resources/application.yml | 43 +++++ .../src/main/resources/reflection-config.json | 21 +++ .../src/main/resources/ssl/cert.pem | 23 +++ .../src/main/resources/ssl/key.pem | 28 +++ 19 files changed, 574 insertions(+), 26 deletions(-) delete mode 100644 service/converter-service-rest/src/test/java/io/openepcis/converter/resource/test/DocumentVersionConverterResourceTest.java create mode 100644 service/quarkus-converter-service/pom.xml create mode 100644 service/quarkus-converter-service/src/main/docker/Dockerfile.jvm create mode 100644 service/quarkus-converter-service/src/main/docker/Dockerfile.legacy-jar create mode 100644 service/quarkus-converter-service/src/main/docker/Dockerfile.native create mode 100644 service/quarkus-converter-service/src/main/docker/Dockerfile.native-micro create mode 100644 service/quarkus-converter-service/src/main/java/io/openepcis/epc/converter/RESTApplication.java create mode 100644 service/quarkus-converter-service/src/main/resources/META-INF/beans.xml create mode 100644 service/quarkus-converter-service/src/main/resources/application.yml create mode 100644 service/quarkus-converter-service/src/main/resources/reflection-config.json create mode 100644 service/quarkus-converter-service/src/main/resources/ssl/cert.pem create mode 100644 service/quarkus-converter-service/src/main/resources/ssl/key.pem diff --git a/pom.xml b/pom.xml index bdfb0a3..713b0d4 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,7 @@ service/converter-service-restassured service/converter-service-rest service/converter-service-servlet + service/quarkus-converter-service diff --git a/quarkus/deployment/src/main/java/io/openepcis/quarkus/deployment/convert/OpenEPCISConverterProcessor.java b/quarkus/deployment/src/main/java/io/openepcis/quarkus/deployment/convert/OpenEPCISConverterProcessor.java index 2367453..e2c49ec 100644 --- a/quarkus/deployment/src/main/java/io/openepcis/quarkus/deployment/convert/OpenEPCISConverterProcessor.java +++ b/quarkus/deployment/src/main/java/io/openepcis/quarkus/deployment/convert/OpenEPCISConverterProcessor.java @@ -25,7 +25,7 @@ public class OpenEPCISConverterProcessor { - private static final String FEATURE = "opensearch-document-converter"; + private static final String FEATURE = "openepcis-document-converter"; @BuildStep diff --git a/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/DocumentConverterResource.java b/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/DocumentConverterResource.java index 7b06bf6..67d2add 100644 --- a/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/DocumentConverterResource.java +++ b/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/DocumentConverterResource.java @@ -12,6 +12,7 @@ import io.openepcis.model.epcis.EPCISEvent; import io.openepcis.model.epcis.exception.UnsupportedMediaTypeException; import io.openepcis.model.rest.ProblemResponseBody; +import io.quarkus.runtime.annotations.RegisterForReflection; import io.smallrye.common.annotation.Blocking; import io.smallrye.mutiny.Uni; import jakarta.inject.Inject; @@ -38,6 +39,7 @@ import java.util.HashMap; import java.util.Map; +@RegisterForReflection @Path("/api") @Tag( name = "Format Converter", diff --git a/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/IdentifierConverterResource.java b/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/IdentifierConverterResource.java index d76a254..ae0062b 100644 --- a/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/IdentifierConverterResource.java +++ b/service/converter-service-rest/src/main/java/io/openepcis/epc/converter/resource/IdentifierConverterResource.java @@ -3,6 +3,7 @@ import io.openepcis.converter.exception.FormatConverterException; import io.openepcis.converter.common.IdentifierConverterUtil; import io.openepcis.model.rest.ProblemResponseBody; +import io.quarkus.runtime.annotations.RegisterForReflection; import io.smallrye.mutiny.Uni; import java.util.Map; @@ -22,6 +23,7 @@ import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; import org.eclipse.microprofile.openapi.annotations.tags.Tag; +@RegisterForReflection @Path("/api") @Tag( name = "Identifier Converter", diff --git a/service/converter-service-rest/src/test/java/io/openepcis/converter/resource/test/DocumentVersionConverterResourceTest.java b/service/converter-service-rest/src/test/java/io/openepcis/converter/resource/test/DocumentVersionConverterResourceTest.java deleted file mode 100644 index ce8f8ed..0000000 --- a/service/converter-service-rest/src/test/java/io/openepcis/converter/resource/test/DocumentVersionConverterResourceTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package io.openepcis.converter.resource.test; - -import io.openepcis.converter.service.restassured.AbstractDocumentVersionConverterTest; -import io.openepcis.epc.converter.resource.DocumentVersionConverterResource; -import io.quarkus.test.common.http.TestHTTPEndpoint; -import io.quarkus.test.common.http.TestHTTPResource; -import io.quarkus.test.junit.QuarkusTest; - -import java.net.URL; - -@QuarkusTest -public class DocumentVersionConverterResourceTest extends AbstractDocumentVersionConverterTest { - - @TestHTTPEndpoint(DocumentVersionConverterResource.class) - @TestHTTPResource - URL url; - - @Override - public String url() { - return url + "/convert/version"; - } - -} diff --git a/service/converter-service-servlet/pom.xml b/service/converter-service-servlet/pom.xml index f77432e..1c8eaf9 100644 --- a/service/converter-service-servlet/pom.xml +++ b/service/converter-service-servlet/pom.xml @@ -104,6 +104,12 @@ test + + io.openepcis.quarkus + quarkus-document-converter + test + + io.quarkus diff --git a/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/DocumentConverterServlet.java b/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/DocumentConverterServlet.java index 9663409..af86b69 100644 --- a/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/DocumentConverterServlet.java +++ b/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/DocumentConverterServlet.java @@ -4,7 +4,7 @@ import io.openepcis.constants.EPCISVersion; import io.openepcis.converter.Conversion; import io.openepcis.converter.VersionTransformer; -import io.openepcis.epc.converter.common.GS1FormatSupport; +import io.openepcis.converter.common.GS1FormatSupport; import io.openepcis.model.epcis.format.FormatPreference; import io.openepcis.model.rest.servlet.ServletSupport; import jakarta.inject.Inject; diff --git a/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/IdentifierConverterServlets.java b/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/IdentifierConverterServlets.java index f597144..24034c2 100644 --- a/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/IdentifierConverterServlets.java +++ b/service/converter-service-servlet/src/main/java/io/openepcis/converter/servlet/IdentifierConverterServlets.java @@ -1,6 +1,6 @@ package io.openepcis.converter.servlet; -import io.openepcis.epc.converter.common.IdentifierConverterUtil; +import io.openepcis.converter.common.IdentifierConverterUtil; import io.openepcis.model.rest.servlet.ServletSupport; import jakarta.inject.Inject; import jakarta.servlet.ServletException; diff --git a/service/quarkus-converter-service/pom.xml b/service/quarkus-converter-service/pom.xml new file mode 100644 index 0000000..35a4004 --- /dev/null +++ b/service/quarkus-converter-service/pom.xml @@ -0,0 +1,160 @@ + + + 4.0.0 + + io.openepcis + openepcis-document-converter-parent + 1.0.0-SNAPSHOT + ../../pom.xml + + quarkus-converter-service-app + quarkus-converter-service-app + Quarkus Application to convert the EPCIS 2.0 documents and identifiers from one standard format to another + + true + + + + io.openepcis.quarkus + quarkus-openepcis-model + + + io.openepcis.quarkus + quarkus-document-converter + + + io.openepcis + converter-service-rest + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-resteasy-reactive-jackson + + + io.quarkus + quarkus-resteasy-reactive + + + io.quarkus + quarkus-config-yaml + + + io.quarkus + quarkus-smallrye-openapi + + + io.quarkus + quarkus-smallrye-health + + + io.quarkus + quarkus-container-image-jib + + + io.quarkus + quarkus-reactive-routes + + + io.openepcis + openepcis-test-resources + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.junit.jupiter + junit-jupiter + ${junit.version} + test + + + javax.inject + javax.inject + 1 + test + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + -parameters + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + native + + + native + + + + false + true + + + + diff --git a/service/quarkus-converter-service/src/main/docker/Dockerfile.jvm b/service/quarkus-converter-service/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000..cf59071 --- /dev/null +++ b/service/quarkus-converter-service/src/main/docker/Dockerfile.jvm @@ -0,0 +1,97 @@ +#### +# 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/quarkus-converter-service-app-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-jvm +# +# 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/ubi8/openjdk-21:1.19 + +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" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/service/quarkus-converter-service/src/main/docker/Dockerfile.legacy-jar b/service/quarkus-converter-service/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000..6c9a706 --- /dev/null +++ b/service/quarkus-converter-service/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,93 @@ +#### +# 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 -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/quarkus-converter-service-app-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-legacy-jar +# +# 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/ubi8/openjdk-21:1.19 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +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" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/service/quarkus-converter-service/src/main/docker/Dockerfile.native b/service/quarkus-converter-service/src/main/docker/Dockerfile.native new file mode 100644 index 0000000..b881f3a --- /dev/null +++ b/service/quarkus-converter-service/src/main/docker/Dockerfile.native @@ -0,0 +1,27 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/quarkus-converter-service-app . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/service/quarkus-converter-service/src/main/docker/Dockerfile.native-micro b/service/quarkus-converter-service/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000..e437e23 --- /dev/null +++ b/service/quarkus-converter-service/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,30 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/quarkus-converter-service-app . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app +# +### +FROM quay.io/quarkus/quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/service/quarkus-converter-service/src/main/java/io/openepcis/epc/converter/RESTApplication.java b/service/quarkus-converter-service/src/main/java/io/openepcis/epc/converter/RESTApplication.java new file mode 100644 index 0000000..3132d27 --- /dev/null +++ b/service/quarkus-converter-service/src/main/java/io/openepcis/epc/converter/RESTApplication.java @@ -0,0 +1,26 @@ +package io.openepcis.epc.converter; + +import io.quarkus.runtime.annotations.RegisterForReflection; +import io.quarkus.vertx.web.Route; +import io.vertx.ext.web.RoutingContext; +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; +import jakarta.xml.bind.JAXBException; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.microprofile.openapi.annotations.Operation; + +import javax.xml.namespace.QName; + +@ApplicationPath("/") +@RegisterForReflection(targets = {QName.class, JAXBException.class}) +@Slf4j +public class RESTApplication extends Application { + + @Route(methods = Route.HttpMethod.GET, path = "/") + @Operation(hidden = true) + void index(RoutingContext rc) { + rc.redirect("/q/swagger-ui/index.html"); + } + + +} diff --git a/service/quarkus-converter-service/src/main/resources/META-INF/beans.xml b/service/quarkus-converter-service/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000..9fb34a8 --- /dev/null +++ b/service/quarkus-converter-service/src/main/resources/META-INF/beans.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/service/quarkus-converter-service/src/main/resources/application.yml b/service/quarkus-converter-service/src/main/resources/application.yml new file mode 100644 index 0000000..fdf53c3 --- /dev/null +++ b/service/quarkus-converter-service/src/main/resources/application.yml @@ -0,0 +1,43 @@ +quarkus: + swagger-ui: + always-include: true + + http: + cors: + ~: true + methods: GET,POST + origins: "/.*/" + limits: + max-body-size: 10M + ssl: + certificate: + files: ssl/cert.pem + key-files: ssl/key.pem + + container-image: + group: openepcis + name: quarkus-converter-service + additional-tags: + - latest + + index-dependency: + joda-time: + group-id: joda-time + artifact-id: joda-time + +mp: + openapi: + filter: "io.openepcis.resources.oas.EPCISExampleOASFilter" + extensions: + smallrye: + info: + title: "OpenEPCIS Document Converter API" + version: "1.0.0" + description: "Convert EPCIS events with ease." + contact: + email: "info@openepcis.io" + name: "OpenEPCIS | benelog GmbH & Co. KG" + url: "https://openepcis.io" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0.html" diff --git a/service/quarkus-converter-service/src/main/resources/reflection-config.json b/service/quarkus-converter-service/src/main/resources/reflection-config.json new file mode 100644 index 0000000..4ab4a24 --- /dev/null +++ b/service/quarkus-converter-service/src/main/resources/reflection-config.json @@ -0,0 +1,21 @@ +[ + { + "name" : "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + }, + { + "name" : "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + } + +] \ No newline at end of file diff --git a/service/quarkus-converter-service/src/main/resources/ssl/cert.pem b/service/quarkus-converter-service/src/main/resources/ssl/cert.pem new file mode 100644 index 0000000..9884d76 --- /dev/null +++ b/service/quarkus-converter-service/src/main/resources/ssl/cert.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID4zCCAsugAwIBAgIUW0MK/JgunFKMgYI394bXuOehFNQwDQYJKoZIhvcNAQEL +BQAwgYAxCzAJBgNVBAYTAkRFMQwwCgYDVQQIDANOUlcxDzANBgNVBAcMBktlcnBl +bjEVMBMGA1UECgwMb3BlbmVwY2lzLmlvMRkwFwYDVQQDDBBmb3JtYXQtY29udmVy +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6MeLmzEBStc3bf5RDm0Qe1iDzh+5jwoFaB4OBo6MvbJIETvkckXwuWY +1r+qEY62dbyRCDO2cCInumWRksOmjp7hyLKJKfNdqUmYs/JLhMCu +-----END CERTIFICATE----- diff --git a/service/quarkus-converter-service/src/main/resources/ssl/key.pem b/service/quarkus-converter-service/src/main/resources/ssl/key.pem new file mode 100644 index 0000000..1c7eb82 --- /dev/null +++ b/service/quarkus-converter-service/src/main/resources/ssl/key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDJj61G4EtgfT6V +192IuZa8h/84pkMx78cYi+IJ6vM8hJWgj/sK3FL8+Fr3r3iLEg1rQiW+53fwrWOO +f92zA+5XrWEQA+cQo5HO+VRbJsm7QfTN4LoVNoDHJCAuq3PAXNL2ng5ipCz5JSnr +Bg19VvfiWmewauWw4OBrpOHhNdQoXSAXk6x7hTQ7E2hsiBWOGkZ66ei/N8vVz/p8 +IDpO066Jrb5y9wjFjY6HyxoQEK88864DaPv0AfWh2HX0TfoSH4uazKM0VVmaLnnC +mEZX9TJpJ4qijWEudfyrk4dy4wSvZtN2ey9N/H9bd5Aa/ixSWvRQ23s6EWgBtLPo +Pxw23SldAgMBAAECggEBAL35x64H9cOqCHUfEtStZ9+mpu1z9913TEZcgd4rLrsZ +lBXT3x/rbeS1CLhvEMSzbSZtIDqA3FFie3VyGzmBOQI2jkeUBhNuuB1GbzXCp1zx +25S4fWtFBbes2xBh1SW317dOXeynJSRm3M2B1PEQKW+VGinzdy5xpdSPgb7NB3xK +LWpFRGDjpofGosPY9nM+gLDQJ4+nB1WrcAT4rCaLlnYzn3E8PDfrSVK/U0Wks2m6 +R8GSnUIhi3CEVQuPMwGNktQBEcC9rKdRz0hCbLCv8nmi++ocfSMf8cSkKcYx7zUy +htjtJid/TmXrCc3mKaxBeGT1HEcHlvVZW17dxkljx5kCgYEA6pRW6AnrIvF6J1iB +B1D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