Buildly CLI Tutorial

Part One of a three-part series for greenfield development with Buildly.

Karrla
buildly
5 min readMar 25, 2020

--

In this tutorial, we will go through the Buildly Command Line tool and deploy a scalable Buildly Core with Users, Workflow Templates and Buildly’s Data Mesh along with one Buildly Marketplace service (Notes Service) to a Minikube instance.

The Buildly Command Line Tools combines creating a local dev environment for your Buildly Core, with a set of one or more services, and the option to add one or more marketplace services to add to your application. The CLI tool also provides wizards to create new custom services. In our following tutorials, we will go into deploying to cloud services and then how to use the Buildly UI to admin your services.

The only must requirement to use Buildly is to build services in a Docker container. However, if you want to benefit from the pass-through and centralized authentication, as well as our data mesh module, you will need to use web token authentication and OpenAPI documented swagger endpoints.

Tutorial Requirements

Run the Buildly CLI

Navigate to your buildly-cli folder and run the create application command:

./init.sh --create-application/init.sh --create-application

This step will create a new application called “YourApplication” and will configure your Buildly Core to use the available components.

There are two application types to choose from:

[F/f] Fast and lightweight core allows only authentication and api gateway routing.
[S/s] Scalable and feature-rich core which will ask you if you want to add:

Manage Users: centralized auth to reduce round trips to an external user service

Workflow Templates: a workflow templating system to manage authorization and workflow design, while again, reducing round trip front end to back end queries

Data Mesh function: that allows you to create caching and aggregate queries to optimize your application ecosystem even more.

Choose Scalable and then choose Yes for each above service (Users, Workflow Templates, and Mesh)

Would you like to Manage Users with Buildly? Yes [Y/y] or No [N/n] y
Would you like to use Workflow Templates to manage reusable workflows with Buildly? Yes [Y/y] or No [N/n] y
Would you like to enable the data mesh functions? Yes [Y/y] or No [N/n] y

Next, you will be asked if you want to import from the marketplace

Would you like to import a service from the marketplace? Yes [Y/y] or No [N/n] y

Choose Yes

The marketplace section of the CLI provides a connection to the external Buildly open source marketplace where you can add pre-built services to your application, for your Buildly Core gateway to discover and configure.

Enterprise clients can also add an internal, or Innersource, marketplace to access their own reusable services like employee directories, customer lists, or any number of utility functions and tools.

For each service you choose, the CLI tool will clone the service to ‘YourApplication’/services/ directory.

Choose No for each service except choose Yes for the Notes_Service

Would you like to clone and use notes_service from the marketplace? Yes [Y/y] or No [N/n] y
Cloning into 'YourApplication/services/notes_service'...
remote: Enumerating objects: 74, done.
remote: Counting objects: 100% (74/74), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 74 (delta 16), reused 70 (delta 12), pack-reused 0
Unpacking objects: 100% (74/74), done.

Optional — New Service Wizard

The CLI tool provides the option to connect your own service(s) to the Buildly Core.

Would you like to create a service from scratch? Yes [Y/y] or No [N/n] n

Choose No.

If you would like to know more about adding your own new services see our documentation: Connecting your service to Buildly Core

Create a local Dev Instance

Next, deploy your Buildly Core and services.

Would you like to connect Buildly Core and your services to docker or a minikube instance? Docker [docker] or Minikube [minikube] minikube

For this tutorial, choose to deploy to Minikube

The CLI tool will download and configure a Minikube instance for you, connecting your Buildly Core and your services or will connect to your current running Minikube instance.

This part of the setup can take a little more time if you don‘t already use Minikube, but it‘s very helpful if you want to set up and run a local development environment.

Database Configuration

Next, configure a database for Buildly Core and services.

We will choose Yes for a PostgreSQL DB and Yes to use the default database environment variables.

Does the service "notes_service" need a PostgreSQL DB? Yes [Y/y] or No [N/n] YIs this service using the default database environment variables (DATABASE_HOST, DATABASE_PORT, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD)? Yes [Y/y] or No [N/n] y

Finally, enter the inbound and outbound ports for the Notes Service.

Enter: 8080 for both the incoming and outgoing ports

Let's expose the service internally, so Buildly Core can connect to it! 
Enter the service inbound port: 8080
Enter the service outbound port: 8080
service/notes-service exposed

Done!

To access your Buildly Core run the following command:

kubectl port-forward service/buildly-core-service 8080:8080 --namespace buildly

And open your browser with URL ‘http://127.0.0.1:8080'

Deploying to Cloud Services

The CLI tool will walk through the steps for deploying to AWS, GCP or Digital Ocean. In our following tutorials, we will go into deploying to cloud services, so for this tutorial, you can select No for each.

Would you like to deploy to AWS? [Y/y] or No [N/n] n
Would you like to deploy to GCP (Google Cloud)? [Y/y] or No [N/n] n
Would you like to deploy to Digital Ocean? [Y/y] or No [N/n] n

Restarting the CLI tool

Before you restart the CLI tutorial you will want to delete the namespace and remove the “YourApplication” folder.

To delete the buildly namespace run the following command

kubectl delete namespace buildly

Trouble?

Reach out to us on Gitter or on our new Tribe.io community!

or

Try the README files in the core or our documentation at https://buildly-core.readthedocs.io/en/latest/

--

--