Skip to content

This repository contains intructions to run a Docker container to deploy a Routing Service instance with a custom processor.

Notifications You must be signed in to change notification settings

rticommunity/docker-rtiroutingservice-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Running Routing Service Processors on Docker Containers

Introduction

Routing Service Processors are event-oriented pluggable components that allow you to control the forwarding process that occurs within a RTI Routing Service Route.

In this repository, we show how you to build and deploy a Routing Service Processor using Docker. Our instructions assume you have a basic understanding of Docker containers. However, if you are new to Docker, the following documents will give you enough information to get started:

Also, the RTI Community Portal contains some useful documents that cover the integration of DDS in a Docker environment:

Lastly, to learn more about how to implement and use custom processor plugins, please check the README.rst files in this repository directory and the Routing Service SDK documentation.

Dependencies

Before diving into the hands-on instructions, make sure you install the necessary dependencies. The instructions, which we developed and tested using Docker CE version 18.09.0 (build 4d60db4) assume you are using a Linux host.

First, install Docker on your Linux host. Please, follow the appropriate instructions for your Linux distribution:

Note that you will need to use Docker Compose to run some scenarios. Please refer to the instructions on how to install Docker Compose in Docker Documentation.

Second, to run RTI Routing Service and your custom Processor plugin, download the following RTI packages (Connext 6 or above):

  • RTI Host for 64-bit Linux: rti_connext_dds-6.0.0-pro-host-x64Linux.run
  • RTI Target Libraries for x64Linux4gcc7.3.0: rti_connext_dds-6.0.0-pro-target-x64Linux4gcc7.3.0.rtipkg

Hands on!

In this manual, we will use Docker to:

  • Setup a basic dependency management server.
  • Build the RTI Routing Service Processor.
  • Deploy RTI Routing Service and the custom Processor on a Docker container.

To get started, create an empty directory to prepare the workspace to run these scenarios:

mkdir docker_example

Next, clone the repository within the recently created folder:

cd docker_example
git clone https://github.com/rticommunity/docker-rtiroutingservice-processor rs-docker

Lastly, create a folder called artifacts and copy the following files into it:

mkdir artifacts
cp /path/to/rti_connext_dds-6.0.0-pro-host-x64Linux.run ./artifacts/
cp /path/to/rti_connext_dds-6.0.0-pro-target-x64Linux4gcc7.3.0.rtipkg ./artifacts/

The final directory structure should be as follows:

├── artifacts
│   ├── rti_connext_dds-6.0.0-pro-host-x64Linux.run
│   └── rti_connext_dds-6.0.0-pro-target-x64Linux4gcc7.3.0.rtipkg
└── rs-docker
    ├── artifacts-server
    │   ├── docker-compose.yml
    │   └── Dockerfile
    ├── Dockerfile
    ├── README.md
    └── src
        ├── CMakeLists.txt
        ├── README.rst
        ├── RsShapesProcessor.xml
        ├── ShapesProcessor.cxx
        └── ShapesProcessor.hpp

Setting Up Dependency Management Server

The first step in this manual is to setup a basic HTTP server to provide the RTI installation packages.

Under rs-docker/artifactor-server you will find two files:

  • Dockerfile, which specifies how create the Docker image for the server.
  • docker-compose.yml, which specifies how to execute the Docker image.

Usually, we use docker run to start and run a Docker container. However, in this example we use docker-compose, which is better suited for scenarios where:

  • More than one container is needed to run the application.
  • A service must be executed.
  • We are in a development environment.

For more information on docker-compose, please refer to Docker Documentation: Docker Compose.

Therefore, to start the HTTP server, simply go to the artifacts-server folder and run:

docker-compose up --build -d

You should see the following output:

rtiuser@rtimachine> docker-compose up --build -d
Creating network "artifacts-server_default" with the default driver
Building artifact
Step 1/5 : FROM python:3.7.2-alpine3.7
---> a94f1b57a462
Step 2/5 : RUN adduser -D myuser
---> Using cache
---> 2344b3330802
Step 3/5 : USER myuser
---> Using cache
---> 40b5e8b4aebb
Step 4/5 : WORKDIR /artifacts
---> Using cache
---> dfd20a75cc51
Step 5/5 : CMD ["python", "-m", "http.server"]
---> Using cache
---> a88db953abe8
Successfully built a88db953abe8
Successfully tagged artifactor-server:latest
Creating artifacts-server_artifact_1 ... done

This will start the server, building the image described in the Dockerfile, in detached mode. You should be able to access the contents of the server on http://localhost:8000.

IMG1

To stop the server, run:

docker-compose stop

Building Docker Image

Once you have setup the dependency management server, you can start to build the Docker image where we will deploy the Routing Service Processor.

To build the Docker image, run the following commands from the rs-docker directory:

export DOCKER_BUILDKIT=1
docker build -t routingservice-processor . --network="host"

If you are using Docker version 18.09 or newer, you can leverage new build enhancements. In particular, in this example we enable the new "builkit" front end setting using the DOCKER_BUILDKIT environment variable.

Also, note we need to set the parameter --network="host" to ensure that the resources the container depends on (i.e., those available on the dependency management server) are available.

After building the image, you should see the following output:

=> exporting to image                                                                             0.1s
=> => exporting layers                                                                            0.1s
=> => writing image sha256:2c45d2ea992ac32676898092ed2af3668c855cd20f87172d06a36f1ccd8b7613       0.0s
=> => naming to docker.io/library/routingserviceprocessor

Running Docker Image

To run the Docker image, execute the following command:

docker run --name routingservice  -d routingserviceprocessor

This will run a Docker container in detached mode, which will execute RTI Routing Service with the following arguments:

-cfgFile /rti/RsShapesProcessor.xml \
-cfgName RsShapesAggregator \
-DSHAPES_PROC_KIND=aggregator_simple

For more information on the Routing Service configuration, please check the README.rst file under the src directory.

You can overwrite the default execution parameters by appending new arguments to the docker run command as follows:

docker run  -ti routingserviceprocessor -help

To list your running containers run:

docker ps

To stop the Docker container, run:

docker stop routingservice

To learn more

About

This repository contains intructions to run a Docker container to deploy a Routing Service instance with a custom processor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published