Mastic is a set of code generation (scaffolding) tools.
Getting Started
You can follow the steps in this guide to get started with the mastic code generation.
You can refer to the Building Blocks document in order to understand each building block or the internal structure of this generator.
If you want to have a closer look at each stack (generated application structure), please refer to the Stacks document.
Install from Source Code
This chapter describe how the latest version of mastic can be installed from the sourec code repository.
You’ll need
in order to build and install mastic from source code.
-
Clone the source code from the generator git repositry
git clone git@gitlab.com:mastic/generator.git mastic
cd mastic
-
Build and link the generator
cd mastic
yarn install
yarn link
Now you can use the mastic generator from another directory where you want to generate your application into.
Generating your first Application
-
Create and navigate into an empty directory:
mkdir sample-app
cd sample-app
This directory name will be used as the default appllication name for the Application Definition (see below).
In order to generate an application you need the following files defining your application:
-
application.yml
: Application definition, see Application Definition -
stack.yml
: Stack definition, see Stack Definition -
model.yml
: Model definition, see Model Definition
If you don’t have any of those files, your application will be generated with a default definition using the default stack: Quarkus Stack
-
Generate your application
mastic
You’ll see a list of generated files and a list of stacks/aspects which have been processed.
The defauilt application will be based on the Quarkus Stack and have the following aspects:
-
docker-vm
-
docker-native
-
example-resource
You can see that in the stack.yml
file:
name: quarkus version: '0.1' aspects: - docker-vm - docker-native - example-resource
Building and Running your First Application
You’ll need Java JDK 1.8+ in order to build and run your application.
-
Build your application
./gradlew build --info
-
Run your application
java -jar build/<application-name>-0.1.0-SNAPSHOT-runner.jar
-
Checking the running application
You can either test your application from the command line
curl http://localhost:8080/hello
or go to the default endpoint with your web browser: http://localhost:8080/hello
You should get a response with the message hello
.
You have successfully generated, built and checked your first application. Now you can have a deep dive into the Building Blocks to learn about the internal parts of mastic and check out detailed documentation of every stack.
Building Blocks
TODO:
Application Definition
-
application.yml
: Application definition, see [application.yml]
Stack Definition
-
stack.yml
: Application Stack, see [stack.yml]
Model Definition
-
model.yml
: Model definition, see [model.yml]
Stacks
Quarkus Stack
This is a backend stack, based on the Cloud/Kubernetes/Docker Native Quarkus Framework.
Angular Stack
This is a frontend stack, based on the Mobile and Desktop Web Framework Angular.
Spring Stack
This is a backend stack, based on the Reactive Spring Framework.
Source Code
Source code is distributed in several repositories:
- Documentation (this document)
- Generator
Stack Samples
- Quarkus Stack
- Angular Stack
- Spring Stack
Some Utility Images
- GraalVM Image
- Angular CLI Image
- Puppeteer Image