Skip to content

Latest commit

 

History

History
87 lines (52 loc) · 3.62 KB

README.md

File metadata and controls

87 lines (52 loc) · 3.62 KB

Epsilon Playground microservices

This project provides an alternative Micronaut-based implementation of the microservices needed for the Playground of the Eclipse Epsilon project.

Dependencies

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.

Structure

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.

Endpoints

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.

Core endpoints

  • 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.

Additional endpoints for the HTTP server

The HTTP server includes static assets for providing Ace-based syntax highlighting and icons.

Additional endpoints for the Google Cloud Function

  • POST /shorturl: allows for storing work in Google Cloud Storage and retrieving it later.

Building the project

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

Running the HTTP server

Locally from Gradle

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

From the Docker image

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

Deploying to Google Cloud Functions

Please check the README of the gcp-function module for details.