Reviewed-on: #85 |
||
|---|---|---|
| .claude | ||
| .mvn/wrapper | ||
| src | ||
| .gitignore | ||
| Dockerfile | ||
| README-v4-datasources.md | ||
| README-v4-organizations.md | ||
| README-v4-persons.md | ||
| README-v4-projects.md | ||
| README-v4-research-products.md | ||
| README.md | ||
| RELEASE_NOTES.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 the 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'"
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 graph-api-[beta|prod]-x.y.z: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).
Git Flow
master— production-ready code, deployed to productiondevelop— integration branch, deployed to beta- Feature branches — created from
developfor new work
Workflow
- Create a feature branch from
develop(e.g.,task-id-my-feature) - Develop and test on the feature branch
- Merge the feature branch into
developvia pull request - Deploy
developto beta for testing - When ready for production, merge
develop→master - On
master: remove-SNAPSHOTfrompom.xmlversion (e.g.,1.3.0-SNAPSHOT→1.3.0) - Tag
masterwith the version (e.g.,git tag v1.3.0 && git push origin --tags) - Checkout the tag (e.g.,
git checkout v1.3.0) - Build & deploy from the tag
- On
develop: change version to next SNAPSHOT (e.g.,1.4.0-SNAPSHOT) - If issues arise → redeploy from the previous tag (
git tag --listto see available versions)
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-beta-x.y.z:latest .
docker tag graph-api-beta-x.y.z:latest docker-registry.openaire.eu/graph-api/graph-api-beta-x.y.z:latest
docker push docker-registry.openaire.eu/graph-api/graph-api-beta-x.y.z:latest
For production environment:
docker build --platform linux/amd64 -t graph-api-prod-x.y.z:latest .
docker tag graph-api-prod-x.y.z:latest docker-registry.openaire.eu/graph-api/graph-api-prod-x.y.z:latest
docker push docker-registry.openaire.eu/graph-api/graph-api-prod-x.y.z:latest