Skip to content
Snippets Groups Projects
Commit a13700d4 authored by Alessandro Cerioni's avatar Alessandro Cerioni
Browse files

Struggling to find the proper way to make continuous update work!

parent 6986009d
Branches
No related tags found
No related merge requests found
version: '2' version: '2'
services: services:
nominatim: nominatim:
image: nominatim # image: nominatim
build:
context: ./nominatim-3.1
dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ./nominatimdata/postgresdata:/var/lib/postgresql/9.5/main - ./nominatimdata/postgresdata:/var/lib/postgresql/9.5/main
- ./nominatim-3.1/local.php:/app/src/build/settings/local.php - ./nominatim-3.1/local.php:/app/src/build/settings/local.php
ports: ports:
- 6432:5432 - 6432:5432
- 7070:8080 - 7070:8080
command: sh /app/start.sh command: sh /app/start.sh
photon: photon:
build: build:
context: . context: ./photon
dockerfile: Dockerfile dockerfile: Dockerfile
depends_on: depends_on:
- nominatim - nominatim
volumes: volumes:
- ./photondata:/photon/photon_data - ./photondata:/photon/photon_data
ports: ports:
- 2322:2322 - 2322:2322
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
@define('CONST_Postgis_Version', '2.2'); @define('CONST_Postgis_Version', '2.2');
// Website settings // Website settings
@define('CONST_Website_BaseURL', '/'); @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_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_Update_Interval', '86400'); // How often upstream publishes diffs
@define('CONST_Replication_Recheck_Interval', '900'); // How long to sleep if no update found yet @define('CONST_Replication_Recheck_Interval', '900'); // How long to sleep if no update found yet
......
#!/bin/bash #!/bin/bash
service postgresql start service postgresql start
/usr/sbin/apache2ctl -D FOREGROUND /usr/sbin/apache2ctl start
## Set up nominatim updates ### ## Set up nominatim updates ###
sudo -u nominatim ./src/build/utils/update.php --init-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 --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 ### ## Follow log ###
tail -f /var/log/postgresql/postgresql-9.5-main.log #tail -f /var/log/postgresql/postgresql-9.5-main.log
File moved
...@@ -13,20 +13,20 @@ if [ -d "/photon/photon_data/elasticsearch" ]; then ...@@ -13,20 +13,20 @@ if [ -d "/photon/photon_data/elasticsearch" ]; then
### Start continuous update ### ### Start continuous update ###
while true; do # while true; do
starttime=$(date +%s) # starttime=$(date +%s)
#
curl http://localhost:2322/nominatim-update # curl http://localhost:2322/nominatim-update
#
# sleep a bit if updates take less than 5 minutes # # sleep a bit if updates take less than 5 minutes
endtime=$(date +%s) # endtime=$(date +%s)
elapsed=$((endtime - starttime)) # elapsed=$((endtime - starttime))
if [[ $elapsed -lt 300 ]]; then # if [[ $elapsed -lt 300 ]]; then
sleepy=$((300 - $elapsed)) # sleepy=$((300 - $elapsed))
echo "Sleeping for ${sleepy}s..." # echo "Sleeping for ${sleepy}s..."
sleep $sleepy # sleep $sleepy
fi # fi
done # done
else else
echo "Could not start photon, the search index could not be found" echo "Could not start photon, the search index could not be found"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment