Running with Docker

This section explains how to run the RSMP Validator using Docker. You can also install locally.

Setup

  1. Download and install Docker.

  2. Create a local folder for storing validator configurations. When mounted into the container, this folder serves the same purpose as the config folder when you install manually.

  3. Create a configuration file for the equipment, simulator or supervisor that you want to test. Check out the TLC example config, or read more about site test configurations and supervisor test configurations.

  4. Create a validator.yaml file inside your config folder and edit it to point to the test config that you created above. (Or as an alternative, set SITE_CONFIG or SUPERVISOR_CONFIG when you run the validator).

Run from the Terminal

You run the validator by starting the container. The container image includes the validator, test suite, and example configuration files under /app.

To run against the bundled simulator using the bundled example configs:

% docker run --rm -it ghcr.io/rsmp-nordic/rsmp_validator

By default, the image runs these test folders:

  • test/site/core: tests covering the RSMP Core spec, which apply to all types of sites.
  • test/site/tlc: tests for TLCs (Traffic Light Controllers).

For testing real equipment, mount the config folder you created above. Assuming the config folder is at ./config, use $PWD to construct the absolute host path:

% docker run --name rsmp-validator -it -v $PWD/config:/config -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator

By default the validator listens on port 13111 when testing RSMP sites. The port must be mapped using the -p option, as shown above.

After running, you can start the container again to re-run the same set of tests and options with:

% docker start -a rsmp-validator

To run with different options, remove the container and run again with different options. You can pass --rm when running to automatically remove the container after each completion. See the Docker docs for more info about managing containers.

Choosing Config

Inside the container, relative paths are resolved from /app. For example, config/gem_tlc.yaml means /app/config/gem_tlc.yaml, the bundled example config.

If you mount your own config folder with -v $PWD/config:/config, refer to those host files with /config/....

You can choose config in two ways.

Use a mounted validator.yaml:

site: /config/my_site.yaml
supervisor: /config/my_supervisor.yaml

Then run:

% docker run --rm -it -v $PWD/config:/config -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator test/site

Or pass the config path directly with environment variables:

% docker run --rm -it \
  -v $PWD/config:/config \
  -e SITE_CONFIG=/config/my_site.yaml \
  -p 13111:13111 \
  ghcr.io/rsmp-nordic/rsmp_validator \
  test/site

If SITE_CONFIG or SUPERVISOR_CONFIG is set, it takes precedence over validator.yaml.

Custom Options

You can pass custom options to the validator, e.g. to run specific tests or enable RSMP logging.

Enable RSMP logging:

% docker run --rm -it -v $PWD/config:/config -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator test/site --log

Run a specific test:

% docker run --rm -it -v $PWD/config:/config -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator test/site/tlc/detector_logics_spec.rb

Log Files

By default, the validator produces output to the terminal. You can also write RSMP logs to a file inside the container using --log. If you want to persist log files on the host, mount a log folder:

% docker run --rm -it -v $PWD/config:/config -v $PWD/log:/log -p 13111:13111 ghcr.io/rsmp-nordic/rsmp_validator test/site --log /log/rsmp.log

Run from Docker Desktop

You can also run tests from Docker Desktop. Find rsmp_validator in the images tab and press Run. Select Optional settings and then enter:

  • Ports: 13111
  • Volumes:
    • Host path: select the config folder you created above
    • Container Path: /config

Start the container by clicking ‘Run’. The log output is shown in Docker Desktop.

Available Images

The latest published image is available under the docker tag latest.

Our docker images are published on Github Container Registry. Check the available images on github.


This site uses Just the Docs, a documentation theme for Jekyll.