documentazione

This commit is contained in:
Alfredo Oliviero 2024-02-27 12:45:01 +01:00
parent c7f147d1c9
commit e64b19bddf
9 changed files with 136 additions and 56 deletions

2
.vscode/launch.json vendored
View File

@ -10,7 +10,7 @@
"projectName": "identity-manager",
"request": "attach",
"hostName": "localhost",
"port": 5005
"port": 5001
}
]
}

View File

@ -1,3 +1,9 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
"java.configuration.updateBuildConfiguration": "automatic",
"Workspace_Formatter.excludePattern": [
"**/build",
"**/.*",
"**/.vscode",
"**/target/*"
]
}

72
Instructions.md Normal file
View File

@ -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
* <parent>: maven-parent configuration. currently 1.2.0 version
* <properties><webappDirectory> : path for web.xml
* <scm> ???
* <dependencyManagement> 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)

View File

@ -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).

View File

@ -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

View File

@ -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

View File

@ -1,18 +1,16 @@
<configuration scan="true" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>Ï
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<encoder>Ï <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.gcube.service.helloworld" level="DEBUG" />
<logger name="org.gcube.smartgears" level="DEBUG" />
<root level="WARN">
<appender-ref ref="STDOUT" />
</root>
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -311,7 +311,7 @@
"variable": [
{
"key": "base_url",
"value": "http://localhost:8080",
"value": "http://localhost:8081",
"type": "string"
},
{

41
pom.xml
View File

@ -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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.2.0</version>
</parent>
<groupId>org.gcube.service</groupId>
<artifactId>helloworld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Smartgears HelloWorld Service</name>
<packaging>war</packaging>
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.2.0</version>
</parent>
<properties>
<java.version>11</java.version>
<aspectj-plugin.version>1.14.0</aspectj-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!-- OPTIONAL. for authorization-control-library -->
<aspectj-plugin.version>1.14.0</aspectj-plugin.version>
</properties>
<scm>
<connection>
scm:git:https://code-repo.d4science.org/gCubeSystem/hello-world-sg4-service.git</connection>
@ -26,6 +33,7 @@
scm:git:https://code-repo.d4science.org/gCubeSystem/hello-world-sg4-service.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/hello-world-sg4-service.git</url>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
@ -37,6 +45,7 @@
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- smartgears -->
<dependency>
@ -55,6 +64,7 @@
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears-app</artifactId>
</dependency>
<!-- jersey -->
<dependency>
<groupId>javax.ws.rs</groupId>
@ -64,6 +74,7 @@
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.inject/jersey-cdi2-se -->
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
@ -74,6 +85,7 @@
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- add jackson as json provider -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
@ -84,10 +96,25 @@
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- add this plugin if you want to use gcube authorization control funzionalities -->
<!-- OPTIONAL generate the war in a different folder, that will be mounted on docker
container -->
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warName>identity-manager</warName>
<outputDirectory>tomcat/webapps</outputDirectory>
</configuration>
</plugin> -->
<!-- OPTIONAL. authorization-control-library: add this plugin if you want to use gcube
authorization control funzionalities -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>