Now that Open Layers fully supports vector layers, we're looking at the practicality of running a vector tile server for our projects. Starting from this docker example, I created a script which I can run on a standard Debian Stretch install to create a working tile server:
#!/bin/bash #This is to be run on a standard Debian Stretch install. #Install core stuff apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install apt-transport-https curl unzip build-essential python libcairo2-dev libprotobuf-dev xvfb #Temporarily use a specific source for the exact nodejs version we need. echo "deb https://deb.nodesource.com/node_4.x jessie main" >> /etc/apt/sources.list.d/nodejs.list echo "deb-src https://deb.nodesource.com/node_4.x jessie main" >> /etc/apt/sources.list.d/nodejs.list #Install it. apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated install nodejs #Now remove the source. rm /etc/apt/sources.list.d/nodejs.list apt-get clean #Added these in order to get the npm install to run properly. #The problem was building canvas. apt-get -y install libjpeg62-turbo-dev libpango1.0-dev libgif-dev g++ #Create directory for tileserver application. mkdir -p /usr/src/app #Get the Klokantech code for the server. cd /usr/src/app curl -L https://github.com/klokantech/tileserver-gl/archive/master.zip -o master.zip unzip master.zip cp -r tileserver-gl-master/* ./ rm -rf tileserver-gl-master #Install the node stuff npm install --production #Set environment variable echo NODE_ENV=\"production\" >> /etc/environment #Create the folder for the mbtiles files (you'll need to supply these later). mkdir /data #In case other servers are installed and running, stop them. systemctl stop apache2 mysql systemctl disable apache2 mysql echo "Now put your mbtiles files into the /data folder, and run /usr/src/app/run.sh." #Start the tileserver on port 80. #run.sh
This could form the basis for a VM-based tileserver for our projects, including the Confederation Debates; running a server for all of Canada is quite practical due to the efficiency of the vector format.