Skip to content

Deploying National Map on a Ubuntu server

kring edited this page Sep 30, 2014 · 9 revisions

A deployed National Map server consists of a node.js server with a varnish server in front of it.

First, install node.js and the node package manager (npm):

sudo apt-get update
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Part of the National Map build process (the Cesium part) also requires Java. Install it like so:

sudo apt-get install default-jre

Now that you have node, Java, and required libraries, you can get the rest of the dependencies and via the node package manager. Instructions for installing node.js packages, building National Map, and starting the node.js server are found in the Developers' Handbook.

Setting up varnish as a proxy server

To serve on port 80 a proxy needs to go in front of the node server on 3001. First install varnish

sudo apt-get install varnish

We do all of proxy needs inside server.js, so there is little to set up in the proxy. Just update backend default {.port= "3001" } in /etc/varnish/default.vcl. You should also tune parameters based on the server in /etc/default/varnish. The current one used on the production server is found in the varnish file at the root of the source tree.

sudo /etc/init.d/varnish stop
sudo nano /etc/varnish/default.vcl
sudo /etc/init.d/varnish start

and

npm start

or to just keep it running

sudo npm install forever -g
./run_server.sh