Skip to main content

Installing Traffic API Proxy

Important note:

All passwords and keys in this section are given for illustration purposes.

During a real installation, it is recommended to use more complex and reliable passwords.

1. Before installing

  1. Consider getting familiar with:

  2. Make sure the necessary preparation steps are completed:

    1. Preparation for installation
    2. Installing License service
    3. Installing API Keys service
  3. Collect the necessary information that was set or retrieved on previous steps:

    ObjectExample valueHow to get value
    Docker Registry mirror endpointdocker.storage.example.local:5000See Fetching installation artifacts
    Kubernetes secret for accessing Docker Registryonpremise-registry-credsSee Fetching installation artifacts
    License key for the Urbi software packageDEMO-KEY-DGCTL-AAAAAA-BBBBBBSee Getting an On-Premise license
  4. Make sure that the resource requirements specified in the Helm chart are met. For more information on how to do this, refer to the System requirements document.

    Note

    Contents of the Helm chart described in this chapter are relevant for the latest API Platform version (see API Platform releases). To find parameters for earlier versions, open values.yaml on GitHub and select a Platform-<version> tag in the tag switcher on the left.

2. Install Traffic API Proxy service

For navigation services

  1. Create a Helm configuration file. See here for more details on the available settings.

    The example is prefilled with the necessary data collected on previous steps.

    values-traffic-proxy-navi.yaml
    dgctlDockerRegistry: docker.storage.example.local:5000

    imagePullSecrets: [onpremise-registry-creds]

    replicaCount: 1

    proxy:
    host: https://datagateway.api.2gis.com
    locationDG: true
    licenseKey: DEMO-KEY-DGCTL-AAAAAA-BBBBBB

    ingress:
    enabled: true
    className: nginx
    hosts:
    - host: traffic-proxy-navi.example.com
    paths:
    - path: /
    pathType: Prefix
    tls: []
    #- hosts:
    # - traffic-proxy-navi.example.com
    # secretName: secret.tls

    Where:

    • dgctlDockerRegistry: endpoint of your Docker Registry with the images of the On-Premise services.
    • imagePullSecrets: Kubernetes Secrets to access the Docker Registry with the images of the On-Premise services.
    • replicaCount: number of the NGINX service replicas.
    • proxy: proxy server settings.
      • host: domain name, IP address, or URL of a public Traffic Update server. For the list of available servers, see the Architecture section.
      • locationDG: enables additional contexts for working with datagateway.api.2gis.com.
      • licenseKey: license key for the Urbi software suite. It is required only if locationDG is true.
    • ingress: configuration of the Ingress resource. Adapt it to your Ingress installation. Note that the path for the host should point to the root: /.
  2. Deploy the service with Helm using the created values-traffic-proxy-navi.yaml configuration file:

    helm upgrade --install --atomic --wait-for-jobs --values ./values-traffic-proxy-navi.yaml traffic-proxy-navi 2gis-on-premise/traffic-proxy

For map services

  1. Create a Helm configuration file. See here for more details on the available settings.

    The example is prefilled with the necessary data collected on previous steps.

    values-traffic-proxy-map.yaml
     dgctlDockerRegistry: docker.storage.example.local:5000

    imagePullSecrets: [onpremise-registry-creds]

    replicaCount: 1

    proxy:
    host: https://jam.api.2gis.com
    locationDG: false

    ingress:
    enabled: true
    className: nginx
    hosts:
    - host: traffic-proxy-map.example.com
    paths:
    - path: /
    pathType: Prefix
    tls: []
    #- hosts:
    # - traffic-proxy-map.example.com
    # secretName: secret.tls

    Where:

    • dgctlDockerRegistry: endpoint of your Docker Registry with the images of the On-Premise services.
    • imagePullSecrets: Kubernetes Secrets to access the Docker Registry with the images of the On-Premise services.
    • replicaCount: number of the NGINX service replicas.
    • proxy: proxy server settings.
      • host: domain name, IP address, or URL of a public Traffic Update server. For the list of available servers, see the Architecture section.
      • locationDG: enables additional contexts for working with datagateway.api.2gis.com.
      • licenseKey: license key for the Urbi software suite. It is required only if locationDG is true.
    • ingress: configuration of the Ingress resource. Adapt it to your Ingress installation. Note that the path for the host should point to the root: /.
  2. Deploy the service with Helm using the created values-traffic-proxy-map.yaml configuration file:

    helm upgrade --install --atomic --wait-for-jobs --values ./values-traffic-proxy-map.yaml traffic-proxy-map 2gis-on-premise/traffic-proxy

3. Test deployment

For navigation services

1. Verify Traffic API Proxy operation

Send the following GET requests to the address specified in the ingress.hosts[0].host parameter of the configuration file for installing traffic API proxy for navigation services:

curl -X GET https://traffic-proxy-navi.example.com/eca/traffic/moses/speeds5.json
curl -X GET https://traffic-proxy-navi.example.com/forecast/index.json
curl -X GET https://traffic-proxy-navi.example.com/long-forecast/index.json
curl -X GET https://traffic-proxy-navi.example.com/eta/eta-predictions/index.json
curl -X GET https://traffic-proxy-navi.example.com/navi-castle/restrictions_index.json.zip --output restrictions_index.json.zip
curl -X GET https://traffic-proxy-navi.example.com/navi-castle/restricted_transport.json.zip --output restricted_transport.json.zip

The response must contain JSON objects and valid archive files.

2. Verify traffic data retrieval by navigation service

To ensure that the Navi-Back service retrieves traffic data through the proxy:

  1. Perform any of the preparatory steps:

    • Ensure that the ingress.enabled: "true" parameter is set in the configuration file for installing the Navi-Back service. In the following steps, use the address specified in the ingress.hosts[0].host parameter of the Navi-Back configuration file (for example, https://navi-back-ingress.example.com).
    • Forward the HTTP port of the Navi-Back container to the host network level to access the service endpoints. In the following steps, use the host IP address and the required port.
  2. Check the time of the last traffic data retrieval using one of the methods below:

    • Retrieve Navi-Back metrics in Prometheus format via the /metrics endpoint. Add the path /metrics to the address from the preparation step and send a GET request. Example:

      curl -X GET https://navi-back-ingress.example.com/metrics

      The response must contain the mosesd_jams metric (a timestamp of the last traffic data retrieval in UNIX timestamp format) and the mosesd_jams_delay metric (the time elapsed since the last data retrieval). If these metrics are missing, the service could not retrieve traffic data through the proxy.

    • In a browser, go to the address from the preparation step and append the path /city to it. For example: navi-back-ingress.example.com/city?type=json.

      The response must be an HTML page containing a traffic column and the time of the last traffic data retrieval.

    • Send a GET request to the address from the preparation step and append the path /city to it. For example:

      curl -X GET https://navi-back-ingress.example.com/city?type=json

      The response must be a JSON object containing a traffic field and the time of the last traffic data retrieval.

For map services

1. Verify Traffic API Proxy operation

Perform one of the following steps:

  • In a browser, go to the address specified in the ingress.hosts[0].host parameter of the configuration file for installing traffic API proxy for map services, and add the path /meta?reg=65536,108&time&score. For example: traffic-proxy-map.example.com/meta?reg=65536,108&time&score.

  • Send a GET request to the same address:

    curl -X GET https://traffic-proxy-map.example.com/meta?reg=65536,108&time&score

    The request should succeed and return a result as a list.

2. Verify traffic data retrieval by MapGL JS API service

To verify that the MapGL JS API service receives traffic data through the proxy:

  1. Perform any of the preparation steps:

    • Make sure the ingress.enabled: "true" parameter is set in the configuration file for installing the MapGL JS API service. In the following steps, use the address specified in the ingress.hosts[0].host parameter of the MapGL JS API configuration file (for example, https://mapgl-js-api.example.com).
    • Forward the HTTP port of the MapGL JS API container to the host network to access the service endpoints. In the following steps, use the host's IP address and port.
  2. Click the traffic icon in the upper-right corner of the map. Traffic jams should be displayed on the map, and the button must display the current traffic level and corresponding color.

What's next?