Traffic Portal

Traffic Portal is only supported on CentOS Linux distributions version 7.x and 8.x. It runs on NodeJS and requires version 12 or higher.

Installing

  1. Build the Traffic Portal RPM using the instructions in Building Traffic Control.

  2. Copy the Traffic Portal RPM to your server

  3. Install NodeJS. This can be done by building it from source, installing with yum(8) if it happens to be in your available repositories (at version 12+), or using the NodeSource setup script.

    #49 Installing NodeJS using the NodeSource Setup Script
    curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -
    
  4. Install the Traffic Portal RPM with yum(8) or rpm(8) e.g. by running yum install path/to/traffic_portal.rpm as the root user or with sudo(8).

Configuring

Traffic Portal is primarily configured through three different files that affect different parts of its behavior. Those files are detailed in this section.

/etc/traffic_portal/conf/config.js

This file controls the behavior of the Traffic Portal server. It is a JavaScript source file which MUST set module.exports to the value of a configuration object. Configuration objects have the following allowed properties.

Tip

If Traffic Portal is being upgraded, reconcile config.js with config.js.rpmnew and then delete config.js.rpmnew.

api

The properties of this object control Traffic Portal’s interactions with the Traffic Ops API.

base_url

The full URL that points to the root of the Traffic Ops API, e.g. https://trafficops.infra.ciab.test:443/api/ not https://trafficops.infra.ciab.test:443 or https://trafficops.infra.ciab.test:443/api (trailing / required).

files

The properties of this object describe system paths important to Traffic Portal (other than SSL-related files, which are kept in the ssl object).

static

The directory where the built Traffic Portal front-end files are kept. In most cases, changing this from the default is unnecessary/discouraged.

log

The properties of this object describe the logging behavior of Traffic Portal. If this property is missing, or is null (or other “falsey” values), then logging is done simply on STDOUT.

stream

Defines a file location for Traffic Portal’s access logs. If this property is missing, or is null (or other “falsey” values), then logs will go to STDOUT instead.

port

A port number that sets the port on which Traffic Portal will listen for insecure (HTTP) connections. If useSSL is false, requests made to this port will be redirected to use HTTPS on the sslPort instead of just serving content insecurely.

reject_unauthorized

A boolean that defines whether or not Traffic Portal will reject SSL certificates that fail to validate as trusted.

Caution

Setting this to false exposes Traffic Portal to security vulnerabilities such as man-in-the-middle attacks, and should never be done in a production setting.

ssl

This object has properties that set the locations of SSL keys and certificates. Has no effect if useSSL is false.

key

The file location of the SSL certificate private key.

cert

The file location of the x509 SSL certificate that Traffic Portal will use.

ca

The file locations of the full certificate chain for the certificate authority that signed the SSL key (in order).

sslPort

A port number that sets the port on which Traffic Portal will listen for secure (HTTPS) connections. Has no effect if useSSL is false.

useSSL

A boolean that defines whether or not the Traffic Portal instance will offer secure (HTTPS) connections.

Caution

Setting this to false can expose sensitive data such as authentication credentials. Do not ever do that in a production setting.

timeout

This property defines the maximum time for which Traffic Portal will process requests before sending a timeout response. It can be either a number of milliseconds, or a duration string accepted by the ms library.

Warning

Slow requests will continue to use CPU and memory, even though a response has already been sent to the client.

/opt/traffic_portal/public/traffic_portal_properties.json

  • update /opt/traffic_portal/public/traffic_portal_properties.json (if Traffic Portal is being upgraded, reconcile traffic_portal_properties.json with traffic_portal_properties.json.rpmnew and then delete traffic_portal_properties.json.rpmnew)

/opt/traffic_portal/public/resources/assets/css/custom.css

This CSS file is provided for users to insert CSS to override the default styling of Traffic Portal.

Configuring OAuth Through Traffic Portal

See Configure OAuth Login.

Starting Traffic Portal

The Traffic Portal RPM comes with a systemd(1) unit file, so under normal circumstances Traffic Portal may be started with systemctl(1).

#50 Starting Traffic Portal
systemctl start traffic_portal

Stopping Traffic Portal

The Traffic Portal RPM comes with a systemd(1) unit file, so under normal circumstances Traffic Portal may be stopped with systemctl(1).

#51 Stopping Traffic Portal
systemctl stop traffic_portal

Using Traffic Portal