From 549f92f9b40e665656600c6c0f33fc022f66bb10 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 27 May 2024 18:13:35 +0200 Subject: [PATCH] Fixing project structure --- CHANGELOG.md | 2 +- dockerize/buildImageAndStart.sh | 31 +++++++++---------- dockerize/build_conf | 4 +-- dockerize/pull_smartgear.sh | 14 +++++++++ dockerize/push_docker.sh | 12 +++++++ documentation/enunciate.xml | 4 +-- .../rest/administration/Configuration.java | 2 +- .../rest/annotation/PATCH.java | 17 ---------- 8 files changed, 47 insertions(+), 39 deletions(-) create mode 100755 dockerize/pull_smartgear.sh create mode 100755 dockerize/push_docker.sh delete mode 100644 src/main/java/org/gcube/resourcemanagement/rest/annotation/PATCH.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 6544bf5..d3a4924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog for "HelloWorld" +# Changelog for "Resource Manager" All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/dockerize/buildImageAndStart.sh b/dockerize/buildImageAndStart.sh index 3a06d1d..6a435f1 100755 --- a/dockerize/buildImageAndStart.sh +++ b/dockerize/buildImageAndStart.sh @@ -32,19 +32,19 @@ Help() { echo "-e execute the docker image" echo "-g arg specifies the maven [g]oals {package, install, deploy etc} default is $GOAL." echo "-d arg? enable java debug mode for execution" + echo " arg is the debug port (default is $DEBUG_PORT)" echo "-r push image to d4science harbo[r] (with login already done, or -l to login)" echo "-u p[u]sh image to dockerhub (with docker login already done)" echo "-p arg specifies the port to be exposed for the docker container to access the service (default $PORT)" - echo "-c arg path of the file to deploy as container.ini (default ./docker/container.ini)" + echo "-c arg path of the file to deploy as container.ini (default ./docker/container.ini)" - echo "-j arg specify java version (default is $JAVA_VERSION)" - echo " accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}" - echo " arg is the debug port (default is $DEBUG_PORT)" + # echo "-j arg specify java version (default is $JAVA_VERSION)" + # echo " accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}" - echo "-s skip maven package" + echo "-s skip maven execution" echo "-t exec also maven tests" echo "-n arg specifies the docker image name (default is $MVN_NAME)." @@ -67,8 +67,8 @@ Help() { set -e -#OPTSTRING=":sn:p:d:j:?h" -OPTSTRING=":c:n:p:g:d:?jsmulrteh" +#OPTSTRING=":c:n:p:g:d:?jsmulrteh" +OPTSTRING=":c:n:p:g:d:?smulrteh" while getopts $OPTSTRING opt; do # echo "Option -${opt} was triggered, Argument: ${OPTARG}" @@ -94,13 +94,13 @@ while getopts $OPTSTRING opt; do DEBUG_PORT=${OPTARG} echo "debug enabled, port $DEBUG_PORT, execute $EXECUTE" ;; - j) - if [[ ${ACCEPTED_JAVA_VERSIONs[@]} =~ ${OPTARG} ]]; then - JAVA_VERSION=${OPTARG} - else - echo "Invalid java version" && echo "accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}" && exit 1 - fi - ;; + # j) + # if [[ ${ACCEPTED_JAVA_VERSIONs[@]} =~ ${OPTARG} ]]; then + # JAVA_VERSION=${OPTARG} + # else + # echo "Invalid java version" && echo "accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}" && exit 1 + # fi + # ;; h) Help && exit 0 ;; :) @@ -147,8 +147,7 @@ echo "DOCKER_BUILD_NAME: $DOCKER_BUILD_NAME" --build-arg="MVN_FINALNAME=$MVN_FINALNAME" \ --build-arg="MVN_NAME=${MVN_NAME}" \ --build-arg="CONTAINER_INI=${CONTAINER_INI}" \ - --build-arg="JAVA_VERSION=${JAVA_VERSION}" \ - --build-arg="SMARTGEARS_VERSION=${SMARTGEARS_VERSION}" \ + --build-arg="SMARTGEAR_IMAGE=${SMARTGEAR_IMAGE}" \ -f Dockerfile \ $PLATFORMS . ); diff --git a/dockerize/build_conf b/dockerize/build_conf index 5d16972..92b7469 100644 --- a/dockerize/build_conf +++ b/dockerize/build_conf @@ -26,7 +26,7 @@ JAVA_VERSION=$(cd .. && mvn -q \ exec:exec) echo "JAVA_VERSION: ${JAVA_VERSION}" -TOMCAT_VERSION=tomcat10.1.19 +TOMCAT_VERSION=10.1.19 echo "TOMCAT_VERSION: ${TOMCAT_VERSION}" SMARTGEARS_VERSION=$(cd .. && mvn -q \ @@ -45,7 +45,7 @@ echo "IMAGE_VERSION: ${IMAGE_VERSION}" DOCKER_BUILD_NAME=$MVN_NAME:$IMAGE_VERSION echo "DOCKER_BUILD_NAME: ${DOCKER_BUILD_NAME}" -SMARTGEAR_IMAGE=hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-${TOMCAT_VERSION} +SMARTGEAR_IMAGE=hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat${TOMCAT_VERSION} echo "SMARTGEAR_IMAGE: ${SMARTGEAR_IMAGE}" DOCKER_IMAGE_NAME=d4science/$DOCKER_BUILD_NAME diff --git a/dockerize/pull_smartgear.sh b/dockerize/pull_smartgear.sh new file mode 100755 index 0000000..d02488f --- /dev/null +++ b/dockerize/pull_smartgear.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -a +# source build_conf > docker.conf # generate current conf +# source docker.conf +source build_conf + +echo "Docker Smartgear image $SMARTGEAR_IMAGE" + +# docker pull hub.dev.d4science.org/gcube/smartgears-distribution:4.0.1-SNAPSHOT-java11-tomcat10.1.19 + +docker pull $SMARTGEAR_IMAGE + +set +a diff --git a/dockerize/push_docker.sh b/dockerize/push_docker.sh new file mode 100755 index 0000000..4d8502d --- /dev/null +++ b/dockerize/push_docker.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -a +# source build_conf > docker.conf # generate current conf +# source docker.conf +source build_conf + +echo "Docker image $HARBOR_IMAGE_NAME" + +docker push $HARBOR_IMAGE_NAME + +set +a diff --git a/documentation/enunciate.xml b/documentation/enunciate.xml index e1d7450..3139f10 100644 --- a/documentation/enunciate.xml +++ b/documentation/enunciate.xml @@ -4,8 +4,8 @@ xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.14.0.xsd"> - - + + diff --git a/src/main/java/org/gcube/resourcemanagement/rest/administration/Configuration.java b/src/main/java/org/gcube/resourcemanagement/rest/administration/Configuration.java index 4ab568a..0317415 100644 --- a/src/main/java/org/gcube/resourcemanagement/rest/administration/Configuration.java +++ b/src/main/java/org/gcube/resourcemanagement/rest/administration/Configuration.java @@ -2,7 +2,6 @@ package org.gcube.resourcemanagement.rest.administration; import org.gcube.common.security.providers.SecretManagerProvider; import org.gcube.resourcemanagement.rest.BaseREST; -import org.gcube.resourcemanagement.rest.annotation.PATCH; import org.gcube.resourcemanagement.rest.annotation.PURGE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,6 +18,7 @@ import jakarta.ws.rs.DELETE; import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.GET; import jakarta.ws.rs.InternalServerErrorException; +import jakarta.ws.rs.PATCH; import jakarta.ws.rs.POST; import jakarta.ws.rs.PUT; import jakarta.ws.rs.Path; diff --git a/src/main/java/org/gcube/resourcemanagement/rest/annotation/PATCH.java b/src/main/java/org/gcube/resourcemanagement/rest/annotation/PATCH.java deleted file mode 100644 index 236a84a..0000000 --- a/src/main/java/org/gcube/resourcemanagement/rest/annotation/PATCH.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.gcube.resourcemanagement.rest.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import jakarta.ws.rs.HttpMethod; - -/** - * @author Luca Frosini (ISTI - CNR) - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@HttpMethod("PATCH") -public @interface PATCH { -} \ No newline at end of file