Reviewed-on: #48 |
||
|---|---|---|
| .mvn/wrapper | ||
| src | ||
| .gitignore | ||
| Dockerfile | ||
| README.md | ||
| docker-compose-beta.yml | ||
| docker-compose.yml | ||
| mvnw | ||
| mvnw.cmd | ||
| pom.xml | ||
README.md
OpenAIRE Graph API
Welcome to the OpenAIRE Graph API code repository!
This repository houses the latest implementation of our OpenAIRE Graph API, designed to facilitate seamless access to metadata records of research products (i.e., publications, data, software, other research products), and projects within the OpenAIRE Graph.
For more information, please take a look at our documentation page.
Getting Started
Prerequisites
- Java 21 (tested using OpenJDK 21.0.2)
- Maven 3.6+
- Docker (optional, for containerized deployment)
Configuration
The application uses application.properties for configuration. Key properties include:
Solr Configuration
The application supports two connection modes for Solr:
solr.direct-connection.enabled- Set totruefor direct HTTP connection,falsefor ZooKeeper connection
Direct Connection Mode (when solr.direct-connection.enabled=true):
solr.url- Solr server URL (e.g.,http://solr1-v9-coordinator.openaire.eu:8983/solr/public)
ZooKeeper Connection Mode (when solr.direct-connection.enabled=false):
solr.zkHosts[0],solr.zkHosts[1],solr.zkHosts[2]- ZooKeeper host addressessolr.collection- Solr collection name (e.g.,public)
Running Locally
Option 1: Using Maven (Recommended for development)
mvn spring-boot:run
Option 2: Using IntelliJ IDEA
- Open the project in IntelliJ
- Find
src/main/java/eu/openaire/api/OpenaireRestApiApplication.java - Right-click and select "Run 'OpenaireRestApiApplication'"
Option 3: Build and run the JAR
# Build the project
mvn clean package
# Run the JAR
java -jar target/openaire-search-api-v2-*.jar
The application will be accessible at: http://localhost:8080/graph
Swagger UI: http://localhost:8080/graph/swagger-ui/index.html
Docker Support
Build the Docker image
# Build the project and create Docker image
mvn clean package
docker build -t openaire-search-api-v2:latest .
Run with Docker Compose
# Start the container
docker-compose up -d
# Stop the container
docker-compose down
Environment Variables
When running in Docker, you can override configuration using environment variables:
Solr Configuration:
SOLR_DIRECT_CONNECTION_ENABLED- Overridessolr.direct-connection.enabled(true/false)SOLR_URL- Overridessolr.url(used in direct connection mode)SOLR_ZKHOSTS_0- Overridessolr.zkHosts[0](used in ZooKeeper mode)SOLR_ZKHOSTS_1- Overridessolr.zkHosts[1](used in ZooKeeper mode)SOLR_ZKHOSTS_2- Overridessolr.zkHosts[2](used in ZooKeeper mode)SOLR_COLLECTION- Overridessolr.collection(used in ZooKeeper mode)
Other Configuration:
SCHOLIX_SERVER_BASE_URL- Overridesscholix.server-base-urlOPENAPI_SERVER_BASE_URL- Overridesopenapi.server-base-urlSERVER_SERVLET_CONTEXT_PATH- Overridesserver.servlet.context-path
These are configured in docker-compose.yml (local) and docker-compose-beta.yml (beta environment).
Deployment
Building and Pushing Docker Images to OpenAIRE Registry
Login to the OpenAIRE Docker registry:
docker login https://docker-registry.openaire.eu
For beta environment:
docker build --platform linux/amd64 -t graph-api-v2:beta .
docker tag graph-api-v2:beta docker-registry.openaire.eu/graph-api/graph-api-v2:beta
docker push docker-registry.openaire.eu/graph-api/graph-api-v2:beta
For production environment:
docker build --platform linux/amd64 -t graph-api-v2:prod .
docker tag graph-api-v2:prod docker-registry.openaire.eu/graph-api/graph-api-v2:prod
docker push docker-registry.openaire.eu/graph-api/graph-api-v2:prod