# Export and Publish a Bundle

# Overview

Use the Entando bundler command to export a bundle of Entando components from an existing Entando application. An Entando bundle can be used to do the initial install of Entando components into an Entando application, migrate Entando components from one environment to another (e.g. Dev to QA), to provide a template for building a new Entando application, or as the skeleton of an Entando solution. The output of this command is the same bundle directory structure created by an Entando project including a bundle descriptor file.

# Prerequisites

  • Use the Entando CLI to verify you have the prerequisites in place for this tutorial (e.g. git, entando-bundler).
ent check-env develop 
  • You'll also need a running Entando application.
  • You'll need admin access to Keycloak or admin access to Kubernetes to set it up.

The tutorial assumes you're using an Entando quickstart application. You may need to adjust the specific URLs, credentials, namespaces, etc. for a custom application.

# Export an Entando Bundle

# Setup the Keycloak client

You'll need to setup a Keycloak client with the appropriate permissions for the bundler to access all of the necessary Entando APIs.

  1. Find the secret for the Keycloak admin account. If you already have the admin credentials, then you can skip to step 3.
kubectl get secrets -n entando 

In a quickstart application, the secret is named quickstart-kc-admin-secret

  1. Determine the admin password using the secret name.
kubectl get secret quickstart-kc-admin-secret -n entando -o go-template="{{println}}Username: {{.data.username | base64decode}}{{println}}Password: {{.data.password | base64decode}}{{println}}{{println}}"

Example output:

Username: entando_keycloak_admin
Password: 1pTZev82Ee
  1. Login to Keycloak using the admin credentials. The URL will be something like http://<YOUR-DOMAIN-OR-IP>/auth. You can use this command to verify the URL.
kubectl describe ingress/quickstart-kc-ingress
  1. Go to ClientsCreate
  2. Enter a Client ID of your choice, e.g. entando-bundler, and click Save.
  3. The Settings tab should be shown. Edit the following values:
  • Access Type: confidential
  • Service Accounts Enabled: On
  • Valid Redirect URLs: *
  • Web Origins: *
  1. Click Save
  2. Go to the Service Account Roles tab
  3. Select Client Rolesquickstart-server
  4. Select Available Rolessuperuser.
  5. Click Add Selected to add superuser to the Assigned Roles. This change will be saved automatically.
  6. Go to the Credentials tab and copy the Secret shown there. You'll need this in the next section.

# Create env.json

  1. Create a directory where you'll run the bundler and change to that directory.
mkdir testBundle; cd testBundle
  1. Create an env.json file with the environment URLs and client credentials. The clientId and clientSecret are from steps 5 and 12 above.
{
   "coreBaseApi": "http://<YOUR-DOMAIN-OR-IP>/entando-de-app",
   "k8ssvcApi": "http://<YOUR-DOMAIN-OR-IP>/k8s",
   "clientId": "<YOUR-CLIENT-ID>",
   "clientSecret": "<YOUR-CLIENT-SECRET>"
}

# Run the Bundler

  1. Create a child directory to hold the bundler output. Using the name bundle allows you to easily use the ent prj command with this bundle.
mkdir bundle
  1. Run the bundler command with your preferred settings.
ent bundler from-env --location bundle --code my-test-bundle --description “My Test Bundle”

The bundler will inspect the application using the Entando APIs, collect information about the individual components, construct the appropriate descriptor files, and finally assemble the top-level descriptor file.

$ ls bundle
assets      contentModels  contents         fragments  labels     pageModels  resources
categories  contentTypes   descriptor.yaml  groups     languages  pages       widgets

At this point you have a full Entando project structure. You can inspect the output to edit the exported components or you could deploy it to another Entando application.