Building Traffic Control

The build steps for Traffic Control components are all pretty much the same, despite that they are written in a variety of different languages and frameworks. This is accomplished by using Docker.


Currently, both listed methods of building Traffic Control components will produce *.rpm files, meaning that the support of these components is limited to RedHat-based distributions - and none of them are currently tested (or guaranteed to work) outside of CentOS 7 and CentOS 8, specifically.

Downloading Traffic Control

If any local work on Traffic Monitor, Traffic Router Golang, Grove or Traffic Ops is to be done, it is highly recommended that the Traffic Control repository be downloaded inside the $GOPATH directory. Specifically, the best location is $GOPATH/src/ Cloning the repository outside of this location will require either linking the actual directory to that point, or moving/copying it there.

See also

The Golang project’s GOPATH wiki page

Build Using pkg

This is the easiest way to build all the components of Traffic Control; all requirements are automatically loaded into the image used to build each component. The pkg command can be found at the root of the Traffic Control repository.



./pkg [options] [projects]


The pkg script often needs to be run as sudo, as certain privileges are required to run Docker containers



Build RPMs targeting CentOS 7 (default)


Build RPMs targeting CentOS 8


Build builder Docker images before building projects


Disable compiler optimizations for debugging.


List available projects.


Pull builder Docker images, do not build them (default)


Quiet mode. Supresses output. (default)


Verbose mode. Lists all build output.

If present, projects should be one or more project names. When no specific project or project list is given the default projects will be built. Valid projects:

  • docs

  • grove_build2

  • grovetccfg_build

  • source2

  • traffic_monitor_build2

  • traffic_ops_build2

  • cache-config_build2

  • traffic_portal_build2

  • traffic_router_build2

  • traffic_stats_build2

  • weasel

Output component-version.rpm files, build logs and source tarballs will be output to the dist/ directory at the root of the Traffic Control repository directory.


This is optional, but recommended. If a docker-compose executable is not available the pkg script will automatically download and run it using a container. This is noticeably slower than running it natively.


This is a default project, which will be built if pkg is run with no projects argument

Build Using docker-compose

If the pkg script fails, docker-compose can still be used to build the projects directly. The compose file can be found at infrastructure/docker/build/docker-compose.yml under the repository’s root directory. It can be passed directly to docker-compose, either from the infrastructure/docker/build/ directory or by explicitly passing a path to the infrastructure/docker/build/docker-compose.yml file via -f. It is recommended that between builds docker-compose down -v is run to prevent caching of old build steps. The service names are the same as the project names described above in Usage, and similar to the pkg script, the build results, logs and source tarballs may all be found in the dist directory after completion.


Calling docker-compose in the way described above will build _all_ projects, not just the default projects.

Build the RPMs Natively

A developer may end up building the RPMs several times to test or debug code changes, so it can be desirable to build the RPMs quickly for this purpose. Natively building the RPMs has the lowest build time of any building method.

Install the Dependencies

Table 70 Build dependencies for Traffic Control

Common dependencies

Traffic Monitor

Traffic Ops

Traffic Portal

Traffic Router

Traffic Stats


Grove TC Config (grovetccfg)


macOS (homebrew)3

  • rpm

  • go

  • go

  • npm

  • grunt-cli

  • maven

  • go

  • go

  • go

  • python3

CentOS/Red Hat/Fedora (yum)4

  • git

  • rpm-build

  • rsync

  • epel-release

  • npm

  • nodejs-grunt-cli

  • java-1.8.0-openjdk

  • maven

  • python3-devel

  • gcc

  • make

Arch Linux (pacman)

  • git

  • rpm-tools

  • diff

  • rsync

  • go

  • go

  • npm

  • grunt-cli

  • jdk8-openjdk

  • maven

  • go

  • go

  • go

  • python-pip

  • python-sphinx

  • make

Windows (cygwin)5

  • git

  • rpm-build

  • rsync

  • curl

Windows (chocolatey)5

  • golang

  • golang

  • nodejs

  • openjdk8

  • maven

  • golang

  • golang

  • golang

  • python

  • pip

  • make


If you are on macOS, you additionally need to Get OpenJDK 8 on macOS.


If you are on CentOS, you need to download Go directly instead of using a package manager in order to get the latest Go version. For most users, the desired architecture is AMD64/x86_64.


If you are on Windows, you need to install both the Cygwin packages and the Chocolatey packages in order to build the Apache Traffic Control RPMs natively.

After installing the packages using your platform’s package manager,

Run build/ directly

In a terminal, navigate to the root directory of the repository. You can run build/ with no arguments to build all components.

#88 build/ with no arguments

This is the equivalent of running

#89 build/ with all components
build/ tarball traffic_monitor traffic_ops traffic_portal traffic_router traffic_stats grove grove/grovetccfg docs

If any component fails to build, no further component builds will be attempted.

By default, the RPMs will be built targeting CentOS 7. CentOS 8 is also a supported build target. You can choose which CentOS version to build for (7, 8, etc.) by setting the RHEL_VERSION environment variable:

#90 Building RPMs that target CentOS 8 without the build host needing to be CentOS 8


Although there are no known issues with natively-built RPMs, the official, supported method of building the RPMs is by using pkg or docker-compose. Use natively-built RPMs at your own risk.

Building Individual Components

Each Traffic Control component can be individually built, and the instructions for doing so may be found in their respective component’s development documentation.

Building This Documentation

See instructions for building the documentation.