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
- GenRocket Runtime Docker Image Setup
- Glossary of Terms
- Step 1 - Download the Docker Image Tar from GenRocket Web Platform
- Step 2 - Load the Docker Image Tar into the Docker Container Using the Command
- Step 3 - Execute the Docker Image in Docker Container
- Step 4 - Check the Docker Process Status and Get the Container ID
- Step 5 - Execute the Docker Bash Shell to access the GenRocket Runtime
- What Are the Steps to Generate Data After Initial Docker Setup?
- Additional Examples
- Frequently Asked Questions
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
- 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 from GenRocket Web Platform
Step 2 - Load the Docker Image Tar into the Docker Container Using the Command
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.
- 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.
- docker run -itd
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.
- 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.
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.
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.
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.
root@a2xxxxxx9f8c:/opt/Genrocket# genrocket -r scenarios/GMapTestServerScenario.grs
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.