This micro learning series will help you get familiar with Entando CLI (ENT) which simplifies building and deploying applications for Kubernetes.
In this lesson, we’ll learn how to use ENT CLI to package frontend and backend code changes to your application for deployment in 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 used to manage the code for frontend and backend components as well as the packaging of those components into bundles for deployment in 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 using 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.
From your project directory (hello-world), initialize the project.
ent prj init
Press enter to accept the default prompt.
This creates the settings for the project:
Entando uses bundles to package frontend and backend components.
Let’s create a bundle to test deployment to Kubernetes.
The code for this component is taken from dev.entando.org.
From your project directory (hello-world), create a bundle directory.
From your bundle directory, create a bundle descriptor: descriptor.yaml
The bundle descriptor is where we define our components.
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.
Then, add the component descriptor: 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:
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
Create a GitHub repository, and enter the URL.
Please provide the URL of the publication repository:
Enter your git user name.
Please provide the git user name:
Enter your git email.
Please provide the git email:
Enable credentials cache (y).
Should I enable the credentials cache for the publication of the frontend? (y/n/q)
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.
Below is a recap of the key steps, and a behind the scenes look at how Entando handles Kubernetes deployments.
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
Let’s see our component in action.
If you’re new to the Entando platform, we’ll be releasing a blog post in the coming weeks covering all of the fundamentals new developers will need to get started with Entando.
In this lesson, we learned how to deploy a basic component for our application with a few, simple commands.
In the next lesson, we’ll cover how ENT simplifies Kubernetes deployments for frontend developers and will cover how to deploy a simple Create React App as a micro frontend.
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.
This white paper outlines how your organization can accelerate UX innovation by developing with micro frontends on Kubernetes, as well as how a micro frontend platform can help you execute this methodology more effectively.