This document outlines the communication protocol that Quassar's platform expects from external builders, along with an example Dockerfile specification and the usage of the Java library that supports the protocol. The goal is to provide a comprehensive guide for developers who wish to integrate their Docker images with Quassar.
Quassar is an online development platform that allows domain modeling with minimal code using a Domain-Specific Modeling Language (DSML). The models created can be compiled to generate executable code in various programming languages. This code can be included as a library in another project or executed directly on the platform.
External builders are responsible for transforming these models into executable code. To integrate with Quassar, builders must meet specific requirements and be packaged as Docker images, which are then published on Docker Hub or an Artifactory.
This manual details how external builders should communicate with Quassar and provides detailed examples of how to create a compliant builder.
The builder must follow this communication flow when interacting with the Quassar platform:
The input file for the External Builder API consists of key-value pairs, where each property is described by its name on one line and its corresponding value on the next. For certain properties like def.file, the value may span multiple lines, with each line representing a separate entry. At the end of this, a double break line is expected.
Below is an example of the file structure and the corresponding description of each parameter.
/konos/src/io/intino/konos/dsl/ui/UI.tara
/konos/src/io/intino/konos/dsl/DataHub.tara
projectNamemoduleName/Users/lorenipsum/projectName/Users/lorenipsun/moduleName/Users/lorenipsun/moduleName/gen/Users/lorenipsun/moduleName/out/Users/lorenipsun/moduleName/res/Users/lorenipsun/moduleName/src/Users/lorenipsun/.m2/repositoryUTF-8Build for production builds.BuildMetta:2.0.0com.example.dsllorenipsumgroupId of the DSL builder.io.intinoartifactId of the DSL builder.konos13.0.0groupId of the runtime environment for the DSL.io.intino.magritteartifactId of the runtime environment for the DSL.framework5.2.1The builder should return clear and precise error messages. Errors should relate to issues with the compilation process or internal builder failures. Example error response:
To integrate an external builder with Quassar, a Docker image must be created that meets the following requirements:
The Dockerfile of the example creates a Docker image based on the slim version of OpenJDK 21. The image is configured to run a builder (indicated by the labels) and is designed to handle build operations. Below is a breakdown of the Dockerfile:
FROM openjdk:21-jdk-slim LABEL maintainer="octavio.roncal <octavioroncal@siani.es>" LABEL version="1.3.0" LABEL description="Loren Ipsum compiler" LABEL operations="Build" LABEL targets="Java" COPY out/build/builder/builder.jar /root/app/ COPY out/build/builder/lib /root/app/lib COPY docker/run-builder.sh /root/app/ WORKDIR /root/app RUN chmod +x /root/app/run-builder.sh ENTRYPOINT ["/root/app/run-builder.sh"]
The run-builder.sh script is a simple Bash script that runs the builder.jar and directs the output to a log file:
java -jar /root/app/builder.jar /root/project/args.txt > /root/project/output.log 2>&1
The operations and targets labels are mandatory for the Docker image:
As part of the communication protocol, the Quassar building platform will place the argument file at the path /root/project/args.txt inside the container. This file contains all the necessary input and configuration parameters required by the builder to execute the compilation process. The builder must read from this file to initiate the build process. Additionally, all output from the build process, including both standard output and error messages, should be logged into the file /root/project/output.log. This ensures that any relevant information, including error diagnostics and build status, is captured for review.
This Dockerfile uses OpenJDK 21 and Maven to build the project and generate the executable. Make sure to adjust it based on your specific needs.
Quassar provides a Java library that facilitates interaction with the platform through the External Builder API. Below is an explanation of how to integrate it into your project.
You can add the library dependency to your pom.xml (if you’re using Maven):
<dependency>
<groupId>io.quassar</groupId>
<artifactId>quassar-builder-sdk</artifactId>
<version>1.0.0</version>
</dependency>
To initialize the builder and connect it to the platform, follow these steps:
import com.quassar.sdk.QuassarBuilder;
public class BuilderApp {
public static void main(String[] args) {
QuassarBuilder builder = new QuassarBuilder();
builder.start();
}
}
The library provides the following key methods for interaction:
...
A builder is a component responsible for taking a domain model and transforming it into executable code or a ready-to-use artifact.
The builder uses an API that communicates with Quassar via JSON-formatted requests and responses.
For more information, questions, or support, contact our team at support@quassar.io.