KBEA-00178 Launch Cloudbees Test and Build Accelerator Cluster by docker-compose

Environment

Accelerator Cluster can be invoked on a host (Linux platform) in Docker containers by docker-compose. This section describes how to use docker-compose to launch Accelerator Cluster with containerized Cluster Manager, eMake and agents.

Tested product/plugin versions

This CloudBees Build Test Acceleration KB article is applicable for versions 12.0 and above.

Resolution

Installing Docker

To use Docker containers, you must download and install Docker. For instructions, see Docker Enterprise Edition or Docker Community Edition.

Installing Docker Compose

To use Docker Compose scenarios, you must download and install Docker Compose. For instructions see Install Docker Compose

Installing EFS and lofs

Accelerator normally uses its own kernel modules to provide two file systems (EFS and LOFS) required by agents. During a non-container agent installation, these kernel modules are compiled and loaded into the kernel to provide the necessary file system drivers. But if you plan to use agents in containers, you must install these modules separately.
CloudBees provides an EFS and LOFS installer. It compiles the efs100 and
lofs kernel modules if needed, tests them, and loads them into the kernel
to provide the drivers. These drivers must have the same build version as your agents.

To install the EFS and LOFS kernel modules:

  1. Log in as root.
    Make sure that gcc, make, and kernel headers are installed.

  2. These are required for compiling the kernel modules. For details about installing kernel headers, see the Prerequisites section in the System Requirements chapter of
    https://docs.cloudbees.com/docs/cloudbees-build-acceleration/latest/system-requirements/linux-platforms/

  3. Double-click the CloudBeesAcceleratorFileSystem--<version>.<build_number>-Linux-x86_64-Install installer file.
    This is inside the “containers” folder for the version on ShareFile:
    ./products/accelerator/release_<version>/<version>.<build_number>/linux/containers/
    For example, for Accelerator version 12.0, navigate to:
    ./products/accelerator/release_12.0/12.0.0.104615/linux/containers/

  4. Follow the prompts to complete the installation.
    The installation packages might need a few minutes to extract.

  5. Enter /etc/init.d/ecfs status and make sure that the EFS and LOFS kernel modules are running.

Launch CloudBees Test and Build Acceleration Cluster by docker-compose using images from Docker Hub repository

How to launch the Accelerator cluster using released images from Docker Hub:

1) Create a main folder on the host where docker and docker-compose are installed
For example with a name accelerator_cluster

2) Copy docker-compose.yml and .env files to that folder

.env

NIC=localhost
TAG=12.0

docker-compose.yml

version: '3.4'
services:
  cm:
    image: cloudbees/cbaccelerator-cm:$TAG
    ports:
        - 80:80
        - 8030:8030
        - 8031:8031
        - 443:443
    environment:
        NIC_IP: $NIC
  agents:
    image: cloudbees/cbaccelerator-agent:$TAG
    network_mode:   host
    environment:
        CM_HOST_AND_PORT: "$NIC:8031"
    privileged: true 
    depends_on: 
        - cm
  emake:
    image: cloudbees/cbaccelerator-emake:$TAG   

3) Edit .env file to change the value for key TAG if you need to use a preferable tag name that exists in the docker repository

TAG=12.0

4) Edit .env file to change the value for key NIC as host ip address

NIC=192.168.0.115

.env

NIC=192.168.0.115
TAG=12.0

NIC parameter will be passed to the ClusterManager as SSL trusted IP address and will be passed to the Agent containers as the address of ClusterManager.

5) Launch Accelerator cluster

Before launching containers be sure your working directory is your main directory

cd accelerator_cluster/  

To start your simple cluster with 1 Emake container, 1 ClusterManager container, 1 Agent container execute:

docker-compose -f  docker-compose.yml up -d

See more commands at the table:

descriptioncommands to run
Launch simmple Accelerator Clusterdocker-compose -f docker-compose.yml up -d
Launch Accelerator Cluster with few Agentsdocker-compose -f docker-compose.yml up -d --scale agents=4
To increase the number of Agent containersdocker-compose -f docker-compose.yml up -d --scale agents=6

To stop Accelerator Cluster and delete containers already created by docker-compose

To stop and delete containers started previously by docker-compose you can use the command:

   docker-compose -f docker-compose.yml dow

To delete containers and downloaded images use the command:

   docker-compose -f docker-compose.yml down --rmi all

Build own docker images on a premise and launch Accelerator Cluster using docker-compose

There is the possibility to build your own docker images and launch Accelerator Cluster using docker-compose. To do that you have to download CloudBeesAccelerator tarball files and extract tarballs to the main folder.

Follow steps, how to launch the Accelerator Cluster using local files to build own images:

1) Create a main folder, with a preferable name, on the host where docker and docker-compose installed

For example with the name - accelerator_cluster

2) To be able to build a Docker image for the ClusterManager, eMake, or Agent from a tar file:

a) Log in (using your personalized account) to the CloudBees ShareFile site.

b) Navigate to the following folder:
./products/accelerator/release_``<version>/<version>.``<build_number>/linux/containers/
For example, for Accelerator version 12.0, navigate to
./products/accelerator/release_12.0.1/12.0.1.104972/linux/containers/

c) Click to download the tar file for the Cluster Manager, eMake, or agent, and then click Download.

d) Extract the files to the main directory by entering:

tar xvzf CloudBeesAccelerator-12.0.1.104972-ContainerAgent.tar.gz
tar xvzf CloudBeesAccelerator-12.0.1.104972-ContainerEmake.tar.gz
tar xvzf CloudBeesAccelerator-12.0.1.104972-ContainerClusterManager.tar.gz

3) Copy docker-compose.yml and .env files to the main folder

.env

  NIC=localhost

docker-compose.yml

  version: '3.4'
services:
  cm:
    build:
        context: ./cm
        dockerfile: Dockerfile-cm-ubuntu
    ports:
        - 80:80
        - 8030:8030
        - 8031:8031
        - 443:443
    environment:
        NIC_IP: $NIC
  agents:
    build:
        context:  ./agent
        dockerfile: Dockerfile-ag-ubuntu
    network_mode:   host
    environment:
        CM_HOST_AND_PORT: "$NIC:8031"
    privileged: true 
    depends_on: 
        - cm
  emake:
    volumes:
        - /tmp:/tmp   # mount /tmp
    build:
      context: ./emake
      dockerfile: Dockerfile-emake-ubuntu

Edit .env file to change the value for key NIC as host ip address

NIC=192.168.0.115

.env

NIC=192.168.0.115

NIC parameter will be passed to the ClusterManager as SSL trusted IP address and will be passed to the Agent containers as the address of ClusterManager.

4) Launch Accelerator cluster

Before containers are launched, be sure your working directory is your main directory

  cd accelerator_cluster/  

To start your simple cluster with 1 Emake container, 1 ClusterManager container, 1 Agent container execute:

  docker-compose -f  docker-compose.yml up -d

See more commands at the table
| description | commands to run |
| ————- |:————-:|
| Launch simple Accelerator Cluster | docker-compose -f docker-compose.yml up -d |
| Launch Accelerator Cluster with few Agents | docker-compose -f docker-compose.yml up -d --scale agents=4 |
| To increase the number of Agent containers | docker-compose -f docker-compose.yml up -d --scale agents=6 |

Have more questions?

0 Comments

Please sign in to leave a comment.