diff --git a/.vscode/launch.json b/.vscode/launch.json index 4e2df5a..ecaf77f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "projectName": "identity-manager", "request": "attach", "hostName": "localhost", - "port": 5005 + "port": 5001 } ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index e0f15db..3af7bd3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,9 @@ { - "java.configuration.updateBuildConfiguration": "automatic" + "java.configuration.updateBuildConfiguration": "automatic", + "Workspace_Formatter.excludePattern": [ + "**/build", + "**/.*", + "**/.vscode", + "**/target/*" + ] } \ No newline at end of file diff --git a/Instructions.md b/Instructions.md new file mode 100644 index 0000000..305cc52 --- /dev/null +++ b/Instructions.md @@ -0,0 +1,72 @@ +# instructions + +## project structure + +├── .gitignore +├── pom.xml +├── src +│ └── *** +├── gcube/ +│ └── extra-resources/ +│ └── WEB-INF/ +│ ├── application.yaml +│ └── web.xml + +# optional, for local develop in docker containers +├── docker/ +│ ├── ontainer.ini +│ └── logback.xml +├── docker-compose.yaml +└── Dockerfile + + +### file details +* gitignore: gitignore file for java projects + +* pom.xml + * : maven-parent configuration. currently 1.2.0 version + * : path for web.xml + * ??? + * gcube dependency manager + +* docker/container.ini: configurations for the docker container. + * mode: [online/offline]: register the service on IS. use offline for local docker instances + + + +# EXCECUTION + +start the docker container +```./buildImageAndStart.sh``` + +test urls (replace {{TOKEN}} with your token): + + +http://localhost:8081/helloworld/guest + +http://localhost:8080/helloworld/details?gcube-token={{TOKEN}} +http://localhost:8080/helloworld/hello/details?gcube-token={{TOKEN}} + +http://localhost:8080/helloworld/auth?gcube-token={{TOKEN}} (checks for myRole role) +http://localhost:8080/helloworld/auth/orm_member?gcube-token={{TOKEN}} (checks for OrganizationMember role) + + +### Authentication: + +#### GCUBE-TOKEN param + +obtain personal token at https://next.dev.d4science.org/group/gcube/home + +add + + +### DEBUG + +start the docker container in debug Mode +```./buildImageAndStartWithDebug.sh``` + +connect the JAVA debugger to port 5005 + +* VSCODE: press the green play button and start "Debug (Attach) + + diff --git a/README.md b/README.md index b2fd3ba..e9d4f74 100644 --- a/README.md +++ b/README.md @@ -14,40 +14,6 @@ HelloWorld service for smartgears4 ## Documentation - -start the docker container -```./buildImageAndStart.sh``` - -test urls (replace {{TOKEN}} with your token): - - -http://localhost:8080/helloworld/guest - -http://localhost:8080/helloworld/details?gcube-token={{TOKEN}} -http://localhost:8080/helloworld/hello/details?gcube-token={{TOKEN}} - -http://localhost:8080/helloworld/auth?gcube-token={{TOKEN}} (checks for myRole role) -http://localhost:8080/helloworld/auth/orm_member?gcube-token={{TOKEN}} (checks for OrganizationMember role) - - -### Authentication: - -#### GCUBE-TOKEN param - -obtain personal token at https://next.dev.d4science.org/group/gcube/home - -add - - -### DEBUG - -start the docker container in debug Mode -```./buildImageAndStartWithDebug.sh``` - -connect the JAVA debugger to port 5005 - -* VSCODE: press the green play button and start "Debug (Attach) - ## Change log See [Releases](https://code-repo.d4science.org/gCubeSystem/helloworld/releases). diff --git a/buildImageAndStart.sh b/buildImageAndStart.sh index 7cc0e95..ddb51ca 100755 --- a/buildImageAndStart.sh +++ b/buildImageAndStart.sh @@ -1,3 +1,9 @@ mvn clean package -docker build -t smartgears-helloworld . -docker run -p 8080:8080 smartgears-helloworld + +NAME=smartgears-helloworld +PORT=8081 +DEBUG_PORT=5001 + +docker build -t $NAME. +docker run -p $PORT:8080 --name $NAME $NAME + diff --git a/buildImageAndStartWithDebug.sh b/buildImageAndStartWithDebug.sh index 9a50bb5..1deba49 100755 --- a/buildImageAndStartWithDebug.sh +++ b/buildImageAndStartWithDebug.sh @@ -1,3 +1,8 @@ -mvn package -docker build -t smartgears-helloworld . -docker run -p 8080:8080 -p 5005:5005 -e JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=y" smartgears-helloworld +mvn clean package + +NAME=smartgears-helloworld +PORT=8081 +DEBUG_PORT=5001 + +docker build -t $NAME . +docker run -p $PORT:8080 -p $DEBUG_PORT:5005 -e JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=y" $NAME diff --git a/docker/logback.xml b/docker/logback.xml index bb92578..cacfa90 100644 --- a/docker/logback.xml +++ b/docker/logback.xml @@ -1,18 +1,16 @@ - Ï - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - + Ï %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + - - + - - + + \ No newline at end of file diff --git a/docs/postman/Smartgears4 helloword.postman_collection.json b/docs/postman/Smartgears4 helloword.postman_collection.json index a8d6d57..e892710 100644 --- a/docs/postman/Smartgears4 helloword.postman_collection.json +++ b/docs/postman/Smartgears4 helloword.postman_collection.json @@ -311,7 +311,7 @@ "variable": [ { "key": "base_url", - "value": "http://localhost:8080", + "value": "http://localhost:8081", "type": "string" }, { diff --git a/pom.xml b/pom.xml index b4cf3a8..5515c70 100644 --- a/pom.xml +++ b/pom.xml @@ -2,23 +2,30 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - org.gcube.tools - maven-parent - 1.2.0 - + org.gcube.service helloworld 0.0.1-SNAPSHOT Smartgears HelloWorld Service war + + + + org.gcube.tools + maven-parent + 1.2.0 + + 11 - 1.14.0 UTF-8 ${java.version} ${java.version} + + + 1.14.0 + scm:git:https://code-repo.d4science.org/gCubeSystem/hello-world-sg4-service.git @@ -26,6 +33,7 @@ scm:git:https://code-repo.d4science.org/gCubeSystem/hello-world-sg4-service.git https://code-repo.d4science.org/gCubeSystem/hello-world-sg4-service.git + @@ -37,6 +45,7 @@ + @@ -55,6 +64,7 @@ org.gcube.core common-smartgears-app + javax.ws.rs @@ -64,6 +74,7 @@ org.glassfish.jersey.containers jersey-container-servlet + org.glassfish.jersey.inject @@ -74,6 +85,7 @@ javax.servlet-api 3.0.1 + org.glassfish.jersey.media @@ -84,10 +96,25 @@ slf4j-api + ${project.artifactId} - + + + + + org.codehaus.mojo aspectj-maven-plugin