This blog series will help you get familiar with Entando's CLI (ENT) which simplifies building and deploying applications for Kubernetes. ENT CLI is your starting point and guide to all development on the Entando platform.
In this blog, we’ll learn how to use ENT CLI to package frontend and backend updates to your application for deployment to Kubernetes.
Today, we’ll dive into the "ent prj" (or project) command.
We’ll cover how to create a basic Entando component, package it into a bundle, deploy it to Kubernetes, and use it in your application. These steps are some of the building blocks to create any Entando application.
Entando projects are the source directory where you manage your code for frontend and backend "components". Components are packaged into "bundles" for deployment to Kubernetes.
Before we begin, let’s review the Entando concepts we’ll be using today.
An Entando "application" is made up of "components". Every part of an Entando application can be defined as code using components.
"Components" are the different parts that make up an Entando application like widgets, micro frontends, microservices, pages, content, and templates. You can find the full list of components at dev.entando.org.
"Components" are packaged and deployed to Kubernetes as "bundles."
First, let’s set up our development environment.
ent check-env develop
ENT simplifies environment setup by checking for required dependencies and automatically installing required Entando tools with a single command.
ENT stores the tools it installs in your $HOME/.entando directory.
Next, let’s create a directory for our project.
mkdir hello-world
From your project directory (hello-world), initialize the project.
cd hello-world
ent prj init
Press enter to accept the default prompt.
This creates the settings for the project:
Entando deploys updates to Kubernetes using "bundles".
From your project directory "hello-world", create a bundle directory.
mkdir bundle
From your bundle directory, create a bundle descriptor.
cd bundle
touch descriptor.yaml
Open descriptor.yaml, and enter the details for your bundle.
code: hello-bundle description: This is an example of an Entando bundle. components: widgets: - widgets/hello-widget.yaml
The bundle descriptor is where we define the components in our bundle.
Here, we’re adding a custom HTML widget that will be located in widgets/hello-widget.yaml.
Next, let’s add the widget we just defined "widgets/hello-widget.yaml".
From your bundle directory, create the widgets directory.
mkdir widgets
Add the component descriptor: hello-widget.yaml
cd widgets
touch hello-widget.yaml
Open hello-widget.yaml, and enter the details for the widget.
code: hello-widget titles: en: Hello Widget it: Ciao Widget group: free customUi:
Hello Widget
"customUi" is the field we use to add the custom HTML that will be displayed by our widget.
To push updates to Kubernetes, we’ll use ENT’s publication system.
From your project directory "hello-world", initialize the publication system.
ent prj pbs-init
Repository
Create a GitHub repository, and enter the URL.
Please provide the URL of the publication repository:
Example:
https://github.com/es-entando/hello-world.git
Username
Enter your git user name.
Please provide the git user name:
Enter your git email.
Please provide the git email:
Credentials
Enable credentials cache (y).
Should I enable the credentials cache for the publication of the frontend? (y/n/q)
Cache Expiration
Enter: 86400
86,400 seconds == 24 hours
Publish the project to your GitHub repository.
ent prj pbs-publish
Create a deployment yaml, and apply it to your Kubernetes cluster.
ent prj deploy
Install your component so that it’s available to be used in your Entando application.
ent prj install --conflict-strategy=OVERRIDE
Note: This is a time saving step that allows developers to install components via the command line instead of the browser.
Let’s see our component in action.
Let's review the key steps on how Entando packages application updates for deployment to Kubernetes.
Step 1: Build
Create an Entando project to define the components for your application in a bundle.
ent prj init
Step 2: Publish
Push the project with your bundled components to your Git repository.
ent prj pbs-publish
Step 3: Deploy
Deploy your bundled components to Kubernetes.
ent prj deploy
How Does Deployment Work Behind the Scenes?
First, ENT generates a deployment yaml for your bundle.
ent prj generate-cr
Specifically, it generates a Kubernetes custom resource (EntandoDeBundle) describing your bundle.
apiVersion: entando.org/v1 kind: EntandoDeBundle metadata: name: hello-bundle labels: widget: 'true' bundle-type: standard-bundle spec: details: name: hello-bundle description: This is an example of an Entando bundle. dist-tags: latest: v0.0.1 versions: - v0.0.1 tags: - version: v0.0.1 tarball: 'https://github.com/es-entando/hello-bundle.git'
Next, ENT applies the deployment yaml to your cluster.
ent prj generate-cr | ent kubectl apply -n entando -f -
This creates the EntandoDeBundle custom resource in your cluster.
The Entando Operator listens to events containing Entando custom resources, processes your EntandoDeBundle, downloads it from the specified Git repository, and makes it available to your application from the Entando Component Repository.
Step 4: Install
Install your components to make them available for use in your Entando application.
ent prj install
In the next lesson, we’ll cover how ENT simplifies working with multiple Entando applications across one or more Kubernetes clusters.
https://www.entando.com/
https://dev.entando.org/
Entando is an application composition platform for building enterprise web apps on Kubernetes.
Our platform integrates trusted open source technologies and extends their functionality to give you a cohesive and streamlined developer experience with easy-to-use patterns. From deploying on Kubernetes to creating modular backend and frontend architectures using your current technologies, Entando helps you at every layer of the stack.
Entando is open source with available enterprise support and services. Begin developing on the platform today, and get a quote to see how our team can help your enterprise build better apps, sites, and portals--faster.