This project provides an alternative Micronaut-based implementation of the microservices needed for the Playground of the Eclipse Epsilon project.
To build this project, you will need:
- Java 17 (for Micronaut 4.x)
- Node.js 16 (for packing the JavaScript files in
http-server
)
Alternatively, you can open this project in VS Code and use the provided development container, which includes both.
The project is divided into three modules:
core
is a library that contains most of the implementations of the microservices.http-server
exposes the microservices as an HTTP server, which can be distributed as an uber-JAR or as a Docker image.gcp-function
exposes the microservices as a Google Cloud Function, and adds an endpoint for communicating with the Google Cloud Storage API.
The endpoints are CORS-aware: they allow requests from any origin with any headers and a Max-Age
set to 1 hour, but only with the methods listed below.
POST /emfatic2plantuml
: transforms a metamodel written in Emfatic to a PlantUML class diagram.POST /flexmi2plantuml
: transforms a model written in Flexmi that conforms to a metamodel written in Emfatic to a PlantUML class diagram.POST /epsilon
: runs an Epsilon script against a given set of metamodels (written in Emfatic) and models (written in Flexmi or XMI). The first model can alternatively be a JSON document.
GET /tools
: returns a JSON document according to the MDENet Education Platform tool specification.
The HTTP server includes static assets for providing Ace-based syntax highlighting and icons.
POST /shorturl
: allows for storing work in Google Cloud Storage and retrieving it later.
Run this command to build all modules and run the tests on the core endpoints:
./gradlew build
This will also build uber-JAR distributions of the HTTP server and the Google Cloud Functions, in the respective build/libs
directories of the modules.
After the project has been built, you can build a Docker image for the HTTP server as well:
cd http-server
../gradlew dockerBuild
To run the HTTP server locally, run:
./gradlew run
To customise the port used for the HTTP server, you can use the MICRONAUT_SERVER_PORT
environment variable:
MICRONAUT_SERVER_PORT=8010 ./gradlew run
This project publishes a Docker image to the Github Container Registry from its main
branch.
To run this image while exposing its endpoints on the 8010 port (e.g., to avoid the 8080 port used by the MDENet Education Platform), run:
docker run --rm -p 8010:8080 ghcr.io/epsilonlabs/playground-micronaut:0.1
Please check the README
of the gcp-function
module for details.