Created
November 7, 2017 12:37
-
-
Save wzup/b424cccea0e20a19bfb606618439a255 to your computer and use it in GitHub Desktop.
Pelias Build Notes for Ubuntu 14.04 (elasticsearch 1.7 - NodeJS 5)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu 14.04 Install Steps | |
# This information assumes you’re storing your data in /mnt/data — both elasticsearch data and pelias map data. I chose | |
# to create a separate volume keeping the data from the system, separated. You can still use /mnt/data without creating | |
# another volume to store it. | |
# Default ubuntu user runs all the commands, except for elevated ones. ubuntu user will run api | |
# Fix hosts file (simply adding ip hostname) | |
sudo nano /etc/hosts | |
# Update System | |
sudo apt-get update ; sudo apt-get dist-upgrade | |
# Install Java from repo | |
sudo add-apt-repository -y ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get -y install oracle-java8-installer | |
# Test JAVA | |
java -version | |
# Install build-essential, git | |
sudo apt-get install build-essential git | |
# Generate SSH key for github | |
ssh-keygen -t rsa -b 4096 -C "[email protected]" | |
# Check on ssh-agent | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_rsa | |
# Add SSH to github keys | |
cat ~/.ssh/id_rsa.pub | |
# Verify SSH access to github | |
ssh -T [email protected] | |
# Elastic Search Install | |
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
echo "deb http://packages.elastic.co/elasticsearch/1.7/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list | |
sudo apt-get update | |
sudo apt-get -y install elasticsearch | |
# Edit elasticsearch config (adjust cluster name, node name, and data path) | |
sudo nano /etc/elasticsearch/elasticsearch.yml | |
# Change paths ownership to elasticsearch | |
sudo mkdir /mnt/data/elasticsearch | |
sudo chown -R elasticsearch:elasticsearch /mnt/data/elasticsearch | |
# Create data paths and give ownership to ubuntu | |
sudo mkdir /mnt/data/whosonfirst-data | |
sudo mkdir /mnt/data/openaddresses | |
sudo mkdir /mnt/data/openstreetmap | |
cd /mnt/data | |
sudo chown -R ubuntu:ubuntu !(/mnt/data/elasticsearch) | |
# Restart elasticsearch | |
sudo service elasticsearch restart | |
# Add elasticsearch to boot | |
sudo update-rc.d elasticsearch defaults 95 10 | |
# Install Node 5.x | |
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
# Create ~/pelias.json | |
nano ~/pelias.json | |
# Though a script is provided by the Pelias team to download each repository, I opted to do it manually. Doing it one at a | |
# time allowed me to track any issues that may have occurred. I also decided to use ‘screen’ for any #process that would take | |
# longer than 30 minutes. I wanted to prevent an accidentally disconnect from messing up the import, since I was doing | |
# everything remotely. | |
# Get Pelias Schema | |
git clone [email protected]:pelias/schema.git | |
cd schema | |
git checkout production | |
npm install | |
node scripts/create_index.js | |
# Get OpenStreetMap | |
git clone [email protected]:pelias/openstreetmap.git | |
cd openstreetmap | |
git checkout production | |
npm install | |
screen npm start | |
# Get Geonames | |
git clone [email protected]:pelias/geonames.git | |
cd geonames | |
git checkout production | |
npm install | |
./bin/pelias-geonames -i us | |
# Get Pelias Who’s On First Admin | |
# I cloned the whosonfirst repository, ‘git clone https://github.com/whosonfirst/whosonfirst-data.git'. However, that was around 25GB of data, which | |
# most of it was probably unnecessary. Pelias has a download_data.js script, which is probably the preferred method which I’ve included here. | |
git clone [email protected]:pelias/whosonfirst.git | |
cd whosonfirst | |
git checkout production | |
npm install | |
npm run download | |
screen npm start | |
# Get Pelias API | |
git clone [email protected]:pelias/api.git | |
cd api | |
git checkout production | |
npm install | |
screen npm start | |
# Install pm2 to handle automatic starting and restarting of pelias API | |
# pm2 only restarts the applications that were running at the time of a shutdown | |
# if pelias api isn’t running, you can restart it using ‘pm2 start index.js’ and that | |
# should keep it running even when rebooting, but it’s important to understand, pm2 doesn’t | |
# hard link to the API, it only restarts what’s running | |
sudo npm install pm2 -g | |
cd ~/api | |
pm2 start index.js | |
sudo env PATH=$PATH:/usr/local/bin pm2 startup -u ubuntu | |
# example pelias.json | |
{ | |
"logger": { | |
"level": "debug" | |
}, | |
"esclient": { | |
"hosts": [{ | |
"env": "production", | |
"protocol": "http", | |
"host": "localhost", | |
"port": 9200 | |
}] | |
}, | |
"imports": { | |
"openstreetmap": { | |
"adminLookup": false, | |
"leveldbpath": "/tmp", | |
"datapath": "/mnt/data/openstreetmap", | |
"import": [{ | |
"filename": "north-america.osm.pbf" | |
}] | |
}, | |
"openaddresses": { | |
"datapath": "/mnt/data/openaddresses", | |
"files": [] | |
}, | |
"whosonfirst": { | |
"datapath": "/mnt/data/whosonfirst-data" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment