Skip to content

Commit

Permalink
Merge pull request #111 from rwth-acis/develop
Browse files Browse the repository at this point in the history
bring new release  updates to master branch
  • Loading branch information
beka-zhvania committed Mar 6, 2023
2 parents e6007b7 + 1620c72 commit 182a2e5
Show file tree
Hide file tree
Showing 298 changed files with 14,157 additions and 9,745 deletions.
7 changes: 3 additions & 4 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<classpathentry kind="lib" path="lib/commons-dbcp2-2.0.jar"/>
<classpathentry kind="lib" path="lib/commons-pool2-2.2.jar"/>
<classpathentry kind="lib" path="lib/bcprov-jdk15on-1.50.jar"/>
<classpathentry kind="lib" path="lib/y.jar"/>
<classpathentry kind="lib" path="lib/gs-algo-2.0.jar"/>
<classpathentry kind="lib" path="lib/gs-core-2.0.jar"/>
<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/commonj.sdo-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/la4j-0.4.9.jar"/>
Expand All @@ -20,7 +21,6 @@
<classpathentry kind="lib" path="lib/geronimo-jpa_2.0_spec-1.1.jar"/>
<classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/>
<classpathentry kind="lib" path="lib/mockito-all-1.9.5.jar"/>
<classpathentry kind="lib" path="lib/ysvg.jar"/>
<classpathentry kind="lib" path="lib/mason-19.jar"/>
<classpathentry kind="lib" path="lib/ojalgo-48.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-jxpath-1.3.jar"/>
Expand Down Expand Up @@ -71,10 +71,9 @@
<classpathentry kind="lib" path="lib/junit-4.13.1.jar"/>
<classpathentry kind="lib" path="lib/guava-18.0.jar"/>
<classpathentry kind="lib" path="lib/json-smart-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/las2peer-bundle-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/las2peer-bundle-1.2.2.jar"/>
<classpathentry kind="lib" path="lib/sbbi-upnplib-1.0.4.jar"/>
<classpathentry kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>
<classpathentry kind="lib" path="lib/yguard-3.0.0.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-14.0.2">
<attributes>
<attribute name="module" value="true"/>
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a Java project with Gradle

name: Java CI with Gradle

# Triggers the workflow on push events (on every branch)
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Set up Arangodb
uses: xinova/arangodb-action@v1
with:
arangodb version: 'latest' # See https://hub.docker.com/_/arangodb for available versions

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build WebOCD Service
run: ./gradlew build
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1643825602746</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
24 changes: 19 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:14-alpine
FROM openjdk:17-alpine
COPY . /usr/src/webocd
WORKDIR /usr/src/webocd
RUN apk update && apk add bash \
Expand All @@ -8,8 +8,22 @@ RUN apk update && apk add bash \
ghostscript-fonts \
build-base
# Fetch fitting gradle version manually because so far no os container has both jdk14 and a high enough gradle package version
RUN mkdir ../gradleFolder && wget https://services.gradle.org/distributions/gradle-6.8.3-bin.zip -P ../gradleFolder \
&& unzip -d ../gradleFolder ../gradleFolder/gradle-6.8.3-bin.zip && rm -R ../gradleFolder/gradle-6.8.3-bin.zip
RUN ../gradleFolder/gradle-6.8.3/bin/gradle build
RUN mkdir ../gradleFolder && wget https://services.gradle.org/distributions/gradle-7.3.2-bin.zip -P ../gradleFolder \
&& unzip -d ../gradleFolder ../gradleFolder/gradle-7.3.2-bin.zip && rm -R ../gradleFolder/gradle-7.3.2-bin.zip

# Replace HOST for database configuration (standard & for testing) with the db container name
RUN sed -i "s/^HOST.*/HOST=arangodb/" ocd/arangoDB/config_test.properties
RUN sed -i "s/^HOST.*/HOST=arangodb/" ocd/arangoDB/standard_config.properties


# This is to clean the previously generated agents and avoid error in case WebOCD was built before image creation
RUN ../gradleFolder/gradle-7.3.2/bin/gradle clean

# Execute gradle build and tests excluding db tests
RUN ../gradleFolder/gradle-7.3.2/bin/gradle build -x test
RUN ../gradleFolder/gradle-7.3.2/bin/gradle testWithoutDB

# Add a loop that waits for arangodb to run, before webocd service starts when start_network.sh is used
RUN sed -i '2 i while ! nc -z arangodb 8529; do sleep 10; done' bin/start_network.sh
RUN chmod +x bin/start_network.sh
CMD ["bin/start_network.sh"]
CMD ["bin/start_network.sh"]
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OCD Service - WebOCD

This is a RESTful web service offering various overlapping community detection algorithms(OCDA) and centrality measures/simulations. The service is developed with the Eclipse IDE and IntelliJ, so we recommend you to use one of these tools to work on the project.<br/>
This is a RESTful web service offering various overlapping community detection algorithms(OCDA) and centrality measures/simulations. The service is developed with the IntelliJ IDE, so we recommend you to use this tool to work on the project.<br/>
**WebOCD works best with its corresponding [web client](https://github.com/rwth-acis/OCD-Web-Client)**.

A running instance of WebOCD can be found at http://webocd.dbis.rwth-aachen.de/OCDWebClient/.
Expand All @@ -9,3 +9,20 @@ For any information on the service itself please refer to the [project wiki](htt

### Additional Notes
This service is based on the LAS2peer Template Project and its underlying LAS2peer framework. For any information on these please refer to https://github.com/rwth-acis/LAS2peer-Template-Project and https://github.com/rwth-acis/LAS2peer

# Building & Running WebOCD Service

WebOCD Service requires a running arangodb instance, which has to be [installed separately](https://www.arangodb.com/docs/stable/installation.html). In order for WebOCD to access the database, the configuration files, located under [ocd/arangoDB](/ocd/arangoDB) should be adjusted accordingly.

The service can be built using the gradle build task. Afterwards, it can be run using start_network.sh/start_network.bat scripts located in the [bin](/bin) directory (Consider changing the java heap size in the file with the ```-Xmx``` parameter to avoid storage allocation issues).

Alternatively, Docker can be used, as explained below, to run the WebOCD service and database in one line.

# Quickstart Docker
To build and run WebOCD Service using Docker, you can navigate to the REST-OCD-Service directory and execute
```
docker compose up
```
This will build and run containers for WebOCD service and arangodb, which is required for the service to run properly.

You can adjust the database container default password by modifying docker-compose.yml. Keep in mind to also change the config file [config.properties](ocd/arangoDB/config.properties), so that WebOCD tests as well as the service can use the database.
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3'
services:
arangodb:
image: arangodb
container_name: webocd-arangodb
ports:
- "127.0.0.1:8529:8529"
environment:
- ARANGO_ROOT_PASSWORD=password
webocd-service:
container_name: webocd-service
stdin_open: true # docker run -i
tty: true # docker run -t
restart: on-failure
depends_on:
- arangodb
build:
context: .
dockerfile: ./Dockerfile
links:
- arangodb
ports:
- "127.0.0.1:8080:8080"
9 changes: 5 additions & 4 deletions docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ The OCD Service is publicly accessible via this [link](http://webocd.dbis.rwth-a
Along with the service we provide a web client which also has its own [project](https://github.com/rwth-acis/OCD-Web-Client). The client can only be used with a valid Learning Layers account. We recommend to use the service along with the web client.


We additionally provide a brief [Integration Tutorial](/integration/) that shows you the usage of the most important requests so that you can get started with the OCD Service more quickly.
We additionally provide a brief [Integration Tutorial](/REST-OCD-Services/pages/wiki/integration/) that shows you the usage of the most important requests so that you can get started with the OCD Service more quickly. A more detailed usage examples of WebOCD Service, using the WebOCD webclient can be found here [link](/REST-OCD-Services/pages/tutorials/login).

## The OCD Service
The service is developed using the Eclipse IDE, so we recommend you to stick to that tool for any work on this project.
The service is developed using the IntelliJ IDEA, so we recommend you to stick to that tool for any work on this project.

Please refer to the following pages in order to obtain more information about the OCD Service.

Expand All @@ -41,9 +41,10 @@ Please refer to the following pages in order to obtain more information about th
+ [User Management and Authentication](/REST-OCD-Services/pages/wiki/user-management-and-authentication)
+ [Deploying the OCD Service](/REST-OCD-Services/pages/wiki/service-deployment)
+ [Database Configuration](/REST-OCD-Services/pages/wiki/database-configuration)
+ [Tutorials using WebOCD Service and Webclient](/REST-OCD-Services/pages/tutorials/login)

### Important
The OCD Service is largely based on the commercial **yFiles** library. You will only be able to run it yourself if you have access to the archive _y.jar_. The Chair i5 of RWTH Aachen University has a license for that library. If you are affiliated with that institute, please contact somebody to obtain the library. Also, keep in mind that the archive mentioned above must under no circumstances be publicly deployed or otherwise made publicly available. Please refer to [Deploying the OCD Service](/REST-OCD-Services/pages/wiki/service-deployment) for more information.
The WebOCD Service uses **ArangoDB** database, which has to be separately installed on the machine where the service runs. Alternatively, docker can be used to build the WebOCD Service together with the database. To build and run WebOCD Service with Docker, refer to [link](/REST-OCD-Services/pages/wiki/running#docker).

The service also currently requires **Java JDK 14** to be built and most likely also to run it. However, there also exists an older version for JDK 8 (tag [1.0.0](https://github.com/rwth-acis/REST-OCD-Services/tree/1.0.0)) which is still functional in case you need it.
The service also currently requires **Java JDK 17** to be built and most likely also to run it. However, there also exists an older version for JDK 8 (tag [1.0.0](https://github.com/rwth-acis/REST-OCD-Services/tree/1.0.0)) which is still functional in case you need it.

50 changes: 9 additions & 41 deletions docs/pages/wiki/build-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,27 @@ title: Build Process
---

# Introduction
The OCD Service is built via Gradle. We recommend a version similar to 6.8, yet others may also work. The project has mostly been developed with the Eclipse IDE using the gradle buildship plugin (most eclipse IDEs already include this), yet IDEs like IntelliJ are actively used as well. Finally note that you will likely need Java version 14 for the build to work without problems.

There also exists an older version using Apache Ant which is described at the bottom. Here, there are two build files, _build.xml_, and _ocd_build.xml_. Please do only use the _ocd_build.xml_. Note that Eclipse might illustrate errors for the build file because apparently it is not able to resolve the external target dependencies to the second build file correctly. This should not cause an issue. It is highly recommended that you build the project with Eclipse (To use Java 8 for the older version you may have to go with the Eclipse IDE for Java EE Developers variant) as this is the environment used during development and therefore the best tested one.
The OCD Service is built via Gradle. We recommend a version similar to 7.3, yet newer versions may also work. The project has mostly been developed with the IntelliJ IDEA. You can import the project into IntelliJ as a Gradle project. Finally note that you will likely need Java version 17 for the build to work without problems.

# Executing the Build Process

## First Build
When you are going to run the build process the very first time, you will need two manually obtain two libraries:
+ _y.jar_ forms part of the commercial yFiles library by yWorks which is not publicly available. Therefore you will have to add it manually to the project. The Chair i5 of RWTH Aachen University has a license for the library, so please contact somebody to obtain access. This will obviously only be possible if you are somehow affiliated with the Chair.
+ _ysvg.jar_ is an SVG writer for yFiles Graph2D objects that makes it possible to add useful features to generated SVG diagrams. The library is used for the visualization of graphs and covers.
Both libraries then have to be placed into the _yFiles_ folder.

Now, you just have to import the project as a gradle project via eclipse or simply open in via IntelliJ. After the first build, eclipse might still give you errors saying the yFiles jars are missing. To fix this, simply refresh the gradle project via the option you get from right clicking the folder.
When you are going to run the build process the very first time, you just have to import the project as a gradle project IntelliJ and execute the gradle *build* task. Make sure to adapt the database configuration _ocd/arangoDB/config.properties_ to fit your running ArangoDB instance.

After the build, you can then either start the _start_network.bat_ or _start_network.sh_ files in the bin folder to get the service running, see [Running the OCD Service](/REST-OCD-Services/pages/wiki/running) for more information.

## General Build
There are numerous targets which can be run. This summarizes the most important ones:
There are numerous gradle tasks which can be executed. This summarizes the most important ones:
+ _jar_: Generates the service jar in the _service_ and a copy in the _rest\_ocd\_services/export/jars_ directory. This archive is required for running the service.
+ _test_: Runs all jUnit tests . The test reports are stored in _rest\_ocd\_services/export/test_reports_.
+ _yguard_: Generates an obfuscated service jar in the _rest\_ocd\_services/export/obfuscated_ directory. This is required for public service deployment. Please refer to [Deploying the OCD Service](/REST-OCD-Services/pages/wiki/service-deployment) for more information. A log file of the obfuscation process is stored under _ocd/yGuard/log.xml_.
+ _build_: The target you'll likely be running most of the time. This executes the build process and generates a jar as well as the executables.
+ _startscripts:_ Generates startscripts into the bin folder that are used to start the service.
+ _generateAgents_: Generates the user and service agents as specified in _build.gradle_. The users will be loaded when the service (or more precisely the underlying LAS2peer node) is launched.
+ _clean_: Clean up files generated from the build. This should be executed before rebuilding.

# Potential Issues

Currently, the build might fail if a version of Java not equal to 14 (or 8 for the older version of the service) is used, even with eclipse in compliance mode for that version, and running the service with a version other than this one is also likely to cause errors.

## Linux Users
The system was mainly tested on Windows so far. For Linux, there is still a small issue with the old Ant Build. In case you receive an exception that the database (_db_) could not be created, please do manually remove the directory _db_ from the _ocd_ directory before the build.


# Executing the Old Ant Build Process

## First Build
When you are going to run the build process the very first time, please make sure to run the target _get_deps_ in order to obtain all dependencies.

Due to the yFiles library being commercial, there are three dependencies which will be missing and must be added manually to the _lib_ folder:
+ _y.jar_ forms part of the commercial yFiles library by yWorks which is not publicly available. Therefore you will have to add it manually to the project. The Chair i5 of RWTH Aachen University has a license for the library, so please contact somebody to obtain access. This will obviously only be possible if you are somehow affiliated with the Chair.
+ _yguard.jar_ is a free obfuscation tool by yWorks which is only required for public deployment of the service. Anybody can download it from this [link](https://www.yworks.com/downloads#yGuard). Refer to [Deploying the OCD Service](/REST-OCD-Services/pages/wiki/service-deployment) for more information. You can probably do without it.
+ _ysvg.jar_ is an SVG writer for yFiles Graph2D objects that makes it possible to add useful features to generated SVG diagrams. The library is used for the visualization of graphs and covers.

## Linux Users
Please make sure that the program _ocd/lfr/LfrBenchmarkLinux_ is executable (via `chmod +x <filename>`).
# Potential Issues
Currently, the build might fail if a version of Java not equal to 17 is used.

## General Build
There are numerous targets which can be run. This summarizes the most important ones:
+ _jar_: Generates the service jar in the _service_ and a copy in the _export/jars_ directory. This archive is required for running the service.
+ _generate_configs_: Generates the user and service agents as specified in _etc/ant_configuration_. The users will be loaded when the service (or more precisely the underlying LAS2peer node) is launched.
+ _junit_: Runs all jUnit tests (except _src/test/i5/las2peer/services/ocd/DatabaseInitializer.java_, take look at the target _setup_database_ for more information). The test reports are stored in _export/test_reports_.
+ _startscripts:_ Generates startscripts into the bin folder that are used to start the service.
+ _obfuscate_: Generates an obfuscated service jar in the _export/obfuscated_ directory. This is required for public service deployment. Please refer to [Deploying the OCD Service](/REST-OCD-Services/pages/wiki/service-deployment) for more information. A log file of the obfuscation process is stored under _ocd/yGuard/log.xml_.
+ _setup_database_: This is intended for automatically populating the database for presentation or debugging purposes. It is not required in any way to actually make the database work. The database is set up by running _src/test/i5/las2peer/services/ocd/DatabaseInitializer.java_ as a jUnit test. You can adapt the code in any way that suits your needs.
+ _all_: Runs all of the above except _setup_database_.
Running WebOCD Service might cause *AgentAccessDeniedException* if the *build* task was performed multiple times without having performed the *clean* task inbetween. If this occurs, simply do the *clean* task followed by the *build* task and the issue should be solved.

## Building with IntelliJ
For IntelliJ, you can follow the above guide as well. For correct indexing in the IDE you however need to add the lib folder as a library via right click. You might also want to double check that build.xml isn't selected as an ant build file instead of ocd_build.xml
Loading

0 comments on commit 182a2e5

Please sign in to comment.