diff --git a/400-nominatim.conf b/400-nominatim.conf index 4aea773..bbaaf11 100644 --- a/400-nominatim.conf +++ b/400-nominatim.conf @@ -1,12 +1,10 @@ Listen 8080 - ServerName localhost - ServerAdmin root@example.com - DocumentRoot /var/www/nominatim + DocumentRoot /var/www/nominatim/website CustomLog /var/log/apache2/access.log combined ErrorLog /var/log/apache2/error.log LogLevel debug - + Options FollowSymLinks MultiViews AllowOverride None Order allow,deny diff --git a/Dockerfile b/Dockerfile index 4e23331..aae44c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM ubuntu:12.04 +FROM ubuntu:14.04 +MAINTAINER Jan Nonnen +# Define the OSM argument, use monaco as default +ARG OSM=http://download.geofabrik.de/europe/monaco-latest.osm.pbf RUN apt-get update @@ -7,85 +10,108 @@ RUN apt-get -y install wget # Note: libgeos++-dev is included here too (the nominatim install page suggests installing it if there is a problem with the 'pear install DB' below - it seems safe to install it anyway) -RUN apt-get -y install build-essential automake -RUN apt-get -y install libxml2-dev -RUN apt-get -y install libgeos-dev -RUN apt-get -y install libpq-dev -RUN apt-get install -y libbz2-dev -RUN apt-get install -y libtool libproj-dev -RUN apt-get install -y libgeos++-dev -RUN apt-get -y install gcc proj-bin libgeos-c1 git osmosis -RUN apt-get -y install php5 php-pear php5-pgsql php5-json +RUN apt-get -y install build-essential gcc git osmosis libxml2-dev libgeos-dev libpq-dev libbz2-dev libtool cmake libproj-dev proj-bin libgeos-c1 libgeos++-dev libexpat1-dev + +# Install Boost (required by osm2pqsql) +RUN apt-get -y install autoconf make g++ libboost-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev lua5.2 liblua5.2-dev + +# Install PHP5 +RUN apt-get -y install php5 php-pear php5-pgsql php5-json php-db + +# From the website "If you plan to install the source from github, the following additional packages are needed:" +# RUN apt-get -y install git autoconf-archive + +# Install Postgres, PostGIS and dependencies +RUN apt-get -y install postgresql postgis postgresql-contrib postgresql-9.3-postgis-2.1 postgresql-server-dev-9.3 + +# Work around for AUFS bug as per https://github.com/docker/docker/issues/783#issuecomment-56013588 +RUN mkdir /etc/ssl/private-copy; mv /etc/ssl/private/* /etc/ssl/private-copy/; rm -r /etc/ssl/private; mv /etc/ssl/private-copy /etc/ssl/private; chmod -R 0700 /etc/ssl/private; chown -R postgres /etc/ssl/private # Some additional packages that may not already be installed # bc is needed in configPostgresql.sh RUN apt-get -y install bc -# Install Postgres, PostGIS and dependencies -RUN apt-get -y install postgresql postgis postgresql-contrib postgresql-9.1-postgis postgresql-server-dev-9.1 - # Install Apache RUN apt-get -y install apache2 -# Install gdal - which is apparently used for US data (more steps need to be added to this script to support that US data) -RUN apt-get -y install python-gdal - # Add Protobuf support RUN apt-get -y install libprotobuf-c0-dev protobuf-c-compiler -RUN apt-get install -y sudo +RUN apt-get -y install sudo + +# RUN pear install DB RUN useradd -m -p password1234 nominatim +RUN mkdir -p /app/git/ +RUN git clone --recursive https://github.com/twain47/Nominatim.git /app/git/ RUN mkdir -p /app/nominatim -RUN git clone --recursive https://github.com/twain47/Nominatim.git /app/nominatim -RUN cd /app/nominatim && git pull && git submodule update --init + WORKDIR /app/nominatim -RUN ./autogen.sh -RUN ./configure + +RUN cmake /app/git/ RUN make # Configure postgresql RUN service postgresql start && \ - pg_dropcluster --stop 9.1 main + pg_dropcluster --stop 9.3 main RUN service postgresql start && \ - pg_createcluster --start -e UTF-8 9.1 main + pg_createcluster --start -e UTF-8 9.3 main -RUN service postgresql start && \ +RUN sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_ctl start -w -D /etc/postgresql/9.3/main/ && \ + cat /var/log/postgresql/postgresql-9.3-main.log && \ sudo -u postgres psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='nominatim'" | grep -q 1 || sudo -u postgres createuser -s nominatim && \ sudo -u postgres psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='www-data'" | grep -q 1 || sudo -u postgres createuser -SDR www-data && \ sudo -u postgres psql postgres -c "DROP DATABASE IF EXISTS nominatim" -RUN wget --output-document=/app/data.pbf http://download.geofabrik.de/north-america-latest.osm.pbf +RUN wget --output-document=/app/data.pbf $OSM +# RUN wget --output-document=/app/data.pbf http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf +# RUN wget --output-document=/app/data.pbf http://download.geofabrik.de/north-america-latest.osm.pbf # RUN wget --output-document=/app/data.pbf http://download.geofabrik.de/north-america/us/delaware-latest.osm.pbf WORKDIR /app/nominatim -RUN ./utils/setup.php --help +ADD local.php /app/nominatim/settings/local.php -RUN service postgresql start && \ - sudo -u nominatim ./utils/setup.php --osm-file /app/data.pbf --all --threads 2 -ADD local.php /app/nominatim/settings/local.php +RUN ./utils/setup.php --help + +RUN chown -R nominatim:nominatim /app/nominatim +RUN sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_ctl start -w -D /etc/postgresql/9.3/main/ && \ + sudo -u nominatim ./utils/setup.php --osm-file /app/data.pbf --all --threads 2 RUN mkdir -p /var/www/nominatim -RUN ls settings/ -RUN cat settings/local.php -RUN ./utils/setup.php --create-website /var/www/nominatim +RUN cp -R /app/nominatim/website /var/www/nominatim/ +RUN cp -R /app/nominatim/settings /var/www/nominatim/ +RUN chown -R nominatim:www-data /var/www/nominatim + + +# Adjust PostgreSQL configuration so that remote connections to the +# database are possible. +RUN echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/9.3/main/pg_hba.conf + +# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf`` +RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf + +# Expose the PostgreSQL port +EXPOSE 5432 RUN apt-get install -y curl ADD 400-nominatim.conf /etc/apache2/sites-available/400-nominatim.conf -ADD httpd.conf /etc/apache2/ RUN service apache2 start && \ a2ensite 400-nominatim.conf && \ /etc/init.d/apache2 reload - +# Expose the HTTP port EXPOSE 8080 + ADD configPostgresql.sh /app/nominatim/configPostgresql.sh WORKDIR /app/nominatim RUN chmod +x ./configPostgresql.sh ADD start.sh /app/nominatim/start.sh RUN chmod +x /app/nominatim/start.sh + +RUN echo "Using OSM URL: "$OSM + CMD /app/nominatim/start.sh diff --git a/README.md b/README.md index a1f941a..de14bff 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# Nominatom Docker +# Nominatim Docker -Run [http://wiki.openstreetmap.org/wiki/Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim) in a docker container. +Run [http://wiki.openstreetmap.org/wiki/Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim) in a docker container. Clones the current master and builds it. This is always the latest version, be cautious as it may be unstable. -# Usage +Uses Ubuntu 14.04 and PostgreSQL 9.3 -``` -docker pull nisaacson/nominatim-docker -``` +# Country +As default it downloads Europe/Monacco (latest) from geofabrik.de during build. This can be changed by setting a build arg. +If a different country should be used, change the wget line in the Dockerfile to pull a different country file. # Building To rebuild the image locally execute @@ -16,6 +16,13 @@ To rebuild the image locally execute docker build -t nominatim . ``` +# Changing the OSM url to download and use a different country + +This example downloads the belize data during compilation: +``` +docker build --build-arg OSM=http://download.geofabrik.de/central-america/belize-latest.osm.pbf -t nominatim . +``` + # Running By default the container exposes port `8080` To run the container execute @@ -23,7 +30,7 @@ By default the container exposes port `8080` To run the container execute ``` # remove any existing containers docker rm -f nominatim_container || echo "nominatim_container not found, skipping removal" -docker run -p 8080:8080 --name nominatim_container --detach nomintatim +docker run -p 8080:8080 --name nominatim_container --detach nominatim ``` Check the logs of the running container @@ -32,6 +39,11 @@ Check the logs of the running container docker logs nominatim_container ``` +Stop the container +``` +docker stop nominatim_container +``` + Connect to the nominatim webserver with curl. If this succeeds, open [http://localhost:8080/](http:/localhost:8080) in a web browser ``` diff --git a/config.sh b/config.sh deleted file mode 100644 index 43d4857..0000000 --- a/config.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Contains credentials -# This is a template file, save as simply .config.sh (amd make executable) and set your own values below. - -# Define the website hostname and e-mail for the VirtualHost -# Several option groups here, comment in / out as necessary -# Localhost -websiteurl=nominatim.localhost -emailcontact=nominatim@localhost -# CycleStreets -#websiteurl=nominatim.cyclestreets.net -#emailcontact=webmasterATcyclestreets.net - -# Define the username for Nominatim to install/run under, so that it can run independent of any individual personal account on the machine -username=nominatim -password= - -# Apache virtual host configuration file name - with .conf extension -nominatimVHfile=400-nominatim.conf - -### SETTINGS ### -# Define either a full planet, or an extract by commenting in the relevant sections - -## Full Planet -# On a machine with 1.2TB disk, 32 GB RAM, Quad processors - it took 10 days to run and used about 700GB. (December 2013) -#planetUrl=http://ftp5.gwdg.de/pub/misc/openstreetmap/planet.openstreetmap.org/pbf/ -#postgresconfigmode=dw -#override_maintenance_work_mem=16GB -# 18GB is recommended for full planet import (arg value is in MB) -#osm2pgsqlcache="--osm2pgsql-cache 18000" - - -## Geofabrik Extract -# If planetUrl is an empty string that tells the install script to configure for Geofabrik extract -planetUrl= -geofabrikUrl=http://download.geofabrik.de/ -postgresconfigmode=oltp -override_maintenance_work_mem= -# Default cache -osm2pgsqlcache= -# Define the location of the .pdf OSM data file -# Several option groups here, comment in / out as necessary -# Andorra (install, without wikipedia data, takes 12 minutes) -osmdatafolder=europe/ -osmdatacountry=andorra -## British Isles -#osmdatafolder=europe/ -#osmdatacountry=british-isles -## Iceland -#osmdatafolder=europe/ -#osmdatacountry=iceland -## Europe -# On a machine with 64GB ram and four processors takes 2.5 days to complete the initial install Oct 2012. -#osmdatafolder= -#osmdatacountry=europe - diff --git a/configPostgresql.sh b/configPostgresql.sh index a7479eb..1abb237 100644 --- a/configPostgresql.sh +++ b/configPostgresql.sh @@ -75,7 +75,7 @@ echo "#\tConfiguring as usage type: $1, Dedicated PostgreSQL server: ${dedicated ################################### # Postgres version -PGver=9.1 +PGver=9.3 # These variables are for Debian...be sure to alter them if your OS is different! PGHOMEDIR=/var/lib/postgresql diff --git a/configPostgresqlDiskWrites.sh b/configPostgresqlDiskWrites.sh index 145b6f9..98cff8e 100644 --- a/configPostgresqlDiskWrites.sh +++ b/configPostgresqlDiskWrites.sh @@ -3,9 +3,9 @@ # It changes the postgresql configuration to write changes to disk. # Need to sync these with configPostgresql.sh -PGver=9.1 +PGver=9.3 CONFIG_FILE=/etc/postgresql/$PGver/main/postgresql.conf -TEMP_FILE=${CONFIG_FILE}.TMP +TEMP_FILE=${CONFIG_FILE}.TMP # After the initial nominatim import these two variables need to be turned back on to avoid database corruption. FSYNC=on @@ -18,7 +18,7 @@ if [ -e $CONFIG_FILE ]; then echo "#\tApplying the following changes:" echo "#\tfsync $FSYNC" echo "#\tfull_page_writes $FULL_PAGE_WRITES" - + sed \ -e "s/[#]*fsync = .*/fsync = $FSYNC/" \ -e "s/[#]*full_page_writes = .*/full_page_writes = $FULL_PAGE_WRITES/" \ @@ -26,7 +26,7 @@ $CONFIG_FILE > $TEMP_FILE # Make the change mv $TEMP_FILE $CONFIG_FILE -fi +fi echo "#\tReload postgres for the changes to come into effect" diff --git a/httpd.conf b/httpd.conf deleted file mode 100644 index 873caeb..0000000 --- a/httpd.conf +++ /dev/null @@ -1 +0,0 @@ -ServerName localhost diff --git a/install.sh b/install.sh deleted file mode 100644 index 289f7f5..0000000 --- a/install.sh +++ /dev/null @@ -1,349 +0,0 @@ -#!/bin/sh -# Script to install Nominatim on Ubuntu -# Tested on 12.04 (View Ubuntu version using 'lsb_release -a') using Postgres 9.1 -# http://wiki.openstreetmap.org/wiki/Nominatim/Installation#Ubuntu.2FDebian -# Synced with: Latest revision as of 18:41, 22 January 2014 - -# !! Marker #idempotent indicates limit of testing for idempotency - it has not yet been possible to make it fully idempotent. - -echo "#\tNominatim installation $(date)" - -# Ensure this script is run as root -if [ "$(id -u)" != "0" ]; then - echo "#\tThis script must be run as root." 1>&2 - exit 1 -fi - -# Bind current directory -nomInstalDir=$(pwd) - -# Bomb out if something goes wrong -set -e - -### CREDENTIALS ### -# Name of the credentials file -configFile=.config.sh - -# Generate your own credentials file by copying from .config.sh.template -if [ ! -e ./${configFile} ]; then - echo "#\tThe config file, ${configFile}, does not exist - copy your own based on the ${configFile}.template file." 1>&2 - exit 1 -fi - -# Load the credentials -. ./${configFile} - -# Check either planet or extract selected -if [ -z "${planetUrl}" -a -z "${geofabrikUrl}" ]; then - # Report and fail - echo "# Configuration error, please specify either a full planet or a Geofabrik extract" - exit 1 -fi - -# Check either planet or extract selected but not both -if [ -n "${planetUrl}" -a -n "${geofabrikUrl}" ]; then - # Report and fail - echo "# Configuration error, please specify either a full planet or a Geofabrik extract, not both" - echo "# Planet: ${planetUrl}" - echo "# Extract: ${geofabrikUrl}" - exit 1 -fi - -# Download -if [ -n "${planetUrl}" ]; then - - # Options for a full planet - osmdatafilename=planet-latest.osm.pbf - osmdatafolder=wholePlanet/ - osmdataurl=${planetUrl}${osmdatafilename} - -else - # Options for a Geofabrik Extract - osmdatafilename=${osmdatacountry}-latest.osm.pbf - osmdataurl=${geofabrikUrl}${osmdatafolder}${osmdatafilename} - osmupdates=${geofabrikUrl}${osmdatafolder}${osmdatacountry}-updates -fi - -# Where the downloaded data is stored -osmdatapath=data/${osmdatafolder}${osmdatafilename} - - -### MAIN PROGRAM ### - -# Logging -# Use an absolute path for the log file to be tolerant of the changing working directory in this script -setupLogFile=$(readlink -e $(dirname $0))/setupLog.txt -touch ${setupLogFile} -chmod a+w ${setupLogFile} -echo "#\tImport and index OSM data in progress, follow log file with:\n#\ttail -f ${setupLogFile}" -echo "#\tNominatim installation $(date)" >> ${setupLogFile} - -# Ensure there is a nominatim user account -if id -u ${username} >/dev/null 2>&1; then - echo "# User ${username} exists already and will be used." -else - echo "# User ${username} does not exist: creating now." - - # Request a password for the Nominatim user account; see http://stackoverflow.com/questions/3980668/how-to-get-a-password-from-a-shell-script-without-echoing - if [ ! ${password} ]; then - stty -echo - printf "Please enter a password that will be used to create the Nominatim user account:" - read password - printf "\n" - printf "Confirm that password:" - read passwordconfirm - printf "\n" - stty echo - if [ $password != $passwordconfirm ]; then - echo "#\tThe passwords did not match" - exit 1 - fi - fi - - # Create the nominatim user - useradd -m -p $password $username - echo "#\tNominatim user ${username} created" >> ${setupLogFile} -fi - -# Prepare the apt index; it may be practically non-existent on a fresh VM -apt-get update > /dev/null - -# Install basic software -apt-get -y install wget >> ${setupLogFile} - - -# Install software -echo "\n#\tInstalling software packages" >> ${setupLogFile} -# Note: libgeos++-dev is included here too (the nominatim install page suggests installing it if there is a problem with the 'pear install DB' below - it seems safe to install it anyway) -apt-get -y install build-essential libxml2-dev libgeos-dev libpq-dev libbz2-dev libtool automake libproj-dev libgeos++-dev >> ${setupLogFile} -apt-get -y install gcc proj-bin libgeos-c1 git osmosis >> ${setupLogFile} -apt-get -y install php5 php-pear php5-pgsql php5-json >> ${setupLogFile} - -# Some additional packages that may not already be installed -# bc is needed in configPostgresql.sh -apt-get -y install bc >> ${setupLogFile} - -# Install Postgres, PostGIS and dependencies -echo "\n#\tInstalling postgres and link to postgis" >> ${setupLogFile} -apt-get -y install postgresql postgis postgresql-contrib postgresql-9.1-postgis postgresql-server-dev-9.1 >> ${setupLogFile} - -# Install Apache -echo "\n#\tInstalling Apache" >> ${setupLogFile} -apt-get -y install apache2 >> ${setupLogFile} - -# Install gdal - which is apparently used for US data (more steps need to be added to this script to support that US data) -echo "\n#\tInstalling gdal" >> ${setupLogFile} -apt-get -y install python-gdal >> ${setupLogFile} - -# Add Protobuf support -echo "\n#\tInstalling protobuf" >> ${setupLogFile} -apt-get -y install libprotobuf-c0-dev protobuf-c-compiler >> ${setupLogFile} - -# Temporarily allow commands to fail without exiting the script -set +e - -# PHP Pear::DB is needed for the runtime website -# There doesn't seem an easy way to avoid this failing if it is already installed. -echo "\n#\tInstalling pear DB" >> ${setupLogFile} -pear install DB >> ${setupLogFile} - -# Bomb out if something goes wrong -set -e - -# Tuning PostgreSQL -echo "\n#\tTuning PostgreSQL" >> ${setupLogFile} -./configPostgresql.sh ${postgresconfigmode} n ${override_maintenance_work_mem} - -# Restart postgres assume the new config -echo "\n#\tRestarting PostgreSQL" >> ${setupLogFile} -/etc/init.d/postgresql restart - -# We will use the Nominatim user's homedir for the installation, so switch to that -eval cd /home/${username} - -# Get Nominatim software -if [ ! -d "/home/${username}/Nominatim/.git" ]; then - # Install - echo "\n#\tInstalling Nominatim software" >> ${setupLogFile} - sudo -u ${username} git clone --recursive https://github.com/twain47/Nominatim.git >> ${setupLogFile} - cd Nominatim -else - # Update - echo "\n#\tUpdating Nominatim software" >> ${setupLogFile} - cd Nominatim - sudo -u ${username} git pull >> ${setupLogFile} - # Some of the schema is created by osm2pgsql which is updated by: - sudo -u ${username} git submodule update --init >> ${setupLogFile} -fi - -# Compile Nominatim software -echo "\n#\tCompiling Nominatim software" >> ${setupLogFile} -sudo -u ${username} ./autogen.sh >> ${setupLogFile} -sudo -u ${username} ./configure >> ${setupLogFile} -sudo -u ${username} make >> ${setupLogFile} - - -# Get Wikipedia data which helps with name importance hinting -echo "\n#\tWikipedia data" >> ${setupLogFile} -# These large files are optional, and if present take a long time to process by ./utils/setup.php later in the script. -# Download them if they are not already present - the available ones date from early 2012. -if test ! -r data/wikipedia_article.sql.bin; then - sudo -u ${username} wget --output-document=data/wikipedia_article.sql.bin http://www.nominatim.org/data/wikipedia_article.sql.bin -fi -if test ! -r data/wikipedia_redirect.sql.bin; then - sudo -u ${username} wget --output-document=data/wikipedia_redirect.sql.bin http://www.nominatim.org/data/wikipedia_redirect.sql.bin -fi - -# http://stackoverflow.com/questions/8546759/how-to-check-if-a-postgres-user-exists -# Creating the importer account in Postgres -echo "\n#\tCreating the importer account" >> ${setupLogFile} -sudo -u postgres psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='${username}'" | grep -q 1 || sudo -u postgres createuser -s $username - -# Create website user in Postgres -echo "\n#\tCreating website user" >> ${setupLogFile} -websiteUser=www-data -sudo -u postgres psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='${websiteUser}'" | grep -q 1 || sudo -u postgres createuser -SDR ${websiteUser} - -# Nominatim module reading permissions -echo "\n#\tNominatim module reading permissions" >> ${setupLogFile} -chmod +x "/home/${username}" -chmod +x "/home/${username}/Nominatim" -chmod +x "/home/${username}/Nominatim/module" - -# Ensure download folder exists -sudo -u ${username} mkdir -p data/${osmdatafolder} - -# Download OSM data if not already present -if test ! -r ${osmdatapath}; then - echo "\n#\tDownload OSM data" >> ${setupLogFile} - sudo -u ${username} wget --output-document=${osmdatapath}.md5 ${osmdataurl}.md5 - sudo -u ${username} wget --output-document=${osmdatapath} ${osmdataurl} -fi - -# Check the md5 matches -if [ "$(md5sum ${osmdatapath} | awk '{print $1;}')" != "$(cat ${osmdatapath}.md5 | awk '{print $1;}')" ]; then - echo "#\tThe md5 checksum for osmdatapath: ${osmdatapath} does not match, stopping." - exit 1 - echo "\n#\tDownloaded OSM data integrity verified by md5 check." >> ${setupLogFile} -fi - - -#idempotent -# Cannot make idempotent safely from here because that would require editing nominatim's setup scripts. -# Remove any pre-existing nominatim database -echo "\n#\tRemove any pre-existing nominatim database" >> ${setupLogFile} -sudo -u postgres psql postgres -c "DROP DATABASE IF EXISTS nominatim" - -# Add local Nominatim settings -localNominatimSettings=/home/${username}/Nominatim/settings/local.php - -cat > ${localNominatimSettings} << EOF -> ${localNominatimSettings} << EOF - // Setting up the update process - @define('CONST_Replication_Url', '${osmupdates}'); - @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 -EOF -fi - -# Change settings file to Nominatim ownership -chown ${username}:${username} ${localNominatimSettings} - -# Import and index main OSM data -eval cd /home/${username}/Nominatim/ -echo "#\tStarting import and index OSM data $(date)" >> ${setupLogFile} -# Experimentally trying with two threads here -sudo -u ${username} ./utils/setup.php ${osm2pgsqlcache} --osm-file /home/${username}/Nominatim/${osmdatapath} --all --threads 2 >> ${setupLogFile} -# Note: if that step gets interrupted for some reason it can be resumed using: -# (Threads argument is optional, it'll default to one less than number of available cpus.) -# If the reported rank is 26 or higher, you can also safely add --index-noanalyse. -# sudo -u ${username} ./utils/setup.php --index --index-noanalyse --create-search-indices --threads 2 -echo "#\tDone Import and index OSM data $(date)" >> ${setupLogFile} - -# Add special phrases -echo "#\tStarting special phrases $(date)" >> ${setupLogFile} -sudo -u ${username} ./utils/specialphrases.php --countries > specialphrases_countries.sql >> ${setupLogFile} -sudo -u ${username} psql -d nominatim -f specialphrases_countries.sql >> ${setupLogFile} -sudo -u ${username} rm -f specialphrases_countries.sql -sudo -u ${username} ./utils/specialphrases.php --wiki-import > specialphrases.sql >> ${setupLogFile} -sudo -u ${username} psql -d nominatim -f specialphrases.sql >> ${setupLogFile} -sudo -u ${username} rm -f specialphrases.sql -echo "#\tDone special phrases $(date)" >> ${setupLogFile} - -# Set up the website for use with Apache -wwwNominatim=/var/www/nominatim -sudo mkdir -pm 755 ${wwwNominatim} -sudo chown ${username} ${wwwNominatim} -sudo -u ${username} ./utils/setup.php --create-website ${wwwNominatim} - -# Write out a robots file to keep search engines out -sudo -u ${username} cat > ${wwwNominatim}/robots.txt <> ${setupLogFile} -cat > /etc/apache2/sites-available/${nominatimVHfile} << EOF - - ServerName ${websiteurl} - ServerAdmin ${emailcontact} - DocumentRoot ${wwwNominatim} - CustomLog \${APACHE_LOG_DIR}/access.log combined - ErrorLog \${APACHE_LOG_DIR}/error.log - LogLevel warn - - Options FollowSymLinks MultiViews - AllowOverride None - Order allow,deny - Allow from all - - AddType text/html .php - -EOF - -# Enable the VirtualHost and restart Apache -a2ensite ${nominatimVHfile} -/etc/init.d/apache2 reload - -echo "#\tNominatim website created $(date)" >> ${setupLogFile} - -# Setting up the update process -rm -f /home/${username}/Nominatim/settings/configuration.txt -sudo -u ${username} ./utils/setup.php --osmosis-init -echo "#\tDone setup $(date)" >> ${setupLogFile} - -# Enabling hierarchical updates -sudo -u ${username} ./utils/setup.php --create-functions --enable-diff-updates -echo "#\tDone enable hierarchical updates $(date)" >> ${setupLogFile} - -# Adust PostgreSQL to do disk writes -echo "\n#\tRetuning PostgreSQL for disk writes" >> ${setupLogFile} -${nomInstalDir}/configPostgresqlDiskWrites.sh - -# Reload postgres assume the new config -echo "\n#\tReloading PostgreSQL" >> ${setupLogFile} -/etc/init.d/postgresql reload - -# Updating Nominatim -# Using two threads for the upadate will help performance, by adding this option: --index-instances 2 -# Going much beyond two threads is not really worth it because the threads interfere with each other quite a bit. -# If your system is live and serving queries, keep an eye on response times at busy times, because too many update threads might interfere there, too. -sudo -u ${username} ./utils/update.php --import-osmosis-all --no-npi - -# Done -echo "#\tNominatim installation completed $(date)" >> ${setupLogFile} - -# End of file diff --git a/local.php b/local.php index a8d8653..07d0121 100644 --- a/local.php +++ b/local.php @@ -1,11 +1,11 @@ -