Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
agarciadom committed Nov 2, 2023
1 parent abd829e commit 64d1728
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 14 deletions.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Epsilon Playground microservices

This project provides an alternative [Micronaut](https://micronaut.io/)-based implementation of the microservices needed for the [Playground](https://github.com/epsilonlabs/playground) of the [Eclipse Epsilon](https://eclipse.org/epsilon) project.

## Structure

The project is divided into three modules:

* [`core`](./core) is a library that contains most of the implementations of the microservices.
* [`http-server`](./http-server) exposes the microservices as an HTTP server, which can be distributed as an uber-JAR or as a Docker image.
* [`gcp-function`](./gcp-function) exposes the microservices as a Google Cloud Function, and adds an endpoint for communicating with the Google Cloud Storage API.

## Endpoints

### Core endpoints

* `POST /emfatic2plantuml`: transforms a metamodel written in [Emfatic](https://eclipse.dev/emfatic/) to a [PlantUML class diagram](https://plantuml.com/class-diagram).
* `POST /flexmi2plantuml`: transforms a model written in [Flexmi](https://eclipse.dev/epsilon/doc/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).

These endpoints accept the `OPTIONS` method as well.

### Additional endpoints for the Google Cloud Function

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

These endpoints accept the `OPTIONS` method as well.

## Building the project

Run this command to build all modules and run the tests on the core endpoints:

```bash
./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:

```bash
cd http-server
../gradlew dockerBuild
```

## Running the project

To run the HTTP server locally, run:

```bash
./gradlew run
```

## Deploying to Google Cloud Functions

Please check the [`README` of the `gcp-function` module](./gcp-function/README.md) for details.
26 changes: 12 additions & 14 deletions gcp-function/README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
## Micronaut 4.1.6 Documentation

- [User Guide](https://docs.micronaut.io/4.1.6/guide/index.html)
- [API Reference](https://docs.micronaut.io/4.1.6/api/index.html)
- [Configuration Reference](https://docs.micronaut.io/4.1.6/guide/configurationreference.html)
- [Micronaut Guides](https://guides.micronaut.io/index.html)
---

# Micronaut and Google Cloud Function
# Google Cloud Function for Epsilon Playground

## Deploying the function

First build the function with:

```bash
$ ./gradlew clean shadowJar
./gradlew clean shadowJar
```

Then `cd` into the `build/libs` directory (deployment has to be done from the location where the JAR lives):

```bash
$ cd build/libs
cd build/libs
```

Now run:

```bash
$ gcloud functions deploy playground-fn-flexmi2plantuml --entry-point org.eclipse.epsilon.labs.playground.fn.flexmi2plantuml.Function --runtime java17 --trigger-http
$ gcloud beta functions deploy playground-micronaut --entry-point io.micronaut.gcp.function.http.HttpFunction --runtime java17 --trigger-http
```

Choose unauthenticated access if you don't need auth.

To obtain the trigger URL do the following:

```bash
$ YOUR_HTTP_TRIGGER_URL=$(gcloud functions describe playground-fn-flexmi2plantuml --format='value(httpsTrigger.url)')
YOUR_HTTP_TRIGGER_URL=$(gcloud functions describe playground-micronaut --format='value(httpsTrigger.url)')
```

You can then use this variable to test the function invocation:

```bash
$ curl -i $YOUR_HTTP_TRIGGER_URL/playground-fn-flexmi2plantuml
curl -i $YOUR_HTTP_TRIGGER_URL/playground-micronaut
```

- [Shadow Gradle Plugin](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow)
- [Micronaut Gradle Plugin documentation](https://micronaut-projects.github.io/micronaut-gradle-plugin/latest/)
- [GraalVM Gradle Plugin documentation](https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html)

## Feature google-cloud-function documentation

- [Micronaut Google Cloud Function documentation](https://micronaut-projects.github.io/micronaut-gcp/latest/guide/index.html#simpleFunctions)

## Micronaut 4.1.6 Documentation

- [User Guide](https://docs.micronaut.io/4.1.6/guide/index.html)
- [API Reference](https://docs.micronaut.io/4.1.6/api/index.html)
- [Configuration Reference](https://docs.micronaut.io/4.1.6/guide/configurationreference.html)
- [Micronaut Guides](https://guides.micronaut.io/index.html)

0 comments on commit 64d1728

Please sign in to comment.