Run RosaeNLG in production using Java and Docker

Ludan Stoecklé
2 min readNov 27, 2019

--

RosaeNLG is an open-source Natural Language Generator (NLG) written in JavaScript. Shipped as a npm package or as a plain JavaScript library, it can be used server side in any node.js application, or client side for browser rendering. But now you can also run it in a Java Virtual Machine — with or without Docker.

RosaeNLG’s logo, thanks to Denis Aulas

For an introduction on RosaeNLG, see Introducing RosaeNLG, an open-source Natural Language Generation library.

As it is written in JavaScript, RosaeNLG is primarily designed to run within a node.js server or a browser. Still, some users are reluctant to use node.js in production for security or taste reasons, or because of different local traditions, and prefer Java. Also, browser side rendering is simply not relevant for some use cases.

RosaeNLG is now available in the Java world thanks to GraalVM. Created by Oracle, GraalVM is a JavaScript engine written in Java. Properly configured, it sandboxes JavaScript libraries by forbidding them to access the file system, the network and the JVM internals.

The RosaeNLG Java Wrapper is a plain Java library, available on Maven Central to use RosaeNLG in any custom Java application.

The RosaeNLG Java Server is an API over the Java Wrapper. You simply upload your templates, and then render them. It comes in multiple flavors: a WAR file for classic application servers like Tomcat, a self-contained server to be run directly, and a Docker image. It is also available on Maven Central , and Docker images are hosted on Docker Hub.

These new components allow new ways of developing and running RosaeNLG templates:

  • Templates are still written with Pug-like syntax, with snippets of JavaScript to customize them, like a Domain Specific Language. But you can develop them without node.js, just using your favourite editor (VSCode is a good one with syntax highlighting for RosaeNLG templates) and the Docker Command Line Interface.
  • Once developed you can run them without node.js, using Tomcat, the embedded server or the Docker server image.

As usual, everything is open-source (MIT) and hosted on Github.

There is also a Node.js based server docker image, which is faster and lighter.

--

--

Ludan Stoecklé
Ludan Stoecklé

No responses yet