Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENDOC-539 Apply feedback re bundle cli #571

Merged
merged 10 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 38 additions & 29 deletions vuepress/docs/next/docs/getting-started/ent-bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,27 @@ sidebarDepth: 2

# Bundle Management

The Entando Bundle CLI extends the functionality of **ent** through a dedicated bundle management system. Starting with Entando 7.1, `ent bundle` orchestrates the lifecycle of a project, packaging it into a convenient and recognizable docker-based bundle that can be inserted into any Entando Application. This composable approach takes advantage of a single project descriptor and repository, along with centralized [API management](ent-api.md) and [DB and Keycloak services](ent-svc.md).
The Entando Bundle CLI extends the functionality of **ent** through a dedicated bundle management system. Starting with Entando 7.1, `ent bundle` orchestrates the lifecycle of a project, packaging it into a convenient and recognizable docker-based bundle that can be inserted into any Entando Application. This composable approach takes advantage of a single project descriptor and repository, along with centralized [API management](ent-api.md) and [DB and Keycloak services](ent-svc.md). Common operations and the steps required to create an Entando Bundle are detailed below.

Common `ent bundle` operations and the steps required to create an Entando Bundle are discussed in the following sections:

1. [Initialization](#initialization)
2. [Build](#build)
3. [Run](#run)
4. [Package](#package)
5. [Publish](#publish)
6. [Deploy](#deploy)

This document also describes the series of `ent ecr` commands that manage bundle interactions with the [Entando Component Repository](../../docs/compose/local-hub-overview.md) (ECR). These are applicable to both docker-based bundles and their git-based predecessors (< Entando 7.1). Finally, notable commands applicable to creating and deploying git-based bundles only are discussed.
In addition, this document describes the series of `ent ecr` commands that manage bundle interactions with the [Entando Component Repository](../../docs/compose/local-hub-overview.md) (ECR). These are applicable to both docker-based bundles and their git-based predecessors (< Entando 7.1). Notable commands applicable to creating and deploying git-based bundles only are also discussed.

## Entando 7.1 Bundle Development

Beginning with Entando 7.1, the `ent bundle` command and its convenience methods introduce a streamlined process to govern the structure, files and management of Entando bundles. The bundle development lifecycle is divided into 6 stages, each corresponding to a subcommand.
Beginning with Entando 7.1, the `ent bundle` command and its convenience methods introduce a streamlined process to govern the structure, files and management of Entando bundles. The bundle development lifecycle is divided into 6 stages, each corresponding to a subcommand:

- [Initialization](#initialization): `ent bundle init` initializes a new bundle project, either with the default files and folders or from an existing bundle in an Entando Hub. The bundle format relies on a single JSON descriptor as the project manifest.

The `init` subcommand initializes a new bundle project, either with the default files and folders or from an existing bundle in an Entando hub. The bundle format relies on a single JSON descriptor as the project manifest.
- [Build](#build): With the structure established, `ent bundle build` generates micro frontend (MFE) and microservice (MS) components. These are filtered by type and name and assigned version numbers.

With the structure established, the `build` subcommand executes processes appropriate to component type and stack.Micro frontend (MFE) and microservice (MS) components are generated in parallel. They are filtered by type and name and assigned version numbers.
- [Run](#run): `ent bundle run` and Keycloak integration enable components to be tested locally, external to an Entando cluster.

The `run` subcommand in conjuction with Keycloak integration enables components to be tested locally, external to an Entando cluster. Multiple components are run in parallel via commands dependent on type and stack, with a log file for each individual component generated in the .entando/logs directory.
- [Package](#package): `ent bundle pack` constructs the artifacts and Docker images for the bundle. A single image is created for the bundle and all micro frontends while each microservice is allocated its own image.

The `pack` subcommand constructs the artifacts and Docker images for the bundle. A single image is created for the bundle and all micro frontends while each microservice is allocated its own image. These are published to a Docker repository, after which the bundle can be deployed and installed.
- [Publish](#publish): `ent bundle publish` pushes the Docker images to a Docker repository, after which the bundle can be deployed and installed.

Once a bundle has been published, it can be delivered to the ECR of an Entando Application via the `deploy` subcommand. The bundle custom resource is exported and tags are retrieved from Docker Hub.
- [Deploy](#deploy): `ent bundle deploy` delivers a published bundle to the ECR of an Entando Application. The bundle custom resource is exported and tags are retrieved from Docker Hub.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still don't think export is accurate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess leave a comment on notion. to export a CR is common terminology and logical

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think export actually works here. What's happening here is creating the descriptor file for a custom resource - generated is the standard language in all the tools, hence ent prj generate-cr. Export implies taking something out of one system so it can be used in another but the custom resource is actually being written (generated) from the data in the repository. Arguably if the CR existed as a thing in the repository, then it might be an export but that isn't the case here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for clarifying; i had thought that the CR was generated in the cluster before the bundle was pulled into the ECR


In the final phase of bundle creation, the `install` subcommand applies the bundle to the Entando instance. It is then available in the App Builder for unlimited reuse within the application.
- [Install](#install): In the final phase of bundle creation, the `ent bundle install` applies the bundle to the Entando instance. It is then available in the App Builder for unlimited reuse within the application.

See [Build and Publish a Bundle Project](../../tutorials/create/pb/publish-project-bundle.md) for more details.

Expand Down Expand Up @@ -59,10 +52,12 @@ See [Build and Publish a Bundle Project](../../tutorials/create/pb/publish-proje
|:--|:--
|`ent bundle init [name]` | Initialize a new empty project with the default structure and files |
|`ent bundle init [name] --from-hub`| Initialize a bundle from the Entando Cloud Hub |
|`ent bundle init [name] --from-hub --hub-url=[url]` | Initialize a bundle from a custom Entando hub |
|`ent bundle init [name] --from-hub --hub-url=[url]` | Initialize a bundle from a custom Entando Hub |

#### Command Details
The option `--from-hub` leverages an existing bundle from an Entando hub to jumpstart your project. The ent bundle tool will pull the package and rebuild the structure, after which it can be customized locally. If the command does not include `--hub-url`, ent defaults to the Entando Cloud Hub. Include the option `--hub-url` to specify a custom hub.
- `--from-hub`: This option leverages an existing bundle from an Entando Hub to jumpstart your project. The ent bundle tool will pull the package and rebuild the structure, after which it can be customized locally.

- `--hub-url`: Use this option to specify a custom Entando Hub, else ent defaults to the Entando Cloud Hub

### Build

Expand All @@ -75,7 +70,13 @@ The option `--from-hub` leverages an existing bundle from an Entando hub to jump
|`ent bundle build --all-mfe`| Build all the micro frontends |

#### Command Details
The `build` command constructs the project files based on the `entando.json` descriptor and according to component stack. For instance, a React MFE executes an npm build process. A "build" log file is generated for each component inside the .entando/logs directory of the project.
- The `build` command constructs the project files based on the `entando.json` descriptor

- Component type and stack determines the build process, e.g. a React MFE executes an npm build

- All the components in the bundle are built in parallel

- A log file for each component is generated inside the .entando/logs directory of the project

### Run
| Command| Descriptions
Expand All @@ -87,8 +88,9 @@ The `build` command constructs the project files based on the `entando.json` des
|`ent bundle run --all-mfe`| Locally run all the micro frontends |

#### Command Details
The `run` command executes processes in accordance with the component type and stack. For example, `mvn spring-boot:run` is executed for a Spring Boot microservice. All the components in the bundle will run in parallel, with the logs printed to the standard output.
- The `run` command executes processes in accordance with the component type and stack, e.g `mvn spring-boot:run` is executed for a Spring Boot microservice

- All the components in the bundle run in parallel, with the logs printed to the standard output
### Package
| Command| Descriptions
|:--|:--
Expand All @@ -97,9 +99,9 @@ The `run` command executes processes in accordance with the component type and s
|`ent bundle pack --file [my-dockerfile]`| Use a custom Dockerfile for the bundle |

#### Command Details
When packaging the bundle, the artifacts generated for micro frontends and microservices are stored in their respective folders. File format depends on component type. For instance, a React micro frontend may result in HTML, JavaScript and CSS files.
- The artifacts generated for micro frontends and microservices are stored in their respective component folders. File format depends on component type, e.g. a React micro frontend may result in HTML, JavaScript and CSS files.

Once the artifacts are generated, Docker images for the microservices are built using the Dockerfile located in each respective folder. If the Dockerfile is missing, the `pack` command exits with failure.
- Once the artifacts are generated, Docker images for the microservices are built using the Dockerfile located in each respective folder. If the Dockerfile is missing, the `pack` command exits with failure.

### Publish
| Command| Descriptions
Expand All @@ -109,9 +111,13 @@ When packaging the bundle, the artifacts generated for micro frontends and micro
|`ent bundle publish --registry [registry]`| Publish the Docker images to a specified Docker registry |

### Deploy
| Command| Descriptions
| Command| Description
|:--|:--
|`ent bundle deploy`| Deploy a bundle to the Local Hub of an Entando Application |

### Install
| Command| Description
|:--|:--
|`ent bundle install`| Install a bundle in the Local Hub of an Entando Application |

## ECR Commands
Expand All @@ -130,13 +136,14 @@ The following commands are applicable to both docker-based and git-based bundles
|`ent ecr uninstall`| Uninstall a bundle |

#### Command Details
* `ent ecr get-bundle-id` and `ent ecr get-plugin-code`: The unique identifier assigned to each bundle provides a mechanism to customize parameters and add security controls for bundle-specific resources. Entando also generates a unique identifier for each microservice plugin.
* `ent ecr get-bundle-id`: The unique identifier assigned to each bundle provides a mechanism to customize parameters and add security controls for bundle-specific resources

* `ent ecr get-plugin-code`:
* Uniquely and safely identifies each bundle plugin and derived cloud-native resources
* Docker-based bundles make use of the options `[component-name] --repo=[repository-url]`
* Git-based bundles make use of the options `--auto --repo=[repository-url]`

* `ent ecr install --conflict-strategy=OVERRIDE`: If a project bundle has already been installed, the `--conflict-strategy` flag forces a `CREATE`, `SKIP` or `OVERRIDE` strategy for components.
* `ent ecr install --conflict-strategy=OVERRIDE`: If a project bundle has already been installed, the `--conflict-strategy` flag forces a `CREATE`, `SKIP` or `OVERRIDE` strategy for components

## Git-based Bundle Commands

Expand All @@ -161,9 +168,11 @@ The following ent commands are used to manage git-based (< Entando 7.1) bundles.

#### Command Details

* `ent prj get-bundle-id` and `ent prj get-plugin-code`: The unique identifier assigned to each bundle provides customization parameters and adds security controls for bundle-specific resources. Entando also generates a unique identifier for each microservice plugin.
* `ent prj get-bundle-id`: The unique identifier assigned to each bundle provides a mechanism to customize parameters and add security controls for bundle-specific resources

* `ent prj get-plugin-code`: Uniquely and safely identifies each bundle plugin and derived cloud-native resources

* `ent prj install --conflict-strategy=OVERRIDE`: If a project bundle has already been installed, the `--conflict-strategy` flag forces a `CREATE`, `SKIP` or `OVERRIDE` strategy for components.
* `ent prj install --conflict-strategy=OVERRIDE`: If a project bundle has already been installed, the `--conflict-strategy` flag forces a `CREATE`, `SKIP` or `OVERRIDE` strategy for components

* `ent bundler`: Provides an interactive mode to identify components to export. Point the bundler to existing environments to extract components and static assets into a custom bundle. This bundle can be used to migrate from one Entando environment to another (e.g. Dev to QA) or as a framework for building a new application.

Expand Down
22 changes: 12 additions & 10 deletions vuepress/docs/next/docs/getting-started/entando-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,32 @@ For specific topics, follow these links:

### Prerequisites

The basic requirements for the CLI vary with use case, as shown in the table below. The ent tool can install secondary dependencies using the `ent check-env` command as described [here](#check-the-environment).
The basic requirements for the CLI vary with use case, as shown in the table below.

| Category | Prerequisite
| :- | :-
|Basic Development| Git or [Git for Windows](https://gitforwindows.org)
| Basic Development| Git or [Git for Windows](https://gitforwindows.org)
| Install Entando in a local VM | [Multipass](https://multipass.run/#install)
| Build, Package and Publish Entando Bundles | Docker and Docker Compose
| | A Docker Hub account for Docker images
| Deploy an Entando Bundle | A Kubernetes cluster with admin access or a shared remote cluster

>The automatic option in [Getting Started](../getting-started/) will install the CLI along with a quickstart Entando Application.

## Install the CLI
Install the current official release of the CLI:
``` bash
curl -L https://get.entando.org/cli | bash
```

>The automatic option in [Getting Started](../getting-started/) will install the CLI along with a quickstart Entando Application.

### Check the Environment

Verify dependencies required by your Entando installation:
``` bash
ent check-env develop
```

## Command List
Use `ent help` to review the list of available commands.\
Use `ent [command] --help` for command details.
Expand Down Expand Up @@ -100,12 +108,6 @@ COMMANDS
run Run bundle components

```
### Check the Environment

The `check-env` command checks for dependencies appropriate to your Entando instance. Missing dependencies are automatically installed with the flag `-a`.
```
ent check-env develop -a
```

### Update the CLI
To update ent to the latest version and check for dependencies:
Expand All @@ -125,5 +127,5 @@ The `ent quickstart` command accepts parameters to customize your quickstart env
||ent quickstart --release="v7.2.0" | Use a specific release version for the install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing, we probably shouldn't use an example of 7.2.0 which doesn't exist yet. Either we should use the current release, or make it generic. Probably v7.1.0 is best.



### Reference
## Reference
* Source repository: <https://github.com/entando/entando-cli/tree/develop>