Description

For DevOps teams that like to set up and deploy a containerized environment, GenRocket provides a Docker container. The Runtime Setup and all required components needed to use the GenRocket web platform can exist in one contained package for end users. 


In This Article


Basic Mounting Paths for GenRocket Docker

The basic mounting paths to deploy and use a GenRocket Docker container are the following (alpha is an example user).

  • /home/alpha/.genrocket - The subdirectory where GenRocket User Profile is stored along with other genrocket configuration files
  • /home/alpha/genrocket - The mounted root GenRocket subdirectory
  • /home/alpha/genrocket/bin -The subdirectory to store GenRocket Java run scripts
  • /home/alpha/genrocket/lib - The subdirectory to store GenRocket Java Jar files
  • /home/alpha/scenarios -The subdirectory where GenRocket components are stored (Scenarios, GCases, Configs, etc.)
  • /home/alpha/outputs -The subdirectory where GenRocket Receivers generate data to 



GenRocket Runtime Docker Image Setup

Glossary of Terms

  • System - Defines a local computer system or Server
  • Storage Volume - Represents a path on the System


Prerequisites

  • End-User installs the Docker service. (Docker installation guide here)
  • End-User prepares a Host System path on their system to place files that are required to be accessible by Docker outside itself. It can be anywhere on the system where all GenRocket-related files can be placed that will be accessible outside the Docker. The reason for hosting the system path is that the Docker containers do not save the data they produce. As soon as the process is finished, the container stops, and everything inside of it is removed. If you want persistent data that is stored even after the container stops, you need to allow sharing of storage volumes. The Host system path in the GenRocket Docker setup is required for managing the following:
    • mounting the Runtime, which can have dynamic Jars.
    • mounting the GenRocket Scenarios
    • mounting the GenRocket configuration files
    • mounting the GenRocket Output directory

Step 1 - Download the Docker Image Tar

This can be done from the GenRocket Web Platform or by using a CURL Command. 


Option 1 - GenRocket Web Platform

  • Log into the GenRocket web platform.

  • Expand the Options Menu in the navigation bar.



  • Click Download Runtime Docker Image. The version number you are downloading may not match the version in the screenshot.


Option 2 - CURL Command

You can directly download the GenRocket Docker Image to any location using the following CURL command. 


To do so, you will need your URL, Organization ID, and Version Number. The Organization ID and Version Number can be obtained from the GenRocket web platform. The file will be downloaded to whatever path is specified in the command prompt or terminal window.


curl https://app.genrocket.com/rest/download/dockerImage/<ORGANIZATION ID> --output genrocket-runtime-3.5.22.tar


Step 2 - Load the Docker Image Tar into the Docker Container Using the Command

  • Open the Terminal

  • Change the Directory to where the Docker Tar Image exists.

  • Execute the following command:

    docker load -i <dockerImageTar>
    docker load -i genrocket-runtime-<version>.tar
    
    
    Example: 
    docker load -i genrocket-runtime-3.5.34.tar
    
    

    Note: You may require superuser access to execute the docker command. For example: In Linux


  • The above command loaded the image having the name genrocket-runtime and tag 3.5.34.

  • You can validate the loaded image using the following command:

    docker image ls



Step 3 - Execute the Docker Image in Docker Container

This step requires the use of the host system path where all the files should be accessible by Docker Container. 

  • Command to execute Docker Image:

    docker run -itd -v <hostSystemPath>:/opt/Genrocket -v <hostSystemPath>/.genrocket:/root/.genrocket <imageName>:<imageTag>
    
    For example:
    
    Linux:
    
    docker run -itd -v $(pwd)/dockerFiles:/opt/Genrocket -v $(pwd)/dockerFiles/.genrocket:/root/.genrocket genrocket-runtime:3.5.34
    
    Windows:
    
    docker run -itd -v c:\genrocket\volume:/opt/Genrocket -v c:\genrocket\volume\.genrocket:/root/.genrocket genrocket-runtime:3.5.34
    
    


  • The above Docker command mounts the host volume to the container and then executes the Docker container.

  • The hostSystemPath is a path outside the container to keep the files required by GenRocket (e.g., Scenarios, Configuration Files). In the examples above, the following are the hostSystemPath values:
    • Mac - $(pwd)/dockerFiles
    • Windows - c:\genrocket\volume

  • For Example:




  • To understand the command, let's split the command:
    • docker run -itd
      • Executing the docker image in interactive (i), connected to the terminal (t), and detached mode (d).
    • -v <hostSystemPath>:/opt/Genrocket
      • -v attribute should have the specified location of the directory where you want to save the data, followed by where that data will be located inside the container.
      • In the example above, we are mounting two paths. One for the .genrocket folder where the GenRocket profile can be placed and another for GenRocket Runtime and other files.
      • /opt/Genrocket will be constant and be used as it is in the command. Also, /root/.genrocket is constant as well.
    • <imageName>:<imageTag>
      • The last part of the command is the name and tag of the Docker image. You can find the name and tag from the execution of the docker load command.


Additional Port Mapping Option for Running GMUS in Docker on Windows (or Mac)

GenRocket uses a Linux-based Docker image. When running this Docker image on a Windows (or Mac) machine, it doesn't support the port forwarding feature as it does when running on Ubuntu (a Linux distribution). To explicitly support port forwarding, we need to bind our host machine (Windows/Mac) port to the Docker container port. This can be done using the -p option. 


Below is the command in Step 3 with the additional -p option for mapping ports.

docker run -itd -p <hostport:containerport> -v <hostSystemPath>:/opt/Genrocket -v <hostSystemPath>/.genrocket:/root/.genrocket <imageName>:<imageTag>


In the following example, we've mapped the host machine port 8070 to the Docker container port 8070 (the port where we're going to run GMUS).


docker run -itd -p 8070:8070 -v c:\genrocket\volume:/opt/Genrocket -v c:\genrocket\volume\.genrocket:/root/.genrocket genrocket-runtime:3.5.34


Now, once GMUS is up and running (genrocket -gmusr 8070) in the Docker container, you will be able to access the container GMUS using localhost IP (127.0.0.1).


Step 4 - Check the Docker Process Status and Get the Container ID

  • To check the docker process status and get the container ID, execute the following command.

    docker ps


  • For example:

  • The first column in the image is the Docker Container ID for GenRocket Runtime.

Step 5 - Execute the Docker Bash Shell to access the GenRocket Runtime

  • The command to launch the Docker Bash shell is:

    docker exec -it <DOCKET CONTAINER ID> bash


  • The Docker Container ID will be obtained from the docker ps command from Step 4. 


  • Running the genrocket command in the shell will bring the latest Jars from Production if you are connected online; otherwise, you will have to manually download the Jars into <hostSystemPath>/genrocket/lib folder.



  • In case the genrocket command does not work, run the following command to check the logs:

    docker logs <DOCKET CONTAINER ID>

  • Maintain different sub-directories within the <hostSystemPath> to keep the Scenarios/Config Files/Output files


  • Before you download the GenRocket Profile, update the Resource values like below. In this example, a Server resource is selected.



  • The next step will be downloading the Profile into <hostSystemPath>/.genrocket folder. Make sure <hostSystemPath>/.genrocket directory has the right owner to allow files to be placed in this folder.


  • To download a profile, click on the Download drop-down menu and select Download Server Profile.


  • The Profile will need to be copied to the .genrocket folder, which can be found here: <hostSystemPath>/.genrocket.


  • Download the Scenario and place it in <hostSystemPath>/scenarios.



  • The final step is to execute the Scenario. This will generate the data into <hostSystemPath>/output directory.



What Are the Steps to Generate Data After Initial Docker Setup?

Note: The Docker Container must be up and running to obtain the list of Container IDs and generate test data.


Step 1 - Run the following command to check the Docker process status and obtain the container ID.

docker ps


Note: This command provides the list of CONTAINER IDs that are actively running. If the container is not running, the list will be empty, meaning no container is active.

Step 2 - Execute the Docker Bash Shell to access GenRocket Runtime. The Docker Container ID will be obtained from the docker ps command in Step 2 above.

Example: 

 C:\Users\HP>docker exec -it a2xxxxxx9f8c bash


Step 3 - After running the Bash Shell command above, the following path will be provided. The GenRocket Runtime Container has been accessed, and the Container ID is in the path.


Example

root@a2xxxxxx9f8c:/opt/Genrocket#


Step 4 - Ensure all necessary setup steps have been completed for the GenRocket feature (e.g., GMUS, G-Map).


Step 5 - Make certain the required files have been downloaded and placed into the appropriate <hostSystemPath> directory. 

Step 6 - Run the Scenario execution commands to generate the required data. 


Example: 

root@a2xxxxxx9f8c:/opt/Genrocket#   genrocket -r scenarios/GMapTestServerScenario.grs



Additional Examples

Example 1 - Running a GMUS Server in Docker

  • Complete the necessary steps for using GMUS. Click here for more information.
  • Execute the GMUS command in Docker.


Example 2- Executing a Test Data Case in Docker

  • Download Scenario and copy/place here: <hostSystemPath>/scenarios
  • Download G-Case Suite (or G-Cases) and copy/place here: <hostSystemPath>/scenarios.  
  • Execute the G-Case. This will generate the data into <hostSystemPath>/output directory.



Example 3 - Running a G-Map Server in Docker

  • Complete the required steps to set up the G-Map Server. Clickherefor more information.
  • Execute the command to run a G-Map Server.



Frequently Asked Questions

Question 1 - Are these docker images hosted in your AWS account?  

Yes, we are hosting the docker image in the AWS Elastic Container Registry (ECR) and also hosted in AWS S3, which allows the image to be accessed from GenRocket Web.

Question 2 - Can your images be accessed and made available through Docker Hub?

We currently do not host our images on Docker Hub. 


Question 3 - Are there any GenRocket repositories we can host in our Artifactory? 

By downloading the Docker Tar Image from GenRocket Web, you can host it to your Artifactory.