diff --git a/docker-compose.yml b/docker-compose.yml index 1b7043983007301ea21f3ac4a696866342493e38..f54ad5f58656a33ae8ecbe4d3d548599441b8bde 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,26 @@ version: '2' services: nominatim: - image: nominatim + # image: nominatim + build: + context: ./nominatim-3.1 + dockerfile: Dockerfile restart: unless-stopped volumes: - ./nominatimdata/postgresdata:/var/lib/postgresql/9.5/main - ./nominatim-3.1/local.php:/app/src/build/settings/local.php ports: - 6432:5432 - - 7070:8080 + - 7070:8080 command: sh /app/start.sh photon: build: - context: . + context: ./photon dockerfile: Dockerfile depends_on: - nominatim volumes: - ./photondata:/photon/photon_data ports: - - 2322:2322 \ No newline at end of file + - 2322:2322 diff --git a/nominatim-3.1/local.php b/nominatim-3.1/local.php index 12365e7453e623df8615d25aa060b77f4f1c55aa..0a221516aa7ad97dc58ac4a0a11de0a574647e7c 100755 --- a/nominatim-3.1/local.php +++ b/nominatim-3.1/local.php @@ -4,7 +4,7 @@ @define('CONST_Postgis_Version', '2.2'); // Website settings @define('CONST_Website_BaseURL', '/'); - @define('CONST_Replication_Url', 'https://download.geofabrik.de/europe/france-updates/'); + @define('CONST_Replication_Url', 'https://download.geofabrik.de/europe/france-updates'); @define('CONST_Replication_MaxInterval', '86400'); // Process each update separately, osmosis cannot merge multiple updates @define('CONST_Replication_Update_Interval', '86400'); // How often upstream publishes diffs @define('CONST_Replication_Recheck_Interval', '900'); // How long to sleep if no update found yet diff --git a/nominatim-3.1/start.sh b/nominatim-3.1/start.sh index 5a11e92d598cc4b22f376166220b45cefd838621..171d6f2f9510b16e5aaa7847f37d95505445d8bd 100755 --- a/nominatim-3.1/start.sh +++ b/nominatim-3.1/start.sh @@ -1,12 +1,36 @@ #!/bin/bash service postgresql start -/usr/sbin/apache2ctl -D FOREGROUND +/usr/sbin/apache2ctl start ## 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 & +#sudo -u nominatim ./src/build/utils/update.php --init-updates +#sudo -u nominatim ./src/build/utils/update.php --import-osmosis-all & + +while true; do + starttime=$(date +%s) + + + sudo -u nominatim ./src/build/utils/update.php --init-updates + #sudo -u nominatim ./src/build/utils/update.php --check-for-updates + sudo -u nominatim ./src/build/utils/update.php --import-osmosis --no-index + + curl http://photon:2322/nominatim-update + + #sudo -u nominatim ./src/build/utils/update.php --index + + # 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 + + ## Follow log ### -tail -f /var/log/postgresql/postgresql-9.5-main.log +#tail -f /var/log/postgresql/postgresql-9.5-main.log diff --git a/Dockerfile b/photon/Dockerfile similarity index 100% rename from Dockerfile rename to photon/Dockerfile diff --git a/entrypoint.sh b/photon/entrypoint.sh similarity index 63% rename from entrypoint.sh rename to photon/entrypoint.sh index dbe9c4f842e9ceb18fd555fa006bf90460978a34..7162ee2ff2c3ce3f25df9763ad1a912e3a4b799e 100755 --- a/entrypoint.sh +++ b/photon/entrypoint.sh @@ -13,20 +13,20 @@ if [ -d "/photon/photon_data/elasticsearch" ]; then ### 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 + # 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"