diff --git a/entrypoint.sh b/entrypoint.sh index 9ab50eea2f43990ac5af5a91e96ed3af8b377376..dbe9c4f842e9ceb18fd555fa006bf90460978a34 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,7 +9,25 @@ fi # Start photon if elastic index exists if [ -d "/photon/photon_data/elasticsearch" ]; then echo "Starting photon" - java -jar photon.jar -host nominatim -port 5432 -database nominatim -user nominatim -password password1234 + java -jar photon.jar -host nominatim -port 5432 -database nominatim -user nominatim -password password1234 & + + ### Start continuous update ### + + while true; do + starttime=$(date +%s) + + curl http://localhost:2322/nominatim-update + + # sleep a bit if updates take less than 5 minutes + endtime=$(date +%s) + elapsed=$((endtime - starttime)) + if [[ $elapsed -lt 300 ]]; then + sleepy=$((300 - $elapsed)) + echo "Sleeping for ${sleepy}s..." + sleep $sleepy + fi + done + else echo "Could not start photon, the search index could not be found" fi diff --git a/nominatim-3.1/start.sh b/nominatim-3.1/start.sh index 8120aea1de15d89398f0cd460edd8f70198264d7..5a11e92d598cc4b22f376166220b45cefd838621 100755 --- a/nominatim-3.1/start.sh +++ b/nominatim-3.1/start.sh @@ -1,4 +1,12 @@ #!/bin/bash service postgresql start /usr/sbin/apache2ctl -D FOREGROUND + +## Set up nominatim updates ### + +sudo -u nominatim ./src/build/utils/update.php --init-updates +sudo -u nominatim ./src/build/utils/update.php --import-osmosis-all & + +## Follow log ### + tail -f /var/log/postgresql/postgresql-9.5-main.log diff --git a/start.sh b/start.sh index 06993a50a72921f88a969ce6565a125a1fafa2ec..ead75218d3ee4f92dc176575cb8c1672ca6eef26 100755 --- a/start.sh +++ b/start.sh @@ -3,26 +3,4 @@ ### Start all containers ### docker-compose down -docker-compose up -d - -## Set up nominatim updates ### - -docker exec -it photon-deploy_nominatim_1 sudo -u nominatim ./src/build/utils/update.php --init-updates -docker exec -it photon-deploy_nominatim_1 sudo -u nominatim ./src/build/utils/update.php --import-osmosis-all & - -### Start continuous update ### - -while true; do - starttime=$(date +%s) - - curl http://localhost:2322/nominatim-update - - # sleep a bit if updates take less than 5 minutes - endtime=$(date +%s) - elapsed=$((endtime - starttime)) - if [[ $elapsed -lt 300 ]]; then - sleepy=$((300 - $elapsed)) - echo "Sleeping for ${sleepy}s..." - sleep $sleepy - fi -done +docker-compose up -d \ No newline at end of file