Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ccabanero/6451691 to your computer and use it in GitHub Desktop.
Save ccabanero/6451691 to your computer and use it in GitHub Desktop.
TileStream - Notes for deploying TileStream on an AWS EC2 Ubuntu 12.04.2 Server
------------------------------------------------------------------------------------------------------------------------------
DESCRIPTION:
Notes for deploying TileStream on an AWS EC2 Ubuntu 12.04.2 Server for development. Includes workflow for creating
a local tile cache with TileMill, connecting to your Ubuntu EC2 server via SSH using Mac OSX Terminal, and uploading
your tiles (.mbtiles) to your TileStream server.
REFERENCES:
TileStream git repo: https://github.com/mapbox/tilestream
-----------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------
PART 1: Stand Up an Ubuntu 12.04.2 server on AWS EC2
---------------------------------------------------------
1. Below are notes for creating a new Ubuntu EC2 server with an Elastic IP
In the AWS EC2 console, choose 'Launch Instance'
Choose Ubuntu Server 12.04.2 LTS
Instance Details:
Number of Instances: 1
Instance Type: T1 Micro (t1.micro, 613 MB)
Launch Instance: (default)
RAM Disk ID: (default)
Monitoring: (default)
0 EBS Volumes: (default)
Key: Name | Value: TileStream-Ubuntu
Create a new Key Pair
Download the key pair - this file will be used each time we connect to this server
Create a Security Group with Inbound Rules
SSH - 22 (needed for connecting to server via SSH)
HTTP - 80
Custom - 8888 (used for testing Tiles)
Issue an Elastic IP
Go to EC2 --> Network & Security --> Elastic IPs --> Allocate New Address
Right-click on the IP address and associated with your Ubuntu server
2. Connecting to your Ubuntu Server using Mac OSX Terminal as an SSH client
Open Mac OSX Terminal
cd to the location of your .pem file
In Terminal ...
chmod 400 [name of pem file]
ssh -i [name of your pem flie].pem ubuntu@[your elastic ip]
for example: ssh -i tileStream.pem [email protected]
----------------------------------------------------------
PART 2: Install TileStream
----------------------------------------------------------
1. Update Ubuntu
In Terminal ...
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
2. Install TileStream
Reference: https://github.com/mapbox/tilestream
In Terminal ...
sudo apt-get install curl build-essential libssl-dev libsqlite3-0 libsqlite3-dev git-core python-pip\
sudo pip install nodeenv
git clone http://github.com/mapbox/tilestream.git
cd tilestream
nodeenv env --node=0.8.15
. env/bin/activate
npm install
3. Start TileStream
In Terminal ...
./index.js start --host [your.elastic.ip.address]
4. Test TileSTream
Open your browser and go to http://[your.elastic.ip.address]:8888. Note, you have not yet uploaded any tiles
-------------------------------------------------------------------
PART 3: Upload Your Tiles (mbtiles) to your TileStream Server
-------------------------------------------------------------------
1. Create a local tile cache using TileMill
Install the TileMill desktop program for your OS.
Open TileMill, create a new project, add shapefile data.
Style your data using Carto CSS.
Create a local tile cache by exporting as .MBTiles.
Take note of where the mbtiles file is saved (e.g. ~/Documents/MapBox/export).
2. Upload MBTiles to TileStream server
Open Mac OSX Terminal
cd to the location of your .pem file
In Terminal ...
scp -i [pemFileName].pem ~Documents/MapBox/export/[YourTileCache].mbtiles ubuntu@[ElasticIP]:~/Documents/MapBox/tiles
for example: scp -i tileStream.pem ~Documents/MapBox/export/MyTestTiles.mbtiles [email protected]:~/Documents/MapBox/tiles
3. Test that Tiles can be requested from your TileStream server
In a web browser go to: http://[your elastic ip]:8888/[Your Tile Cache - do not include .mbtiles extension]
for example: http://1.2.3.4:8888/MyTestTiles
@cristiam86
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment