Setting up tilestream

From stgo
Jump to: navigation, search

>> return to Cedeus IDE


Setting up TileStream

This page documents how to install TileStream, a tile server for MapBox Tiles generated with MapBox TileMill, on Ubuntu 12.04. The basic description is taken from TileStreams Github page.

  • I took an existing copy of my VirtualBox with Ubuntu 12.04 installed, including Apache2
  • sudo apt-get update
  • Note: there are 2 options to install TileStream, one from source and one from directly (described on the github page a bit below). The latter is useful for running multiple applications that use node.js. As I am having a separate VirtualBox just for that I used Option A (below). But, if TileStream is run on the same server as GeoNode, I think one needs to use Option B - Alternate Procedure since GeoNode uses Node.js as well.
  • sudo apt-get install curl build-essential libssl-dev libsqlite3-0 libsqlite3-dev git-core This installs curl, sqlite, git etc. When running the command I also got some problems with a repository location so I did add the parameter "--fix-missing" as suggested.
  • next step is to add a further apt repository, but for that I needed to enable add-apt using sudo apt-get install python-software-properties
  • add the node.js repository: sudo apt-add-repository ppa:chris-lea/node.js
  • update: <code>sudo apt-get update
  • install node.js: sudo apt-get install nodejs Note, the TileStream install instructions say that nodejs-dev and npm should be installed too, but this blog entry says that for nodejs version 0.10.0 these packages don't exist anymore, while they did for node.js 0.8.x.
  • get TileStream from GitHub: git clone https://github.com/mapbox/tilestream.git
  • switch to the folder cd tilestream and install TileStream npm install
    • the output I got after was like this

[sqlite3] Success: "lib/node_sqlite3.node" is installed
sphericalmercator@1.0.2 node_modules/sphericalmercator

step@0.0.5 node_modules/step

underscore@1.3.3 node_modules/underscore

modestmaps@3.3.5 node_modules/modestmaps

wax@6.4.2 node_modules/wax

tilelive@4.3.3 node_modules/tilelive
├── generic-pool@1.0.12
└── optimist@0.3.7 (wordwrap@0.0.2)

bones@1.3.29 node_modules/bones
├── underscore@1.1.7
├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.8)
├── backbone@0.3.3
├── mirror@0.3.3 (uglify-js@1.0.2)
├── express@2.5.11 (qs@0.4.2, mime@1.2.4, mkdirp@0.3.0, connect@1.9.2)
└── jquery@1.6.3 (htmlparser@1.7.7, jsdom@0.10.1)

mbtiles@0.2.9 node_modules/mbtiles
├── underscore@1.5.2
└── sqlite3@2.2.0 (node-pre-gyp@0.2.6)

  • start TileStream from within the tilestream directory ./index.js start (or use "--help" to check out the startup option)
  • now TileStream should be available in the machines web browser at http://localhost:8888 (for a web browser one needs to setup XFCE desktop, etc, as described under: [accessing server infra]) .
  • To make the port 8888 of the VM available externally there has to be added a new --natpf1 rule with VBoxManage. Then I started TileStream with ./index.js start --host 146.155.17.113 to see it in my webbrowser on cedeusgis.
  • To see TileStream running at port 80 one should use ./index.js start --uiPort=[80] , but this gave me actually an error.
  • for running TileStream longer:
    • the tile server can be startup using ./index.js start --host 146.155.17.113 &. This should return a PID to later use the kill command.
    • or (ToDo): Ubuntu settings should be adapted so that TileServer is automatically run on machine startup
  • next I copied the Fondef tileset (1.5G with tar) to my TileStream VM into /usr/share/tilestream, so I started TileStream now with
    ./tilestream/index.js start --host 146.155.17.113 --tiles=/usr/share/tilestream

Note, if there comes a message like

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1042:14)
    at listen (net.js:1064:10)
    at Server.listen (net.js:1138:5)
    at _.extend.start (/home/ssteinig/tilestream/node_modules/bones/server/server.js:34:27)

Then the port may be un use already. Check this with netstat -a

TileStream on Lautaro by Daniel

  • the TileStream on Lautaro serves the following "Fondef" tileset: http://lautaro.ing.puc.cl/map/v2/Fondef/{z}/{x}/{y}.png
  • Daniel used the following start params: /bin/sh /srv/www/tilestream/start --uiPort=9876 --tilePort=9877 --tiles=/usr/share/tilestream obtained with htop