├── .env ├── how_to_guide.pdf ├── elasticsearch ├── 5.2.1 │ ├── elasticsearch.yml │ └── Dockerfile └── 2.4 │ └── Dockerfile ├── libpostal_baseimage └── Dockerfile ├── valhalla └── Dockerfile ├── LICENSE ├── run_services.sh ├── pelias.json ├── prep_data.sh ├── example.sh ├── docker-compose.yml └── readme.md /.env: -------------------------------------------------------------------------------- 1 | DATA_DIR=/tmp 2 | -------------------------------------------------------------------------------- /how_to_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pelias-deprecated/dockerfiles/HEAD/how_to_guide.pdf -------------------------------------------------------------------------------- /elasticsearch/5.2.1/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | xpack.security.enabled: false 2 | bootstrap.memory_lock: true 3 | network.host: 0.0.0.0 4 | http.port: 9200 5 | node.master: true 6 | node.data: true 7 | -------------------------------------------------------------------------------- /elasticsearch/2.4/Dockerfile: -------------------------------------------------------------------------------- 1 | # base image 2 | FROM elasticsearch:2.4 3 | 4 | # configure plugins 5 | RUN /usr/share/elasticsearch/bin/plugin install analysis-icu 6 | RUN /usr/share/elasticsearch/bin/plugin install cloud-aws 7 | -------------------------------------------------------------------------------- /libpostal_baseimage/Dockerfile: -------------------------------------------------------------------------------- 1 | # base image 2 | FROM pelias/baseimage 3 | 4 | # libpostal apt dependencies 5 | # note: this is done in one command in order to keep down the size of intermediate containers 6 | RUN apt-get update && \ 7 | apt-get install -y autoconf automake libtool pkg-config python && \ 8 | rm -rf /var/lib/apt/lists/* 9 | 10 | # install libpostal 11 | RUN git clone https://github.com/openvenues/libpostal /code/libpostal 12 | WORKDIR /code/libpostal 13 | RUN ./bootstrap.sh && \ 14 | ./configure --datadir=/usr/share/libpostal && \ 15 | make && make check && make install && \ 16 | ldconfig 17 | -------------------------------------------------------------------------------- /elasticsearch/5.2.1/Dockerfile: -------------------------------------------------------------------------------- 1 | # see: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html 2 | 3 | # base image 4 | FROM docker.elastic.co/elasticsearch/elasticsearch:5.2.1 5 | USER root 6 | 7 | # environmental settings 8 | ENV ES_JAVA_OPTS '-Xms512m -Xmx512m' 9 | ENV xpack.security.enabled 'false' 10 | ENV xpack.monitoring.enabled 'false' 11 | ENV cluster.name 'pelias-dev' 12 | ENV bootstrap.memory_lock 'true' 13 | RUN echo 'vm.max_map_count=262144' >> /etc/sysctl.conf 14 | 15 | # configure plugins 16 | RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu 17 | 18 | # elasticsearch config 19 | ADD elasticsearch.yml /usr/share/elasticsearch/config/ 20 | RUN chown elasticsearch:elasticsearch config/elasticsearch.yml 21 | 22 | # run as elasticsearch user 23 | USER elasticsearch 24 | -------------------------------------------------------------------------------- /valhalla/Dockerfile: -------------------------------------------------------------------------------- 1 | # base image 2 | FROM pelias/baseimage 3 | 4 | # grab all of the valhalla software from ppa 5 | RUN apt-get update && \ 6 | apt-get install -y software-properties-common python-software-properties && \ 7 | add-apt-repository -y ppa:kevinkreiser/prime-server && \ 8 | add-apt-repository -y ppa:valhalla-routing/valhalla && \ 9 | apt-get update && \ 10 | apt-get install -y valhalla-bin && \ 11 | rm -rf /var/lib/apt/lists/*; 12 | 13 | # change working dir 14 | RUN mkdir -p /code/valhalla 15 | WORKDIR /code/valhalla 16 | 17 | # generate config 18 | RUN valhalla_build_config \ 19 | --mjolnir-tile-dir '/data/valhalla' \ 20 | --mjolnir-tile-extract '/data/valhalla.tar' \ 21 | --mjolnir-timezone '/data/valhalla/timezones.sqlite' \ 22 | --mjolnir-admin '/data/valhalla/admins.sqlite' > valhalla.json 23 | 24 | # build script 25 | RUN echo 'valhalla_build_tiles -c valhalla.json /data/openstreetmap/*.osm.pbf; valhalla_export_edges --config valhalla.json > /data/polylines/pbf_extract.polyline;' > ./docker_build.sh 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Pelias Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /run_services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # deprecation notice 4 | 2>&1 echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'; 5 | 2>&1 echo 'This repository has been deprecated in favour of https://github.com/pelias/docker'; 6 | 2>&1 echo; 7 | 2>&1 echo 'We strongly recommended you to migrate any code referencing this repository'; 8 | 2>&1 echo 'to use https://github.com/pelias/docker as soon as possible.' 9 | 2>&1 echo; 10 | 2>&1 echo 'You can find more information about why we deprecated this code along with a migration guide in the wiki:'; 11 | 2>&1 echo 'https://github.com/pelias/dockerfiles/wiki/Deprecation-Notice'; 12 | 2>&1 echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'; 13 | 14 | # load DATA_DIR and other vars from docker-compose .env file 15 | export $(cat .env | xargs) 16 | 17 | # start elasticsearch if it's not already running 18 | if ! [ $(curl --output /dev/null --silent --head --fail http://localhost:9200) ]; then 19 | docker-compose up -d elasticsearch; 20 | 21 | # wait for elasticsearch to start up 22 | echo 'waiting for elasticsearch service to come up'; 23 | until $(curl --output /dev/null --silent --head --fail http://localhost:9200); do 24 | printf '.' 25 | sleep 2 26 | done 27 | fi 28 | 29 | # assuming elasticsearch is already running 30 | 31 | # start the containers 32 | # note: the -d flag will background the logs 33 | docker-compose up -d interpolation; 34 | docker-compose up -d placeholder; 35 | docker-compose up -d pip-service; 36 | docker-compose up -d libpostal; 37 | docker-compose up -d api; 38 | 39 | -------------------------------------------------------------------------------- /pelias.json: -------------------------------------------------------------------------------- 1 | { 2 | "logger": { 3 | "level": "info", 4 | "timestamp": false 5 | }, 6 | "esclient": { 7 | "hosts": [{ 8 | "host": "elasticsearch" 9 | }] 10 | }, 11 | "elasticsearch": { 12 | "settings": { 13 | "index": { 14 | "refresh_interval": "10s", 15 | "number_of_replicas": "0", 16 | "number_of_shards": "1" 17 | } 18 | } 19 | }, 20 | "api": { 21 | "textAnalyzer": "libpostal", 22 | "services": { 23 | "placeholder": { 24 | "url": "http://placeholder:4100" 25 | }, 26 | "libpostal": { 27 | "url": "http://libpostal:8080" 28 | }, 29 | "pip": { 30 | "url": "http://pip-service:4200" 31 | }, 32 | "interpolation": { 33 | "url": "http://interpolation:4300" 34 | } 35 | } 36 | }, 37 | "imports": { 38 | "adminLookup": { 39 | "enabled": true 40 | }, 41 | "geonames": { 42 | "datapath": "/data/geonames", 43 | "countryCode": "ALL" 44 | }, 45 | "openstreetmap": { 46 | "download": [ 47 | { 48 | "sourceURL": "https://s3.amazonaws.com/metro-extracts.nextzen.org/portland_oregon.osm.pbf" 49 | } 50 | ], 51 | "leveldbpath": "/tmp", 52 | "datapath": "/data/openstreetmap", 53 | "import": [{ 54 | "filename": "portland_oregon.osm.pbf" 55 | }] 56 | }, 57 | "openaddresses": { 58 | "datapath": "/data/openaddresses", 59 | "files": [ "us/or/portland_metro.csv" ] 60 | }, 61 | "polyline": { 62 | "datapath": "/data/polylines", 63 | "files": [ "extract.0sv" ] 64 | }, 65 | "whosonfirst": { 66 | "datapath": "/data/whosonfirst", 67 | "importVenues": false, 68 | "importPostalcodes": true, 69 | "importPlace": "101715829" 70 | }, 71 | "interpolation": { 72 | "download": { 73 | "tiger": { 74 | "datapath": "/data/tiger", 75 | "states": [ 76 | { 77 | "state_code": 41 78 | } 79 | ] 80 | } 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /prep_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # deprecation notice 4 | 2>&1 echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'; 5 | 2>&1 echo 'This repository has been deprecated in favour of https://github.com/pelias/docker'; 6 | 2>&1 echo; 7 | 2>&1 echo 'We strongly recommended you to migrate any code referencing this repository'; 8 | 2>&1 echo 'to use https://github.com/pelias/docker as soon as possible.' 9 | 2>&1 echo; 10 | 2>&1 echo 'You can find more information about why we deprecated this code along with a migration guide in the wiki:'; 11 | 2>&1 echo 'https://github.com/pelias/dockerfiles/wiki/Deprecation-Notice'; 12 | 2>&1 echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'; 13 | 14 | # load DATA_DIR and other vars from docker-compose .env file 15 | export $(cat .env | xargs) 16 | 17 | # start elasticsearch if it's not already running 18 | if ! [ $(curl --output /dev/null --silent --head --fail http://localhost:9200) ]; then 19 | docker-compose up -d elasticsearch 20 | 21 | # wait for elasticsearch to start up 22 | echo 'waiting for elasticsearch service to come up' 23 | until $(curl --output /dev/null --silent --head --fail http://localhost:9200); do 24 | printf '.' 25 | sleep 2 26 | done 27 | fi 28 | 29 | # create the index in elasticsearch before importing data 30 | docker-compose run --rm schema npm run create_index 31 | 32 | # download all the data to be used by imports 33 | docker-compose run --rm whosonfirst npm run download & 34 | docker-compose run --rm openaddresses npm run download & 35 | docker-compose run --rm openstreetmap npm run download & 36 | docker-compose run --rm interpolation npm run download-tiger & 37 | 38 | wait 39 | 40 | # polylines data prep requires openstreetmap data, so wait until that's done to start this 41 | # but then wait to run the polylines importer process until this is finished 42 | #docker-compose run --rm valhalla bash ./docker_build.sh 43 | docker-compose run --rm polylines bash ./docker_extract.sh 44 | 45 | docker-compose run --rm placeholder npm run extract 46 | docker-compose run --rm placeholder npm run build 47 | 48 | docker-compose run --rm interpolation bash ./docker_build.sh & 49 | docker-compose run --rm whosonfirst npm start 50 | docker-compose run --rm openaddresses npm start 51 | docker-compose run --rm openstreetmap npm start 52 | docker-compose run --rm polylines npm start 53 | 54 | wait 55 | -------------------------------------------------------------------------------- /example.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # deprecation notice 4 | 2>&1 echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'; 5 | 2>&1 echo 'This repository has been deprecated in favour of https://github.com/pelias/docker'; 6 | 2>&1 echo; 7 | 2>&1 echo 'We strongly recommended you to migrate any code referencing this repository'; 8 | 2>&1 echo 'to use https://github.com/pelias/docker as soon as possible.' 9 | 2>&1 echo; 10 | 2>&1 echo 'You can find more information about why we deprecated this code along with a migration guide in the wiki:'; 11 | 2>&1 echo 'https://github.com/pelias/dockerfiles/wiki/Deprecation-Notice'; 12 | 2>&1 echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'; 13 | 14 | export DATA_DIR='/media/black/data' 15 | 16 | function trimWofById() { 17 | sudo chown -R "$USER:$USER" "$DATA_DIR" 18 | find "$DATA_DIR/whosonfirst/data" -type f -name '*.geojson' -print0 | xargs --null grep -Z -L "$1" | xargs --null rm 19 | find "$DATA_DIR/whosonfirst/meta" -type f -name '*.csv' | xargs sed -i "/\($1\|cessation\)/!d" 20 | } 21 | 22 | function valhallaBuildTiles() { 23 | docker-compose run --rm valhalla bash -c \ 24 | 'valhalla_build_tiles -c valhalla.json /data/openstreetmap/extract.osm.pbf' 25 | } 26 | 27 | function valhallaExportEdges() { 28 | docker-compose run --rm valhalla bash -c \ 29 | 'valhalla_export_edges --config valhalla.json > /data/polyline/extract.0sv' 30 | } 31 | 32 | function downloadPolylines() { 33 | wget -O- "$1" | gunzip > "$DATA_DIR/polyline/extract.0sv" 34 | } 35 | 36 | function downloadPBFExtract() { 37 | wget -O- "$1" > "$DATA_DIR/openstreetmap/extract.osm.pbf" 38 | } 39 | 40 | # ensure data dirs exists 41 | mkdir -p "$DATA_DIR/elasticsearch" \ 42 | "$DATA_DIR/whosonfirst" \ 43 | "$DATA_DIR/polyline" \ 44 | "$DATA_DIR/openstreetmap" \ 45 | "$DATA_DIR/valhalla"; 46 | 47 | # run build scripts 48 | . build.sh; 49 | 50 | # create index 51 | docker-compose run --rm schema bash -c 'node scripts/create_index.js' 52 | 53 | # import whosonfirst 54 | # trimWofById '85633111'; # delete wof records not referring to germany 55 | docker-compose run --rm whosonfirst bash -c 'npm start' 56 | 57 | # import polylines 58 | # downloadPolylines 'http://missinglink.files.s3.amazonaws.com/berlin.gz'; 59 | # valhallaBuildTiles; 60 | # valhallaExportEdges; 61 | docker-compose run --rm polylines bash -c 'npm start' 62 | 63 | # import openstreetmap 64 | # downloadPBFExtract 'https://s3.amazonaws.com/metro-extracts.mapzen.com/berlin_germany.osm.pbf'; 65 | docker-compose run --rm openstreetmap bash -c '\ 66 | sed -i "/addr/d" config/features.js; \ 67 | sed -i "/addressExtractor/d" stream/importPipeline.js; \ 68 | npm start' 69 | 70 | # import geonames 71 | # docker-compose run --rm geonames bash -c 'npm start' 72 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | networks: 3 | pelias: 4 | driver: bridge 5 | volumes: 6 | libpostaldata: 7 | driver: local 8 | services: 9 | libpostal_baseimage: 10 | image: pelias/libpostal_baseimage 11 | container_name: pelias_libpostal_baseimage 12 | build: libpostal_baseimage 13 | schema: 14 | image: pelias/schema 15 | container_name: pelias_schema 16 | networks: [ "pelias" ] 17 | volumes: 18 | - "./pelias.json:/code/pelias.json" 19 | api: 20 | image: pelias/api 21 | container_name: pelias_api 22 | restart: always 23 | environment: [ "PORT=4000" ] 24 | ports: [ "4000:4000" ] 25 | networks: [ "pelias" ] 26 | volumes: 27 | - "./pelias.json:/code/pelias.json" 28 | libpostal: 29 | image: pelias/go-whosonfirst-libpostal 30 | container_name: pelias_libpostal 31 | restart: always 32 | ports: [ "8080:8080" ] 33 | networks: [ "pelias" ] 34 | placeholder: 35 | image: pelias/placeholder 36 | container_name: pelias_placeholder 37 | restart: always 38 | environment: [ "PORT=4100" ] 39 | ports: [ "4100:4100" ] 40 | networks: [ "pelias" ] 41 | volumes: 42 | - "./pelias.json:/code/pelias.json" 43 | - "${DATA_DIR}:/data" 44 | whosonfirst: 45 | image: pelias/whosonfirst 46 | container_name: pelias_whosonfirst 47 | networks: [ "pelias" ] 48 | volumes: 49 | - "./pelias.json:/code/pelias.json" 50 | - "${DATA_DIR}:/data" 51 | openstreetmap: 52 | image: pelias/openstreetmap 53 | container_name: pelias_openstreetmap 54 | networks: [ "pelias" ] 55 | volumes: 56 | - "./pelias.json:/code/pelias.json" 57 | - "${DATA_DIR}:/data" 58 | openaddresses: 59 | image: pelias/openaddresses 60 | container_name: pelias_openaddresses 61 | networks: [ "pelias" ] 62 | volumes: 63 | - "./pelias.json:/code/pelias.json" 64 | - "${DATA_DIR}:/data" 65 | # Leave geonames out of the default build, uncomment if desired 66 | # geonames: 67 | # depends_on: [ "whosonfirst" ] 68 | # image: pelias/geonames 69 | # container_name: pelias_geonames 70 | # networks: [ "pelias" ] 71 | # volumes: 72 | # - "./pelias.json:/code/pelias.json" 73 | # - "${DATA_DIR}:/data" 74 | # Use the pbf polyline extractor written by Peter for now because it's much faster 75 | # valhalla: 76 | # image: pelias/valhalla 77 | # container_name: pelias_valhalla 78 | # build: imports/valhalla 79 | # restart: always 80 | # networks: [ "pelias" ] 81 | # volumes: 82 | # - "${DATA_DIR}:/data" 83 | polylines: 84 | image: pelias/polylines 85 | container_name: pelias_polylines 86 | networks: [ "pelias" ] 87 | volumes: 88 | - "./pelias.json:/code/pelias.json" 89 | - "${DATA_DIR}:/data" 90 | interpolation: 91 | depends_on: [ "libpostal_baseimage" ] 92 | image: pelias/interpolation 93 | container_name: pelias_interpolation 94 | restart: always 95 | environment: [ "PORT=4300" ] 96 | ports: [ "4300:4300" ] 97 | networks: [ "pelias" ] 98 | volumes: 99 | - "./pelias.json:/code/pelias.json" 100 | - "libpostaldata:/usr/share/libpostal" 101 | - "${DATA_DIR}:/data" 102 | pip-service: 103 | image: pelias/pip-service 104 | container_name: pelias_pip-service 105 | restart: always 106 | environment: [ "PORT=4200" ] 107 | ports: [ "4200:4200" ] 108 | networks: [ "pelias" ] 109 | volumes: 110 | - "./pelias.json:/code/pelias.json" 111 | - "${DATA_DIR}:/data" 112 | document-service: 113 | image: pelias/document-service 114 | container_name: pelias_document-service 115 | restart: always 116 | ports: [ "5000:5000" ] 117 | networks: [ "pelias" ] 118 | volumes: 119 | - "./pelias.json:/code/pelias.json" 120 | - "${DATA_DIR}:/data" 121 | elasticsearch: 122 | image: pelias/elasticsearch 123 | container_name: pelias_elasticsearch 124 | build: elasticsearch/2.4 125 | restart: always 126 | ports: [ "9200:9200", "9300:9300" ] 127 | networks: [ "pelias" ] 128 | volumes: 129 | - "${DATA_DIR}/elasticsearch:/usr/share/elasticsearch/data" 130 | ulimits: 131 | memlock: 132 | soft: -1 133 | hard: -1 134 | nofile: 135 | soft: 65536 136 | hard: 65536 137 | mem_limit: 1g 138 | cap_add: [ "IPC_LOCK" ] 139 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | :warning: This repository has been deprecated in favour of https://github.com/pelias/docker. 3 | 4 | :warning: We strongly recommended you to migrate any code referencing this repository to use https://github.com/pelias/docker as soon as possible. 5 | 6 | :warning: You can find more information about why we deprecated this code along with a migration guide in the wiki: https://github.com/pelias/dockerfiles/wiki/Deprecation-Notice 7 | 8 | --- 9 | 10 | # Pelias Dockerfiles 11 | 12 | This is a [Docker Compose](https://github.com/docker/compose#docker-compose) based demo application for running the [Pelias Geocoder](https://github.com/pelias/pelias). 13 | 14 | It is configured to set up a geocoder for Portland, Oregon, USA and should be able to do so in about 30 minutes with a fast internet connection. 15 | 16 | Many options can be changed to support local development or use for other cities. However, it is not suitable for full planet geocoding installations. For that, see our [install documentation](https://pelias.io/install.html) 17 | 18 | ## Step-by-step Guide 19 | 20 | Check out a [self-contained workshop](how_to_guide.pdf) that explains all the moving parts that make up the Pelias geocoding engine 21 | and then shows you how to setup a geocoder for a single city or county right on your own machine. 22 | 23 | - [Growing Pelias in Containers](how_to_guide.pdf) 24 | 25 | **Warning:** Copy/paste from the JSON in this workshop PDF is currently broken. See https://github.com/pelias/dockerfiles/issues/33 for details. 26 | 27 | ### Prerequisites 28 | 1. Docker version `1.10.1` or later. 29 | 30 | 1. A directory for storing downloaded datasets. This directory should have at least 30GB disk space free 31 | 32 | 1. **OSX Only** 33 | 1. In Docker > Preferences > Advanced, set the CPU to `4` and memory to `12 GB`. This ensures that Docker has enough memory to run the imports and API. 34 | 35 | #### Create a Directory for Your Data 36 | 37 | This is where all the data from OpenStreetMap, OpenAddresses, etc will be downloaded. All of the containers are already configured to use this data. 38 | 39 | ```bash 40 | mkdir -p /tmp/data 41 | ``` 42 | 43 | If you wish to change the location of your data directory you can simply change the `DATA_DIR` environment variable defined in the `.env` file. 44 | 45 | ## Getting Up and Running 46 | 47 | First you'll need to create (or edit) the provided `pelias.json` file at the root of the repository. 48 | This is where you will specify all the details of your desired Pelias instance, such as area of coverage and data sources. 49 | You can reference the individual data sections below for more details on configuration. 50 | 51 | Once that's ready, the following command will build all the images and containers required: 52 | 53 | ```bash 54 | ./build.sh 55 | ``` 56 | 57 | Once the process is complete you can list the running services: 58 | 59 | ```bash 60 | docker-compose ps 61 | Name Command State Ports 62 | ------------------------------------------------------------------------------------------ 63 | pelias_api npm start Up 0.0.0.0:4000->4000/tcp 64 | pelias_elasticsearch /bin/bash bin/es-docker Up 0.0.0.0:9200->9200/tcp, 9300/tcp 65 | pelias_geonames /bin/bash Exit 0 66 | pelias_interpolation npm start Up 0.0.0.0:4300->4300/tcp 67 | pelias_openaddresses /bin/bash Exit 0 68 | pelias_openstreetmap /bin/bash Exit 0 69 | pelias_pip npm start Up 0.0.0.0:4200->4200/tcp 70 | pelias_placeholder npm start Up 0.0.0.0:4100->4100/tcp 71 | pelias_polylines /bin/bash Exit 0 72 | pelias_schema /bin/bash Exit 0 73 | pelias_whosonfirst /bin/bash Exit 0 74 | ``` 75 | 76 | ## Checking that Services are Running 77 | All the services should be up and running after the build script completes. The ports on which the services run should match 78 | the configuration in `docker-compose.yml`. You can confirm this worked correctly by visiting each one at the corresponding URLs. 79 | 80 | ### API 81 | http://localhost:4000/v1/search?text=portland 82 | 83 | [http://localhost:4000/v1/search?text=1901 Main St](http://localhost:4000/v1/search?text=1901 Main St) 84 | 85 | http://localhost:4000/v1/reverse?point.lon=-122.650095&point.lat=45.533467 86 | 87 | ### Placeholder 88 | http://localhost:4100/demo/#eng 89 | 90 | ### PIP (point in polygon) 91 | http://localhost:4200/-122.650095/45.533467 92 | 93 | ### Interpolation 94 | http://localhost:4300/demo/#13/45.5465/-122.6351 95 | 96 | 97 | ## Data Download and Import 98 | 99 | You can run `./prep_data.sh` to download and import data after changing configuration settings or to update existing data. 100 | 101 | Below are configuration options for the various data sources. 102 | 103 | ```bash 104 | mdkir -p /tmp/data 105 | sh ./prep_data.sh 106 | ``` 107 | 108 | ### Individual Data Sources 109 | 110 | #### Who's on First 111 | 112 | *note: this guide only covers importing the admin areas (like cities, countries etc.)* 113 | 114 | ##### configuration 115 | For WOF data, use `imports.whosonfirst.importPlace` (see [whosonfirst repo doc](https://github.com/pelias/whosonfirst#configuration)) 116 | 117 | ```javascript 118 | "imports": { 119 | "whosonfirst": { 120 | "datapath": "/data/whosonfirst", 121 | "importVenues": false, 122 | "importPostalcodes": true, 123 | "importPlace": "101715829" 124 | } 125 | } 126 | ``` 127 | 128 | ##### download 129 | 130 | ```bash 131 | docker-compose run --rm whosonfirst npm run download 132 | ``` 133 | 134 | ##### import 135 | 136 | ```bash 137 | docker-compose run --rm whosonfirst bash -c 'npm start' 138 | ``` 139 | 140 | #### OpenAddresses 141 | 142 | ##### configuration 143 | For OA data, use `imports.openaddresses.files` (see [openaddresses repo doc](https://github.com/pelias/openaddresses#configuration)) 144 | 145 | ```javascript 146 | "imports": { 147 | "openaddresses": { 148 | "datapath": "/data/openaddresses", 149 | "files": [ "us/or/portland_metro.csv" ] 150 | } 151 | } 152 | ``` 153 | 154 | ##### download 155 | ```bash 156 | docker-compose run --rm openaddresses npm run download 157 | ``` 158 | 159 | ##### import 160 | ```bash 161 | docker-compose run --rm openaddresses npm start 162 | ``` 163 | 164 | #### OpenStreetMap 165 | 166 | Any moderately sized `osm.pbf` file will work. 167 | ##### configuration 168 | Once you find a URL from which you can consistently download the data, specify it in the configuration file and 169 | the download script will pull it down for you. 170 | 171 | For OSM data, use `imports.openstreetmap.download[]` (see [openstreetmap repo doc](https://github.com/pelias/openstreetmap#configuration)) 172 | 173 | ```javascript 174 | "imports": { 175 | "openstreetmap": { 176 | "download": [ 177 | { 178 | "sourceURL": "https://s3.amazonaws.com/metro-extracts.nextzen.org/portland_oregon.osm.pbf" 179 | } 180 | ], 181 | ... 182 | } 183 | } 184 | ``` 185 | 186 | ###### download 187 | 188 | Using the download script in the container: 189 | 190 | ```bash 191 | docker-compose run --rm openstreetmap npm run download 192 | ``` 193 | 194 | Or, download the data by other means such as `wget` (example for Singapore): 195 | 196 | ```bash 197 | wget -qO- https://s3.amazonaws.com/metro-extracts.nextzen.org/singapore.osm.pbf > /tmp/data/openstreetmap/extract.osm.pbf 198 | ``` 199 | 200 | ##### import 201 | 202 | ```bash 203 | docker-compose run --rm openstreetmap npm start 204 | ``` 205 | 206 | #### Geonames 207 | 208 | ##### configuration 209 | 210 | You can restrict the downloader to a single country by adding a `countryCode` property in your `pelias.json`: 211 | 212 | ```javascript 213 | "imports": { 214 | "geonames": { 215 | ... 216 | "countryCode": "SG" 217 | } 218 | } 219 | ``` 220 | 221 | ##### download 222 | 223 | ```bash 224 | docker-compose run --rm geonames npm run download 225 | ``` 226 | 227 | #### import 228 | 229 | ```bash 230 | docker-compose run --rm geonames npm start 231 | ``` 232 | 233 | ## Polylines 234 | 235 | ##### configuration 236 | 237 | ```javascript 238 | "imports": { 239 | "polyline": { 240 | "datapath": "/data/polylines", 241 | "files": ["pbf_extract.polyline"] 242 | } 243 | } 244 | ``` 245 | 246 | ##### download 247 | The extract of the polylines is done using the OSM pbf file so that must be downloaded first. See OpenStreetMap section for details on that. 248 | Once the pbf extract is in place, run the following command. 249 | 250 | ```bash 251 | docker-compose run --rm polylines sh ./docker_extract.sh 252 | ``` 253 | 254 | ##### import 255 | 256 | ```bash 257 | docker-compose run --rm polylines npm run start 258 | ``` 259 | 260 | ## Interpolation 261 | 262 | The [interpolation engine](https://github.com/pelias/interpolation/) combines OpenStreetMap, OpenAddresses, and TIGER (a USA-only address range dataset). See its project README for more configuration options. 263 | 264 | ## Setting Up Elasticsearch 265 | 266 | This will take place as part of the build script, but in the case you'd like to manually manipulate the schema, 267 | the following command will install the pelias schema in elasticsearch: 268 | 269 | ```bash 270 | docker-compose run --rm schema bash -c 'node scripts/create_index.js' 271 | ``` 272 | 273 | You can confirm this worked correctly by visiting http://localhost:9200/pelias/_mapping 274 | 275 | 276 | ## Shutting Down and Restarting 277 | To stop all the containers, `docker-compose down`. 278 | 279 | Restart all the containers with `docker-compose up` or `sh ./run_services.sh`. 280 | 281 | ## Saving docker images as tar files 282 | 283 | Docker images can be saved for offline use with the following command: 284 | 285 | ```bash 286 | docker images --filter 'reference=pelias/*:latest' --format '{{.Repository}}' | parallel --no-notice docker save -o '{/.}.tar' {} 287 | ``` 288 | --------------------------------------------------------------------------------