How To Install Monstarillo

H

In this tutorial you will learn how to install monstarillo. Monstarillo is a template based code generator that works against Postgres, MySQL and Oracle.

How it works 

Monstarillo runs templates that are executed by golang’s text template. The templates to run are identified in a json file. At a high level this file will identify the templates to execute, and where to put the output of the template. Monstarillo will also connect to a database and make metadata from the database available to your templates. This metadata includes column information (primary keys, column names, Golang, .Net, Java and Javascript datatypes) and table information (columns and relationships).

Install on a Mac

Install with Brew

brew tap monstarillo/monstarillo
brew install monstarillo

Test the installation from the command line.

monstarillo
Image of Monstarillo running on a Mac

Monstarillo has been installed.

Install on LINUX, windows & WSL

Install Go then Install monstarillo

go install github.com/monstarillo/monstarillo@latest

This will install monstarillo in $GOPATH/bin. Next we will add $GOPATH/bin to your $PATH to make running monstarillo easier.

You can run go env to see all of your go environment variables

go env running in WSL

Test monstarillo

monstarillo
Monstarillo running in WSL

Monstarillo has been installed.

Docker

Monstarillo can also be run inside of a docker image. To do so you will want to create a docker volume to share your Monstarillo templates and Monstarillo’s output with your host machine. You can use docker -v flag to do so. The following flag will map your local /home/patrick/tutorial to the docker image’s /usr/local/monstarillo. If you had a templates folder in /home/patrick/tutorial it would be accessed via /usr/local/monstarillo/templates in the container and you would use /usr/local/monstarillo/templates to point to your templates directory in your templates.

-v /home/patrick/tutorial:/usr/local/monstarillo

If you had installed monstarillo locally you would call monstarillo with:

monstarillo

To call monstarillo via Docker you would call it with:

docker run  --network=host -v /home/patrick/tutorial:/usr/local/monstarillo  monstarillo/monstarillo:latest

Notice the volume flag. i am also adding –network=host to have Docker share its network namespace with the host machine.

You have now installed Monstarillo. Next try to generate some code: Monstarillo Tutorial – generate database documentation or Generate a Rest API Using Go for a MySql Database or Generate a REST API Using Java for a MYSQL database

About the author

Patrick Wright

5 Comments

Patrick Wright

Get in touch