# Build and Publish a Simple Bundle
# Overview
This tutorial describes how to create a simple Entando Bundle and deploy it into the Entando Component Repository (ECR). This process consists of 4 essential steps:
- Define the bundle component(s)
- Check the bundle artifacts into a Git repository
- Apply the bundle custom resource to Kubernetes
- Install the bundle into an application
# Prerequisites
- Verify dependencies with the Entando CLI:
ent check-env develop - Authenticated Git credentials
- An empty Git repository
- A running Entando instance
Publishing a bundle can be simplified by using the ent prj command and its publication system (pbs) convenience methods. Both the CLI and manual commands are provided.
# Create the Project Structure
Create a parent project directory (e.g.
example-bundle) and a childbundledirectory:mkdir -p example-bundle/bundle; cd example-bundle/bundleIn a project generated by the Entando Component Generator (ECG), the microservice and micro frontend source files are stored in the parent directory.
# Add a Simple Widget
Create a widget directory:
mkdir widgetsCreate a widget descriptor file within that directory:
touch widgets/example-widget.yamlPopulate the widget descriptor file
example-widget.yamlwith a simple definition. Retain the correct YAML indentation of 2 or 4 spaces.code: example-widget titles: en: Example Widget it: Widget d'esempio group: free customUi: <h2>Hi from Example Widget</h2>
# Create the Bundle Descriptor
In the child bundle directory, create a bundle descriptor file named
descriptor.yaml:touch descriptor.yamlAll of a bundle's components are defined within
descriptor.yaml, which is the main file processed by the ECR.Add the following definition to
descriptor.yaml:code: example-bundle description: This is an example of an Entando Bundle components: widgets: - widgets/example-widget.yamlComponent descriptor file names and locations (e.g.
widgets/example-widget.yaml) are arbitrary because the bundle descriptor explicitly points to those files. Convention is to group components by type with all widgets in one directory, all page templates in another, etc.
# Publish the Bundle
The steps to publish a bundle can be performed manually or automated with the CLI.
# CLI Steps
From the project directory, initialize an Entando project with default settings:
ent prj initInitialize the publication system. This requires the URL of an empty Git repository (ending in .git) and your Git credentials.
ent prj pbs-initPublish the bundle to Git. By convention, the first version is assigned the tag
v0.0.1, but the prefix "v" is optional.ent prj pbs-publishTo quickly push subsequent iterations of the bundle to Git, execute the
ent prj pbs-publishcommand. Each push will prompt you to input the corresponding bundle version. You must be consistent with versioning format and alphanumeric precedence to ensure that iterations are listed in the correct order.Deploy the bundle into the ECR:
ent prj deployThe
prj deploycommand uses the Git repository URL and project name (e.g.example-bundle) to create the custom resource.
# Manual Steps
From the bundle directory, run the following commands to initialize Git and commit the files:
git init git add . git commit -m "Init Git repository"Add your remote repository as origin and push the bundle:
git remote add origin https://your/remote/repository.git git push -u origin masterPublish a Git tag:
git tag -a "v0.0.1" -m "My first tag" git push --tagsCreate the Kubernetes custom resource for your bundle:
ent bundler from-git --name=example-bundle --namespace=entando --repository=https://YOUR-REMOTE-REPOSITORY.git --dry-run > example-bundle.yamlA bundle must be published to Git before you can create a custom resource for it. Provide the URL of the bundle's remote Git repository (ends with ".git"). To include a thumbnail for your bundle, use the option
--thumbnail-fileor--thumbnail-url.Transfer the file to your VM, e.g:
multipass transfer example-bundle.yaml entando:Apply the bundle definition to Kubernetes:
kubectl -n entando apply -f example-bundle.yamlConfirm the presence of your custom resource:
kubectl get EntandoDeBundle -n entando
# Install the Bundle into an Application
In your Entando instance, go to
App Builder→Component RepositoryClick
Install. A bundle with multiple iterations allows version selection.Verify the
Installbutton changes toUninstallto indicate that the installation completed successfullyGo to
App Builder→Components→Micro Frontends & Widgetsto confirm that your bundle appears in the "User" section