to provide, via the included Chef code, a reference for installing your own Pelias system:
learn what dependencies you'll need, what the workflow looks like and how you can mold that to your own environment and needs
to provide a sandbox environment for people to do quick development against a local Pelias instance
Access points
API: curl http://localhost:3100/v1
Leaflet Demo: references the API on search.mapzen.com, change url to localhost:3100 so you can see a visual representation of the data you're loading
vagrant ssh && sudo su - and you've got free reign in a sandboxed environment
You can also share both access to your vagrant environment via ssh, or just share the API endpoint:
vagrant share --ssh will accomplish both
vagrant share will allow only the latter
Environment
you can set the following environment variables to specify the number of cores and amount of RAM in MB to allocate to the VM. If left unset, we will infer sensible defaults (see Vagrantfile).
you can alter the default settings in pelias_settings.example.rb by using a local config, which can in fact be used to override any value set in the chef run:
if you use rbenv or otherwise manipulate your path, make sure you set /opt/chefdk/bin ahead of any other locally installed gems that might conflict with berkshelf, foodcritic, etc, e.g.:
copy the included pelias_settings.example.rb to a location of your choice, then export the environment variable PELIAS_VAGRANT_CFG to reference it: export PELIAS_VAGRANT_CFG=/path/to/the/file
you can leave the defaults in place until you get familiar with things, or if you're feeling up to it, edit away
you can override anything found in attributes/default.rb, but typically what you'll want access to is referenced in the example config: pelias_settings.example.rb
from the repository root run vagrant up, which will:
download the vagrant box (this is a one time operation)
boot a linux instance that you can connect to via vagrant ssh
install all the dependencies required to load data into and run Pelias:
elasticsearch
nodejs
required Pelias repositories
other system dependencies
create the Elasticsearch 'pelias' index
run the Pelias API server, which you can interact with locally via your browser, curl, etc thanks to the magic of port forwarding: example query
as soon as the geonames data load starts, you'll be able to start querying the index via the API
more details on the API can be found here: Pelias API
in addition, you can access our Demo which will let you visualize the data you're loading, run searches, etc.
the demo by default uses the endpoint API search.mapzen.com, clone the project and change URL to localhost:3100 to query your local instance
load Geonames data for England into Elasticsearch
load an OSM extract for London into Elasticsearch
vagrant suspend or vagrant halt will stop the virtual machine without any data loss
vagrant up will bring it back online for use
to start entirely from scratch: vagrant destroy; vagrant up, or to just reload all the data: curl -XDELETE http://localhost:9200/pelias followed by vagrant provision
How long will this take?
presently, to load the defaults (geonames for GB, quattroshapes for GBR and London OSM data): ~30 minutes, not including initial build time of the VM, which is a one time event
larger countries with more data, e.g. the US and most countries in Western Europe, will take longer
Tweaking things
the pelias_settings.example.rb file shows some ways you can define/override values in the provisioning process
you can copy this file to a location of your choice and reference it via an environment variable: PELIAS_VAGRANT_CFG
if the environment variable is set, vagrant will attempt to load the contents of the file it references
if the environment variable is not set, vagrant will load pelias_settings.example.rb provided in the repository
let's suppose you want to load osm data for locations in Germany and Italy:
from the repo root: cp pelias_settings.example.rb ~/.pelias_settings.rb
in your profile, export PELIAS_VAGRANT_CFG=${HOME}/.pelias_settings.rb
this file is now your means of manipulating the vagrant chef run going forward
openaddresses
import data from openaddresses with an array of data files from the default data directory in default.rb (remove data_files hash for the entire global collection):