This repository contains a backend API for the ORKG based on the Spring Framework. It is written in Kotlin as a proof-of-concept and for experimenting with a possible architecture and technologies.
The backend API can be run stand-alone. However, it needs other services to start properly. Services are managed via Docker (CE) and the Docker Compose plugin. Please follow the respective installation instructions for your operating system or distribution.
Warning
|
The Docker Compose standalone binary will not work, you need the Docker Compose plugin for the Docker CLI. Users of Docker Desktop will have it installed already, and do not need any additional installation. |
Note
|
Running the application stand-alone is mostly for development purposes. It still needs Neo4j and PostgreSQL configured and running. If you want to test the application, please refer to the section Building a Docker image below. |
To build and run the API, type:
./gradlew bootRun
This will start a server running on http://localhost:8080.
The REST entry-point is http://localhost:8080/api/.
Note
|
The following commands assume that you added your user to the docker group as suggested in the documentation.
If you did not do so, you have to prefix all commands with sudo .
|
The Docker image can be build with Jib. Run:
./gradlew jibDockerBuild
The application can be run via Docker Compose. After installing it, run:
docker compose up -d
Warning
|
In the past, it was possible to use this software with the standalone Docker Compose binary, which is deprecated by Docker Inc. for quite a while now. We only support using the Docker Compose plug-in now, which is installed by default in most Docker installations. |
This will start the application image and all dependent containers. It will take care of linking all containers so the services can see each other. You can start and connect all services yourself but this is not recommended.
The application can be accessed via http://localhost:8080/. The other services can be accessed via the URLs described in the table "Images and their default end-points".
To diagnose problems, check the logs with:
docker compose logs -f
To restart from scratch, run:
docker compose down
Data is saved to named volumes for Neo4j and Postgres, respectively, and persists even if you destroy the containers.
If you also need to get rid of the data use the docker volume
sub-commands to locate and remove them.
Note
|
This section is only relevant if you want to work with some of the components in isolation. Please refer to the section Building a Docker image if you want to run the application via Docker. |
Caution
|
The recommended way to start the Backend is (still) via Docker Compose. |
The images will provide the following end-points:
Image | Container name | End-points |
---|---|---|
|
|
http://localhost:8080/api/ (REST API) |
|
|
http://localhost:7474/browser/ (HTTP) |
|
|
localhost:5432 |
All exposed ports are bound to localhost
(IPv4 and IPv6) to not "leak" to all networks.
If you need to expose those to your host network, refer to the Docker documentation and change the Compose file accordingly.
The Neo4j Docker image includes the following extensions:
APOC is required by the ORKG. You need to include it when you setup Neo4j in your environment manually.
The documentation can be found at https://tibhannover.gitlab.io/orkg/orkg-backend/api-doc/index.html.