Commit 322d89bf authored by Truc Nguyen's avatar Truc Nguyen Committed by Agustin Larreinegabe

feat(dependencies): dependencies as Docker data image (BCD-305) (#104)

* feat(dependencies): dependencies as Docker data image (BCD-305)

* implicit named volume creation with docker run (removing 464d54cac1bc542ab6dc83660363ce4c378eda73d5c9e0073ecebe0c5b2dbb13 command)
parent 8fce0cb0
......@@ -11,9 +11,9 @@ By default `BCD_HOME` is set to `/home/bonita/bonita-continuous-delivery` in the
This option expects an existing relative or absolute path to a [BCD YAML scenario](scenarios.md) file.
The BCD scenario path can also be specified through the **`BCD_SCENARIO`** environment variable, hence allowing to skip the `-s / --scenario` command line option.
* Finally, the BCD CLI expects to find Bonita version-specific dependencies in the **`$BCD_HOME/dependencies`** directory. This directory must contain:
- `bonita-subscription_*.tar.gz` - (Mandatory) The Bonita Docker image archive
- `bonita-la-builder-*-exec.jar` - (Mandatory) The Bonita Living Application Builder library
- `bonita-sp-*-maven-repository.zip` - (Optional) The Bonita Maven repository zip if required by your Living Application workspace.
BCD dependencies may be retrieved as `bonitasoft/bcd-dependencies` Docker images and they must be mounted as volumes in the `$BCD_HOME/dependencies` directory.
## Usage examples
......
......@@ -22,32 +22,33 @@ Follow these installation steps on your control host.
$ unzip bonita-continuous-delivery_<version>.zip
This step creates a `bonita-continuous-delivery_<version>` directory which contains:
This step creates a `bonita-continuous-delivery_<version>` directory which contains Bonita Continuous Delivery Ansible playbooks and roles.
3. Pull the `quay.io/bonitasoft/bcd-controller:<version>` Docker image from Bonita private registry:
* Bonita Continuous Delivery Ansible playbooks and roles.
* A pre-built Docker image for the control host. This Docker image is provided as a `bcd-controller_<version>.tar.zip` archive located in the `bonita-continuous-delivery_<version>/docker` directory.
3. Load the `bcd-controller_<version>.tar.zip` Docker image:
$ docker login quay.io
$ docker pull quay.io/bonitasoft/bcd-controller:<version>
[...]
Status: Downloaded newer image for quay.io/bonitasoft/bcd-controller:<version>
$ docker logout quay.io
$ cd bonita-continuous-delivery_<version>/docker
$ unzip bcd-controller_<version>.tar.zip
$ docker load -i bcd-controller_<version>.tar
Loaded image: bonitasoft/bcd-controller:<version>
Loaded image: bonitasoft/bcd-controller:latest
The `bonitasoft/bcd-controller` Docker image is now available on the control host.
The `quay.io/bonitasoft/bcd-controller:<version>` Docker image is now available on the control host.
4. Make sure BCD dependencies are present.
BCD expects Bonita version-specific dependencies to be present in the `bonita-continuous-delivery_<version>/dependencies` directory. BCD dependencies are provided separately as a `bonita-continuous-delivery-dependencies_<bonita_version>.zip` archive.
Basically, the following artifacts must be extracted from the `bonita-continuous-delivery-dependencies_<bonita_version>.zip` archive into the `dependencies` directory:
* `bonita-subscription_<bonita_version>.tar.gz`
* `bonita-la-builder-<bonita_version>-exec.jar`
* `bonita-sp-<bonita_version>-maven-repository.zip`
BCD expects Bonita version-specific dependencies to be present in the `bonita-continuous-delivery_<version>/dependencies` directory. BCD dependencies are provided separately as a `quay.io/bonitasoft/bcd-dependencies:<bonita_version>` Docker data image.
Basically, the `/dependencies` volume provided by the `quay.io/bonitasoft/bcd-dependencies` Docker image must be mounted or copied into the `dependencies` directory. For instance, here is how to create a Docker named volume with BCD dependencies from the data image:
$ docker login quay.io
$ docker run --rm -v bcd-dependencies-<bonita_version>:/dependencies quay.io/bonitasoft/bcd-dependencies:<bonita_version>
$ docker logout quay.io
The `bcd-dependencies-<bonita_version>` Docker named volume is now available and can be mounted with your BCD Controller.
5. Start a BCD Controller Docker container on the control host:
$ docker run --rm -ti --hostname bcd-controller --name bcd-controller \
-v <host_path_to_bonita-continuous-delivery_directory>:/home/bonita/bonita-continuous-delivery \
bonitasoft/bcd-controller /bin/bash
-v bcd-dependencies-<bonita_version>:/home/bonita/bonita-continuous-delivery/dependencies/<bonita_version> \
quay.io/bonitasoft/bcd-controller:<version> /bin/bash
This command bind mounts the _bonita-continuous-delivery_ directory on the control host into the BCD controller container.
This command bind mounts the _bonita-continuous-delivery_ directory and the _bcd-dependencies-<bonita_version>_ volume on the control host into the BCD controller container.
::: info
You may also start a BCD Controller container using [Docker Compose](https://docs.docker.com/compose/) as described in the [BCD Controller image](bcd_controller.md) detailed documentation.
......@@ -101,26 +102,24 @@ Here is a complete example of how to install the BCD Controller Docker image.
**Warning**: This example uses _fake_ AWS credentials and SSH private key... :-)
Assuming you have a `bonita-continuous-delivery_2.0.0.zip` archive in your `$HOME` directory:
Assuming you have a `bonita-continuous-delivery_3.0.0.zip` archive in your `$HOME` directory:
$ cd $HOME
$ unzip bonita-continuous-delivery_2.0.0.zip
$ unzip bonita-continuous-delivery_3.0.0.zip
[...]
$ cd bonita-continuous-delivery_2.0.0/docker
$ unzip bcd-controller_2.0.0.tar.zip
$ docker login quay.io
$ docker pull quay.io/bonitasoft/bcd-controller:3.0.0
[...]
$ docker load -i bcd-controller_2.0.0.tar
Loaded image: bonitasoft/bcd-controller:2.0.0
Loaded image: bonitasoft/bcd-controller:latest
Status: Downloaded newer image for quay.io/bonitasoft/bcd-controller:3.0.0
Assuming you have a `bonita-continuous-delivery-dependencies_7.7.0.zip` archive in your `$HOME/bonita-continuous-delivery_2.0.0/dependencies` directory:
$ cd $HOME/bonita-continuous-delivery_3.0.0/dependencies
$ cd $HOME/bonita-continuous-delivery_2.0.0/dependencies
$ unzip bonita-continuous-delivery-dependencies_7.7.0.zip
$ docker run --rm -v bcd-dependencies-7.8.0:/dependencies quay.io/bonitasoft/bcd-dependencies:7.8.0
[...]
$ docker logout quay.io
The next steps of this example are required when using BCD to provision a Bonita stack on AWS.
$ cat ~/.boto
......@@ -134,7 +133,8 @@ The next steps of this example are required when using BCD to provision a Bonita
Finally here is a sample command to start a BCD controller container:
$ docker run --rm -ti --hostname bcd-controller --name bcd-controller \
-v ~/bonita-continuous-delivery_2.0.0:/home/bonita/bonita-continuous-delivery \
-v ~/bonita-continuous-delivery_3.0.0:/home/bonita/bonita-continuous-delivery \
-v bcd-dependencies-7.8.0:/home/bonita/bonita-continuous-delivery/dependencies/7.8.0 \
-v ~/.boto:/home/bonita/.boto \
-v ~/.ssh/bonita_us-west-2.pem:/home/bonita/.ssh/bonita_us-west-2.pem \
bonitasoft/bcd-controller /bin/bash
......
......@@ -32,10 +32,10 @@ The next step is to provide all dependencies required to build your repository.
**`bonita-la-builder-<bonita_version>-exec.jar`**
The Bonita Living Application Builder library. Its version must correspond to the **`bonita_version`** variable defined in your BCD scenario. This is the version of the Bonita stack where generated artifacts will be deployed.
For instance the `bonita-la-builder-7.7.0-exec.jar` file must be present to build artifacts meant to be deployed on a Bonita `7.7.0` stack.
For instance the `bonita-la-builder-7.8.0-exec.jar` file must be present to build artifacts meant to be deployed on a Bonita `7.8.0` stack.
**`bonita-sp-*-maven-repository.zip`**
Bonita Maven repository zip files if your repository contains [REST API extensions](https://documentation.bonitasoft.com/bonita/${bonitaDocVersion}/api-extensions). These zip files can be downloaded with your Bonita Subscription on [Customer Portal](https://customer.bonitasoft.com/). The version of the Maven repository zip must correspond to the `bonita.version` property defined in your REST API extension's `pom.xml`.
Bonita Maven repository zip files if your repository contains [REST API extensions](https://documentation.bonitasoft.com/bonita/${bonitaDocVersion}/api-extensions). The version of the Maven repository zip must correspond to the `bonita.version` property defined in your REST API extension's `pom.xml`.
### 3. Build the repository
......@@ -61,7 +61,7 @@ The version of your repository **must exactly match** the version of the builder
If versions do not match, the `bcd livingapp build` command will exit with such a message:
```
[ERROR] Project version (7.7.0) does not match builder version (7.7.1)
[ERROR] Project version (7.8.0) does not match builder version (7.7.4)
[13:46:34.469] ERROR: Aborting! Command <livingapp-build> returned non-zero exit code <1>
```
......@@ -70,7 +70,7 @@ The `bcd livingapp build` command does not allow to migrate your repository to t
## Complete example
Here is a complete example of how to build the [Bonita Vacation Management example repository](https://github.com/bonitasoft/bonita-vacation-management-example) for Bonita version 7.7.0.
Here is a complete example of how to build the [Bonita Vacation Management example repository](https://github.com/bonitasoft/bonita-vacation-management-example) for Bonita version 7.8.0.
In this example, the REST API extension has a dependency on Bonita 7.6.3.
**On the control host**
......@@ -100,14 +100,13 @@ $ grep "<bonita.version>" bonita-vacation-management-example/restAPIExtensions/t
<bonita.version>7.6.3</bonita.version>
$ ls -nh dependencies
total 337M
-rw-r--r-- 1 1000 1000 85M Mar 29 12:00 bonita-la-builder-7.7.0-exec.jar
total 94M
-rw-r--r-- 1 1000 1000 85M Mar 29 12:00 bonita-la-builder-7.8.0-exec.jar
-rw-rw-r-- 1 1000 1000 8,7M Mar 29 16:16 bonita-sp-7.6.3-maven-repository.zip
-rw-r--r-- 1 1000 1000 253M Mar 29 12:00 bonita-subscription_7.7.0.tar.gz
-rw-r--r-- 1 1000 1000 157 Mar 29 11:57 README.md
$ grep "bonita_version" scenarios/euwest1_performance.yml
bonita_version: 7.7.0
bonita_version: 7.8.0
```
......
......@@ -4,7 +4,7 @@
The following changes introduce incompatibility with BCD 2.x:
* By default, BCD no longer retrieves its dependencies from the fylesystem but uses a private docker registry. So the following parameters should be added to your scenarios:
* By default, BCD no longer retrieves its dependencies from the fylesystem but uses a private Docker registry. So the following variables must be added to your scenarios:
```
bcd_registry_user: YOUR_USER_TO_BCD_DOCKER_REGISTRY
bcd_registry_password: YOUR_PASS_TO_BCD_DOCKER_REGISTRY
......
......@@ -75,7 +75,7 @@ The following parameters are specific to the Bonita instances.
| Name | Mandatory | Default | Description | Sample |
|---------------------------------|-----------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| bonita_version | Y | - | Bonita version. Used for the Docker tar.gz filename | 7.7.0 |
| bonita_version | Y | - | Bonita version. Used for the Docker image tag name. | 7.8.0 |
| bonita_edition | N | performance | Allowed values: teamwork, efficiency, performance, enterprise. Used while generating Bonita licenses. | performance |
| bonita_cluster_mode | N | false | Activates cluster mode for Bonita. | false |
| bonita_cluster_qty | N | 1 | Number of instances for Bonita. This variable is also used in EC2 mode for the number of Bonita EC2 instance. | 1 |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment