diff --git a/assembly/api/descriptors/kapua-api-jetty.xml b/assembly/api/descriptors/kapua-api-jetty.xml index f41841e4a7e..34d6e64013f 100644 --- a/assembly/api/descriptors/kapua-api-jetty.xml +++ b/assembly/api/descriptors/kapua-api-jetty.xml @@ -69,5 +69,10 @@ <source>${project.build.directory}/tmp/openapi.yaml</source> <outputDirectory>var/opt/jetty/webapps/root/doc</outputDirectory> </file> + <file> + <source>${project.basedir}/entrypoint/run-api</source> + <outputDirectory>var/opt/jetty</outputDirectory> + <fileMode>0777</fileMode> + </file> </files> </assembly> diff --git a/assembly/api/docker/Dockerfile b/assembly/api/docker/Dockerfile index 092f7cb40e6..c9c9fe9fdc9 100644 --- a/assembly/api/docker/Dockerfile +++ b/assembly/api/docker/Dockerfile @@ -57,3 +57,5 @@ RUN chown -R 1000:0 /opt/jetty /var/opt/jetty && \ chmod -R g=u /opt/jetty /var/opt/jetty USER 1000 + +ENTRYPOINT /var/opt/jetty/run-api diff --git a/assembly/api/entrypoint/run-api b/assembly/api/entrypoint/run-api new file mode 100644 index 00000000000..21b4aff25a7 --- /dev/null +++ b/assembly/api/entrypoint/run-api @@ -0,0 +1,44 @@ +#!/bin/sh +################################################################################ +# Copyright (c) 2024, 2022 Red Hat Inc and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat Inc - initial API and implementation +# Eurotech +################################################################################ + +openapiFile=webapps/root/doc/openapi.yaml; + +if [ -n "$COMMONS_VERSION" ]; then + # Replace the version and the build number in the openapi file + awk -v version="$COMMONS_VERSION" -v build_number="$COMMONS_BUILD_NUMBER" '{ + if (!subbed && /version:/) { + gsub(/version: .*/, "version: " version "-" build_number) + subbed = 1 + } + print + }' "$openapiFile" > "$openapiFile.tmp"; + + mv "$openapiFile.tmp" "$openapiFile"; +fi; + +# Append the Java option for commons.version if defined +if [ -n "$COMMONS_VERSION" ]; then + echo "Using commons version: $COMMONS_VERSION"; + JAVA_OPTS="${JAVA_OPTS} -Dcommons.version=$COMMONS_VERSION" +fi + +# Append the Java option for commons.build.number if defined +if [ -n "$COMMONS_BUILD_NUMBER" ]; then + echo "Using commons build number: $COMMONS_BUILD_NUMBER"; + JAVA_OPTS="${JAVA_OPTS} -Dcommons.build.number=$COMMONS_BUILD_NUMBER"; +fi + +# Continue with startup +exec /var/opt/jetty/run-jetty "$@"; diff --git a/assembly/console/pom.xml b/assembly/console/pom.xml index cc95c4d491b..dc884af515d 100644 --- a/assembly/console/pom.xml +++ b/assembly/console/pom.xml @@ -92,8 +92,7 @@ <artifactId>kapua-security-certificate-internal</artifactId> </dependency> - <!-- dependencies added otherwise the unix assembly doesn't know the arctifact - to add --> + <!-- dependencies added otherwise the unix assembly doesn't know the artifact to add --> <dependency> <groupId>org.eclipse.kapua</groupId> <artifactId>kapua-device-management-all-api</artifactId> diff --git a/deployment/docker/compose/docker-compose.yml b/deployment/docker/compose/docker-compose.yml index 29d593aa28b..2d917d6572a 100644 --- a/deployment/docker/compose/docker-compose.yml +++ b/deployment/docker/compose/docker-compose.yml @@ -111,6 +111,8 @@ services: - AUTH_TOKEN_TTL=${AUTH_TOKEN_TTL:-1800000} - REFRESH_AUTH_TOKEN_TTL=${REFRESH_AUTH_TOKEN_TTL:-18000000} - CORS_ENDPOINTS_REFRESH_INTERVAL=${CORS_ENDPOINTS_REFRESH_INTERVAL:-60} + - COMMONS_VERSION + - COMMONS_BUILD_NUMBER job-engine: container_name: job-engine image: kapua/kapua-job-engine:${IMAGE_VERSION}