Files
openblocks/server/api-service

Server Setup

This document explains how to start Openblocks server locally.

System Prerequisites

Java - OpenJDK 17 Maven - Version 3+ (preferably 3.8+)

MongoDB

If you don't have an available MongoDB, you can start a local MongoDB service with docker:

docker run -d  --name openblocks-mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=openblocks mongo

Configure the MongoDB connection URI in the application-openblocks.yml

Redis

If you don't have an available MongoDB, you can start a local Redis service with docker:

docker run -d --name openblocks-redis -p 6379:6379 redis

Configure the Redis connection URI in the application-openblocks.yml

Build and start the Openblocks server jar

  1. Clone Openblocks repository
  2. Next, execute the following commands in sequence
cd server
mvn clean package
java -Dpf4j.mode=development -Dspring.profiles.active=openblocks -Dpf4j.pluginsDir=openblocks-plugins -jar openblocks-server/target/openblocks-server-1.0-SNAPSHOT.jar
Now, you can check the status of the service by visiting http://localhost:8080 through your browser. By default, you should see an HTTP 404 error.

Start with IntelliJ IDEA

Configure the Run/Debug configuration as shown in the screenshot below, the version used in the screenshot is IntelliJ IDEA 2021.3.2 (Community Edition):

JDK version Java 17
-cp openblocks-server
VM options -Dpf4j.mode=development -Dpf4j.pluginsDir=openblocks-plugins -Dspring.profiles.active=openblocks -XX:+AllowRedefinitionToAddDeleteMethods --add-opens java.base/java.nio=ALL-UNNAMED
Main class com.openblocks.api.ServerApplication

Next, execute the following commands in sequence

cd server
mvn clean package

After Maven package runs successfully, you can start the Openblocks server with IntelliJ IDEA.