Buildly CLI Tutorial

This is part one of a three-part series for Greenfield development with Buildly. In this tutorial, we will go through the Buildly Command Line tool and deploy a scalable Buildly Core with Users, Templates, and Data Mesh along with one Buildly Marketplace service, the 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.

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

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

Would you like to Manage Users with Buildly? Yes [Y/y] or No [N/n] y
Would you like to use 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

:point_right: Choose Yes

 

Optional – Marketplace Apps


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 an 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.

:point_right: 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 to the Buildly Core.

For this tutorial :point_right: Choose No.

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

If you would like to know more about adding your own new services see our documentation: Connecting your service to Builldly 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

:point_right: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.

:point_right: 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] Y
Is 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.

:point_right: 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!


:point_right: To access your Buildly Core run the following command:

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

:point_right: Then open your browser with URL ‘http://127.0.0.1:8080

Buildly Core Doc


 

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 :point_right: Choose 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.

:point_right: 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/