Skip to content

Tile Server

Datarobot ships with a tile server that allows geospatial visualizations in the app to have a map in the background.

Installation in restricted network

The tile server installation starts with the initial job downloading the latest tiles from external sources to DataRobot internal storage (e.g., s3). With restricted network conditions (e.g., air gap), this step is usually disabled in the helm chart (example as follows). We will need to manually download the tiles after Tile server app is started.

tileservergl:
  init_tiles: false  # disable init job downloading tiles from external source 

Installation guide

Table of content: - Find tile download url - Download preparation - Download and update tiles (if necessary)

Find tile download url

Available tile options and corresponding URLs are available here.

Download preparation

Before downloading, we will get the sha sum of tile to be downloaded. We will use it later to compare it with the sha sum of the existing tile. This will tell us whether we will need to download/update tile. This step can be skipped if there is no tile ever downloaded.

  1. Find one installation node with internet access and the access to tileservergl-manager-* pod. You will find the tileservergl-manager pod as follows:

    kubectl get pods -n <k8s-namespace> | grep "tileservergl-manager-" 
    

  2. In the installation node, download and compute the tile sha with the following script. Copy the tile sha value which will be used later to compare the sha of the existing tiles.

#!/bin/bash

URL=""  # replace this with the tile URL
SHA_URL="${URL}.sha1sum"
DST_FOLDER=""  # replace this with the folder path to download tile sha

get_sha_sum () {
  local target_file="${DST_FOLDER}/$(basename ${SHA_URL})"
  local status_code=$(curl -s -o /dev/null -w "%{http_code}" "${SHA_URL}")
  local result="NO_SHA_SUM_FOUND"
  if [[ $status_code =~ ^2[0-9]{2}$ ]]; then
    curl -s -o "${target_file}" "${SHA_URL}"
    first_line="$(head -n 1 ${target_file})"
    if [[ -n $first_line ]]; then
      result="$(echo ${first_line} | awk '{print $1}')"
    fi
  fi
  echo "${result}"
}

SHA_SUM="$(get_sha_sum)"
echo "sha value of ${SHA_URL} is : ${SHA_SUM} Copy this value for later use." 
  1. Find the tileservergl-manager-* pod and shell into the tileservergl-manager container under it.

    kubectl get pods -n <k8s-namespace> | grep "tileservergl-manager-"
    kubectl exec -it <k8s-tileservergl-manager-pod-name> -n <k8s-namespace> -- sh 
    

  2. Run the following script to check whether the existing tile is up to date.

    #!/bin/bash
    
    TILE_SHA_SUM=""  # replace this with tile sha sum from the previous step
    BASE=/opt/datarobot-runtime/app/DataRobot
    MANAGE_TILESERVER="${BASE}/sbin/datarobot-manage-tileservergl"
    EXPECTED_TILE_FILENAME="$(${MANAGE_TILESERVER} get-tileset-name --sha-value ${TILE_SHA_SUM})"
    
    if [[ -n "${EXPECTED_TILE_FILENAME}" ]]; then
      echo "existing mbtiles found. using ${EXPECTED_TILE_FILENAME}"
    else
      echo "mbtiles needs to be downloaded or sync to ${EXPECTED_TILE_FILENAME}"
    fi
    
    echo "Done" 
    

Download and update tiles (if necessary)

If tile doesn’t exist or the existing tile is not up to date, you will need to download and update it. 1. In the installation node (with internet access), download tile

# Replace the URL with link for tiles you intend to install {: #replace-the-url-with-link-for-tiles-you-intend-to-install }
curl https://datarobot-geospatial.s3.amazonaws.com/geospatial-map-data/mbtiles/tiles-zoom-08-20191202.post1-dr.mbtiles -o <downloaded-tiles> 

  1. In the installation node, copy downloaded tile to /opt/datarobot-runtime/app/DataRobot/tiles-dist/ of tileservergl-manager container (under tileservergl-manager-* pod). /opt/datarobot-runtime/app/DataRobot/tiles-dist/ is the volume for temporarily storing tiles.

    TILE_DIR="/opt/datarobot-runtime/app/DataRobot/tiles-dist/" # volume mounted to tileservergl-manager container
    
    kubectl cp <downloaded-tiles> <k8s-namespace>/<k8s-tileservergl-manager-pod-name>:$TILE_DIR 
    

  2. In the tileservergl-manager container, run tile management command to update the tileserver with downloaded tiles.

    #!/bin/bash
    
    BASE=/opt/datarobot-runtime/app/DataRobot
    MANAGE_TILESERVER="${BASE}/sbin/datarobot-manage-tileservergl"
    TILE_FILE_NAME=""  # replace this with uploaded tile name
    TILE_FILE_PATH="/opt/datarobot-runtime/app/DataRobot/tiles-dist/${TILE_FILE_NAME}"
    
    $MANAGE_TILESERVER push --tileset $TILE_FILE_PATH
    $MANAGE_TILESERVER list
    $MANAGE_TILESERVER switch --tileset $TILE_FILE_PATH 
    

  3. Clean up tile in /opt/datarobot-runtime/app/DataRobot/tiles-dist/

    TILE_FILE_NAME=""  # replace this with uploaded tile name
    TILE_FILE_PATH="/opt/datarobot-runtime/app/DataRobot/tiles-dist/${TILE_FILE_NAME}"
    
    rm $TILE_FILE_PATH  # clean up the tiles in the temp directory