A REST interface to export MassBank records to other formats.
This server was generated by the OpenAPI Generator project and uses Spring Boot. It uses the RecordParserDefinition from the original MassBank project.
- Java 21
- Spring Boot 3.4
- maven
This microservice is configured with environment variables. It requires a
directory with the MassBank-data
release. This directory needs to be configured in the environment variable
MB_DATA_DIRECTORY
.
git clone https://github.com/MassBank/MassBank-data.git
export MB_DATA_DIRECTORY="./MassBank-data"
To configure CORS you can set the environment variable CORS_ALLOWED_ORIGINS
.
export CORS_ALLOWED_ORIGINS=http://localhost:3000
To run it behind a reverse proxy one must configure some X-Forward RequestHeader as descibed here. Here is an example for Apache:
RequestHeader set X-Forwarded-Prefix "/MassBank3-export"
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-Forwarded-Port 443
To make this work with a K8s nginx Ingress one needs to enable the property
use-forwarded-headers true
in the ingress-nginx-controller ConfigMap.
Build the service with Maven:
mvn package
Run the service:
java -jar target/massbank3-export-service-*.jar
To run the server in a Docker container, execute the following commands:
# Build the image
docker build -t massbank3-export-service .
# Clone the MassBank data repository
git clone https://github.com/MassBank/MassBank-data.git
# Start up a container
docker run -p 8080:8080 \
-v $(pwd)/MassBank-data:/MassBank-data \
-e MB_DATA_DIRECTORY='/MassBank-data' \
massbank3-export-service
Prebuilt Docker images are available from quay.io/massbank/massbank3-export-service. The fastest way to get things running is:
# Clone the MassBank data repository
git clone https://github.com/MassBank/MassBank-data.git
# Start up a container
docker run -p 8080:8080 \
-v $(pwd)/MassBank-data:/MassBank-data \
-e MB_DATA_DIRECTORY='/MassBank-data' \
quay.io/massbank/massbank3-export-service:latest
For a description of the service browse to the Swagger UI.