KBEA-00163 Configuring ElectricAccelerator to Run in Docker Containers

ElectricAccelerator includes an integration to support Docker on Linux platforms. This section describes how to configure a containerized Cluster Manager, eMake, or agents.

Supported Use Cases

  • In version 10.0, ElectricAccelerator supports running multiple agents per container and a single container per host.
  • In version 10.1 and newer versions, ElectricAccelerator supports running a single agent per container and multiple containers per host.

Installing Docker

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

(Agent Installations Only) 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 run agents in containers, you must install these modules separately.

Electric Cloud 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.

2. Make sure that gcc, make, and kernel headers are installed.

These are required for compiling the kernel modules. For details about installing kernel headers, see the “Supported Linux Platforms” section in the “Supported Platforms and System Requirements” chapter of the ElectricAccelerator Installation and Configuration Guide at http://docs.electric-cloud.com/accelerator_doc/AcceleratorIndex.html.

3. Double-click the ElectricAcceleratorFileSystem-<version>-<platform>-Install installer file.

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.

Building Your Docker Image from a Tar File

To build a Docker image for the Cluster Manager, eMake, or agent from a tar file:

1. Log in (using your personalized account) to the Electric Cloud ShareFile site at https://electric-cloud.sharefile.com/Authentication/Login.

2. Navigate to the following folder:

./products/accelerator/release_<branch_num>/<version>/linux/containers/

For example, for ElectricAccelerator version 10.0, navigate to

./products/accelerator/release_10_0/10.0.0.77418/linux/containers/

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

4. Unzip and untar the file by entering:

tar xvzf ElectricAccelerator-<version>-Container<component>.tar.gz

For example:

tar xvzf ElectricAccelerator-10.0.77418-ContainerAgent.tar.gz

5. Build a Docker image by entering:

docker build -t <image name> -f <component_folder_name>/Dockerfile-<component>-<os> <component_folder_name>

or:

docker build --tag=<image name> --file=<full_path_to_component_Dockerfile> <full_path_to_component_folder>

For example:

docker build -t cm_img -f cm/Dockerfile-cm-ubuntu cm

Following are specific instructions for downloading a tar file for a specific component and building a Docker image on Ubuntu 16.x.

Component

Steps to Download Tar File and Build Image

eMake

  1. Download the ElectricAccelerator-<version>-ContainerEmake.tar.gz file from the Electric Cloud ShareFile folder as described above.
  2. Enter:
    tar xvzf ElectricAccelerator-<version>-ContainerEmake.tar.gz 
    The files are extracted to a directory named emake.

    3. Enter:

docker build -t=<emake_image_name> -f=emake/Dockerfile-emake-ubuntu emake

        or  

  docker build -t=<emake_image_name> -f=/path/emake/Dockerfile-emake-ubuntu 
/path/emake

Cluster Manager

  1. Download the ElectricAccelerator-<version>-ContainerClusterManager.tar.gz file from the Electric Cloud ShareFile folder as described above.
  2. Enter:
    tar xvzf ElectricAccelerator-<version>-ContainerClusterManager.tar.gz

    The files are extracted to a directory named cm.

    3. Enter:

     docker build -t=<cm_image_name> -f=cm/Dockerfile-cm-ubuntu cm

       or     

     docker build -t=<cm_image_name> -f=/path/cm/Dockerfile-cm-ubuntu /path/cm

Agent

  1. Download the ElectricAccelerator-<version>-ContainerAgent.tar.gz file from the Electric Cloud ShareFile folder as described above.
  2. Enter:
    tar xvzf ElectricAccelerator-<version>-ContainerAgent.tar.gz file 
    The files are extracted to a directory named agent.

    3. Enter:

    docker build -t=<agent_image_name> -f=agent/Dockerfile-agent-ubuntu agent

      or  

    docker build -t=<agent_image_name> -f=/path/agent/Dockerfile-agent-Ubuntu 
/path/agen
t

Following are specific examples for downloading a tar file and building a Docker image for a specific component on Red Hat Enterprise Linux 7.x.

Component

Steps to Download Tar File and Build Image

eMake

  1. Download the ElectricAccelerator-<version>-ContainerEmake.tar.gz file from the Electric Cloud ShareFile folder as described above.
  2. Enter:
     tar xvzf ElectricAccelerator-<version>-ContainerEmake.tar.gz

     The files are extracted to a directory named emake.

     3. Enter:

     docker build -t=<emake_image_name> -f=emake/Dockerfile-emake-rh emake

        or

     docker build -t=<emake_image_name> -f=/path/emake/Dockerfile-emake-rh 
/path/emake

Cluster Manager

  1. Download the ElectricAccelerator-<version>-ContainerClusterManager.tar.gz file from the Electric Cloud ShareFile folder as described above.
  2. Enter:
    tar xvzf ElectricAccelerator-<version>-ContainerClusterManager.tar.gz
    The files are extracted to a directory named cm.

    3. Enter:

     docker build -t=<cm_image_name> -f=cm/Dockerfile-cm-rh cm

        or

     docker build -t=<cm_image_name> -f=/path/cm/Dockerfile-cm-rh /path/cm

Agent

  1. Download the ElectricAccelerator-<version>-ContainerAgent.tar.gz file from the Electric Cloud ShareFile folder as described above.
  2. Enter:
    tar xvzf ElectricAccelerator-<version>-ContainerAgent.tar.gz
    The files are extracted to a directory named agent.

    3. Enter:

     docker build -t=<agent_image_name> -f=agent/Dockerfile-agent-rh agent

        or

     docker build -t=<agent_image_name> -f=/path/agent/Dockerfile-agent-rh 
/path/agen
t

Running the Docker Image to Create a Container and Start eMake, the Cluster Manager, or Agents

Component

Steps to Run a Docker Image to Create a Container and Start the Component

eMake

To run a Docker image to create a container and start eMake, enter:

docker run -itd -v /home/dev/prj:/home/dev/prj -w /home/dev/prj 
[--name=<container_name>] <emake_image_name>

where <container_name> is your custom name for the container (optional), and <emake_image_name> is the name of the Docker image. For example:

docker run -itd -v /home/dev/prj:/home/dev/prj -w /home/dev/prj 
--name=emake_container1 emake_10.0_ubuntu_alpha

The -d option runs the container as a daemon. 

Cluster Manager

To run a Docker image to create a container and start the Cluster Manager, enter:

docker run -idt -p 80:80 -p 8030:8030 -p 8031:8031 -p 443:443 -p 3306:3306 
[--hostname=<docker-host_host_name_or_IP>] [--name=<container_name>] <cm_image_name>

where <docker-host_host_name_or_IP> is the machine on which the container is running (optional), <container_name> is your custom name for the container (optional), and <cm_image_name> is the name of the Docker image. Specifying the container host name or IP address on which the container will run ensures that you can use this host name or IP address (rather than the container name) when using the --emake-cm= eMake option to invoke eMake.

For example:

docker run -idt -p 80:80 -p 8030:8030 -p 8031:8031 -p 443:443 -p 3306:3306 -
--hostname=garfield3 -name=cm_container1 cm_10.0_rh_alpha

The -d option runs the container as a daemon. The -p option specifies which ports to expose.

Agent

To run a Docker image to create a container and start the agents, enter one of the following commands based on your version of Accelerator.

Version 10.0:

docker run --privileged=true -idt -e CMHOST=<host[:port]> 
-e AGENT_NUMBER=<number_of_agents_per_host> --device /dev/efs --net=host
[--name=<container_name>] [--hostname=<container_hostname_or_IP>
  <
agent_image_name>

Version 10.1 and newer versions:

docker run --privileged=true -idt -e CMHOST=<host[:port]> -e EFS_ID=<agent_ID> 
--device /dev/efs --net=host [--name=<container_name>]
[--hostname=<container_hostname_or_IP>] <agent_image_name>

where <host[:port]> is the IP address and port of the Cluster Manager, <number_of_agents_per_host> is the number of agents across all containers you want to run on the host (up to the number of cores on your machine), <agent_ID> is the ID (0 by default) of the agent to run in the container<container_name> is your custom name for the container (optional), <container_host_name_or_IP> is the machine on which the container is running (optional), and <agent_image_name> is the name of the Docker image.

The <agent_ID> must be a number from 0 through one fewer than the number of cores. For example, if you have eight cores, it must be a number from 0 through 7.

You cannot start multiple agent containers on the same host with the same <agent_ID> value. Only one agent container can have the default <agent_ID> value.

Following are examples based on your version of Accelerator.

Version 10.0:

docker run --privileged=true -idt -e CMHOST=10.200.1.97 -e AGENT_NUMBER=8 
--device /dev/efs --net=host --name=agent_container1
--hostname=chester-rh agent_10.0_rh_alpha

Version 10.1 and newer versions:

docker run --privileged=true -itd -e CMHOST=192.168.1.97 -e EFS_ID=1 
--hostname=chester-rh --device /dev/efs --net=host --name=agent_rh_container
agent_rh

The -d option runs the container as a daemon. Note that you can run an image in multiple containers. For example, in case of a problem with ports, you can run one agent per port.

You should use the --hostname=<container_hostname_or_IP> option to ensure that the agents have names that are Cluster Manager “resource friendly.” This lets you create resource definitions to restrict the selection of agents to only those agents running in a container of the desired type. For example, set the container hostname to the base hostname plus an addendum describing the type of container, such as chester-rh or chester-ub1704.  Then the agents would have names such as chester-rh-1 so that you could define a Cluster Manager resource as *-rh to match all the Red Hat containers.

To check that the agents started, go the Cluster Manager web interface, then click the Agents tab, and then make sure that the agents are running. 

 

Have more questions? Submit a request

Comments

Powered by Zendesk