172 lines
5.8 KiB
Markdown
172 lines
5.8 KiB
Markdown
# Instructions
|
||
|
||
## Execution
|
||
|
||
start the docker container
|
||
```sh
|
||
|
||
cd dockerize && ./buildImageAndStart.sh -e
|
||
```
|
||
|
||
debug the docker container (read [### DEBUG] for details)
|
||
```sh
|
||
cd dockerize && ./buildImageAndStart.sh -d
|
||
```
|
||
|
||
to compile and push to harbor registry with a custom container.ini file:
|
||
```sh
|
||
cd dockerize && ./buildImageAndStart.sh -r -m -l -c "./docker/container-XXX.ini"
|
||
```
|
||
|
||
### Test URLs
|
||
obtain OAuth Access Token at https://next.dev.d4science.org/group/gcube/home
|
||
|
||
replace {{TOKEN}} with your token
|
||
|
||
```sh
|
||
TOKEN={{TOKEN}}
|
||
curl -l 'http://localhost:8080/helloworld/guest'
|
||
|
||
curl -l 'http://localhost:8080/helloworld/hello' -h 'Authorization: $TOKEN'
|
||
curl -l 'http://localhost:8080/helloworld/details' -h 'Authorization: $TOKEN'
|
||
|
||
curl -l 'http://localhost:8080/helloworld/auth/org_member' -h 'Authorization: $TOKEN'
|
||
curl -l 'http://localhost:8080/helloworld/auth/member' -h 'Authorization: $TOKEN'
|
||
```
|
||
|
||
|
||
```sh
|
||
curl -l 'http://localhost:8080/helloworld/gcube/resource/metrics'
|
||
curl -l 'http://localhost:8080/helloworld/gcube/resource/health'
|
||
```
|
||
|
||
### Debug
|
||
|
||
start the docker container in debug Mode
|
||
```cd dockerize && ./buildImageAndStartWithDebug.sh -d```
|
||
|
||
connect the JAVA debugger to port 5005
|
||
|
||
* VSCODE: press the green play button and start "Debug (Attach)
|
||
|
||
|
||
## Project Structure
|
||
```sh
|
||
│
|
||
# gitignore configuration
|
||
│ .gitignore
|
||
│
|
||
# readme, license, instruction files
|
||
├── CHANGELOG.md
|
||
├── FUNDING.md
|
||
├── Instructions.md
|
||
├── LICENSE.md
|
||
├── README.md
|
||
│
|
||
# maven configuration for the project
|
||
├── pom.xml
|
||
│
|
||
# the files in the gcube folder are processed by mvn parent during the packing fase
|
||
# the variables ${VAR} are resolved using the values found in pom.xml
|
||
# and the generated file are copied (respecting the gcube folder structure) inside the folder generated in ./target and so in the corrisponding war file
|
||
├── gcube
|
||
│ └── extra-resources
|
||
│ └── WEB-INF
|
||
# # defines the smartgear application configuration
|
||
│ └── application.yaml
|
||
|
|
||
# project sources
|
||
├── src
|
||
│ ├── main
|
||
│ │ ├── java
|
||
│ │ │ └── org
|
||
│ │ │ └── gcube
|
||
│ │ │ └── service
|
||
│ │ │ └── helloworld
|
||
# │ # # Applicatoin manager
|
||
│ │ │ ├── HelloWorldManager.java
|
||
# │ # # Smartgear 4 Health Checks
|
||
│ │ │ ├── health
|
||
│ │ │ ├── mappers
|
||
│ │ │ │ ├── ForbiddenExceptionMapper.java
|
||
│ │ │ │ └── IDMExceptionMapper.java
|
||
# │ # # rest APIs served by jaxb.
|
||
│ │ │ └── rest
|
||
│ │ │ ├── AuthenticatedService.java
|
||
│ │ │ ├── ExcludeAuthorizationService.java
|
||
│ │ │ └── *.java
|
||
│ │ ├── resources
|
||
│ │ │ └── META-INF
|
||
│ │ │ └── enunciate
|
||
│ │ │ └── d4science_docs.fmt
|
||
│ │ └── webapp
|
||
# # # WEB-INF resources are accessible to the resource loader of your Web-Application
|
||
# # # and not served directly to a client by the container
|
||
│ │ └── WEB-INF
|
||
│ │ ├── d4science_enunciate_custom.css
|
||
# # # deployment descriptor
|
||
│ │ └── web.xml
|
||
│ └── test
|
||
│ └── aaa.txt
|
||
│
|
||
# optional, vscode debug configuration
|
||
├── .vscode
|
||
│ ├── launch.json
|
||
│ ├── container.dev.ini
|
||
│
|
||
# optional, for local develop in docker containers
|
||
├── docker
|
||
│ ├── .gitignore
|
||
│ ├── container.dev.ini
|
||
│ ├── container.ini -> container.dev.ini
|
||
│ ├── devsec.gcubekey
|
||
│ └── logback.xml
|
||
├── build_conf
|
||
├── buildImageAndStart.sh
|
||
├── Dockerfile
|
||
│
|
||
# optional, sphinx configuration
|
||
├── sphinx
|
||
│ ├── Makefile
|
||
│ ├── conf.py
|
||
│ ├── index.rst
|
||
│ ├── make.bat
|
||
│ └── tests.rst
|
||
│
|
||
# optional, enunciate configuration
|
||
├── enunciate.xml
|
||
│
|
||
# project documentation
|
||
├── documentation
|
||
│ ├── dockerizing.md
|
||
│ │
|
||
# # postman collections to test the API
|
||
│ └── postman
|
||
│ ├── gcube-devsec-devVRE.postman_environment.json
|
||
│ └── Smartgears4 helloword.postman_collection.json
|
||
│
|
||
# the output of maven package
|
||
└── target
|
||
|
||
```
|
||
|
||
### 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
|
||
|
||
* dockerize/configuration folder: folder with the configurations for the exevution of the application. are copied in the docker container during building
|
||
|
||
* dockerize/configuration/container.ini: configurations for the docker container.
|
||
* create your own configuration copying an existing template
|
||
* the default execution uses dockerize/configuration/container.ini, it can be a simlink to a custom config
|
||
* gitignore ignores all container*.ini files in the folder excepting container.default.ini
|
||
*
|
||
* mode: [online/offline]: register the service on IS. use offline for local docker instances
|
||
|
||
* gcube folder: the files in the gcube folder are processed by maven-parent, the variables ${VAR} ara resolved using the values found in pom.xml and the generated file are put in the target folder and in the war file.
|
||
◊ |