Skip to content

Building images and debugging containers

Pavel Smirnov edited this page Jan 4, 2018 · 14 revisions

If your components demonstrate the expected behavior being executed as java codes then its time to create docker images and debug your components as docker containers (the same manner as them will be executed in the online platform).

The SDK offers you automatic images building, containers execution and log reading functionalities in order to make the debugging process less error-prone and time consuming.

Please look at code example DummyBenchmarkDockerizedTest.java.

Here is the brief description of the debugging procedure:

  1. Implement dockerBuilders for your components. You can fully reuse the existing DockersBuilders. The only thing you should do is to check/modify project-specific information, which will be shared for all your docker images. See the DummyDockersBuilder as an example. This builder (specified for your project) will be used as an argument for all the predefined dockerizerBuilders, which you may [reuse without any modifications].

  2. Check that images are building successfully. Please note, what all docker-files are generating every time, then you perform image building. DockerFiles will share project-specific configuration, which you defined at previous stage, but differ from each other by the names of runner class. The only thing you should check at the image building stage is proper packaging of your source codes into jar file (including all dependencies by Shade or other maven plugins) under the building directory folder (which is target by default). Use 'mvn package -DskipTests=true' or GUI of your IDE for code packaging.

  3. Check that containers are runnable and show expected behavior. To perform containers creation and running you should check that DockerizerBuilders for all of your components(defined and checked at previuos stages) are submitted the ComponentsExecutor and to the StartStopContainersReaction (the same manner as it was done for components in non-dockerized mode). The containers will be started/stopped by the order defined in BenchmarkController and internal logs from containers will be shown in console. The "useCachedImages()" and "useCachedContainer()" flags will help you to avoid image rebuilding and container removal/creation procedures for the components, which already show the expected behavior.

During the debug process you also can mix execution the dockerized components with undockerised java codes, just switching between the type of component you submit into the components executor.

After you have finished with debugging containers for your components it is time to upload your images to the online platform.

Clone this wiki locally