#!/bin/sh # ================================================================= # # Authors: Just van den Broecke > # Jorge Samuel Mendes de Jesus # # Copyright (c) 2019 Just van den Broecke # Copyright (c) 2019 Jorge Samuel Mendes de Jesus # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # ================================================================= echo "Starting script to add geojson" # move to the directory of this setup script cd "$(dirname "$0")" # for some reason even when port 9200 is open Elasticsearch is unable to be accessed as authentication fails # a few seconds later it works # incresing to 50s for wait in a slow system /_cluster/health?wait_for_status=yellow&timeout=50s until $(curl -sSf -XGET --insecure 'http://localhost:9200/_cluster/health?wait_for_status=yellow' > /dev/null); do printf 'No status yellow from ES, trying again in 10 seconds \n' sleep 10 done echo "Elasticsearch seems to be working - Adding ne_110m_populated_places_simple.geojson to ES" python3 /load_es_data.py /usr/share/elasticsearch/data/ne_110m_populated_places_simple.geojson geonameid echo "Seems that data was loaded" # create a new index with the settings in es_index_config.json #curl -v --insecure --user elastic:changeme -XPUT '0.0.0.0:9200/test?pretty' -H 'Content-Type: application/json' -d @es_index_config.json