This image is a self-contained Nominatim server comprised of alpine, nginx, Nominatim, php-fpm, postgresql, & supervisord.
docker build -t claflico/alpine-nominatim:<version> .
3.5.0-0
(Dockerfile)
- Launch a container with mounted volumes (/opt/nominatim/data & /var/lib/postgresql/data) and environment variables
NOMINATIM_SETUP_ENABLE=true
andNOMINATIM_PBF_(PLANET|CONTINENT|_ENABLE=true
docker run -d --shm-size=1g -p 80:80 -p 443:443 -v $(pwd)/nominatim-data:/opt/nominatim/data -v $(pwd)/postgres-data:/var/lib/postgresql/data -e NOMINATIM_SETUP_ENABLE=true -e NOMINATIM_PBF_NORTH_AMERICA_ENABLE=true claflico/alpine-nominatim
- Wait for initial download & import of PBF file (this can take more than a day depending upon PBF file). Nginx will NOT be running during this this time.
- Shutdown container and relaunch without NOMINATIM_SETUP_ENABLE. The
NOMINATIM_PBF_(PLANET|CONTINENT|_ENABLE=true
env variable(s) must still be present for automatic PBF updates to work.
docker run -d --shm-size=1g -p 80:80 -p 443:443 -v $(pwd)/nominatim-data:/opt/nominatim/data -v $(pwd)/postgres-data:/var/lib/postgresql/data -e NOMINATIM_PBF_NORTH_AMERICA_ENABLE=true claflico/alpine-nominatim
The image runs with default or recommended configurations but can be highly customized through env variables.
NGINX_HTTP_PORT="80" |
http port |
NGINX_HTTPS_ENABLE="false" |
"true" enables http and https listeners. "only" enables https listener and redirect http to https. |
NGINX_HTTPS_PORT="443" |
https port |
NGINX_KEEPALIVE_TIMEOUT="65" |
The number of seconds the server will wait before closing a keep-alive connection. |
NGINX_SENDFILE="on" |
Eliminates the step of copying the data into the buffer and enables direct copying data from one file descriptor to another |
NGINX_SSL_CIPHERS="HIGH:!aNULL:!MD5" |
The enabled ciphers specified in the format understood by the OpenSSL library |
NGINX_SSL_DIR="/etc/nginx/ssl" |
Directory to .key and .crt files |
NGINX_SSL_CRT_FILE="${NGINX_SSL_DIR}"/nominatim.crt" |
Default crt file. |
NGINX_SSL_KEY_FILE="${NGINX_SSL_DIR}"/nominatim.key" |
Default key file. |
NGINX_SSL_PROTOCOLS="TLSv1 TLSv1.1 TLSv1.2" |
Enables the specified protocols. |
NGINX_WORKER_CONNECTIONS="1024" |
The maximum number of connections that each worker process can handle simultaneously. |
NGINX_WORKER_PROCESSES=${CPU_COUNT} |
The number of worker processes. Defaults to CPU count. |
Added SSL configuration. Set NGINX_HTTPS_ENABLE="< true || only >"
to enable it.
Self-signed SSL certificates are generated by default in /etc/nginx/ssl
.
You need to provide nominatim.key
AND nominatim.crt
files in that directory or override NGINX_SSL_CRT_FILE & NGINX_SSL_KEY_FILE env variables to use a CA-signed certificate.
NOMINATIM_BUILD_DIR=${NOMINATIM_HOME}"/build" |
|
NOMINATIM_DATA_DIR=${NOMINATIM_HOME}"/data" |
|
NOMINATIM_DATA_GB_POSTCODE_ENABLE="false" |
Enable/disable download and install of GB postcode data. |
NOMINATIM_DATA_GB_POSTCODE_URL="https://www.nominatim.org/data/gb_postcode_data.sql.gz" |
Url to download GB postcode data. |
NOMINATIM_DATA_US_POSTCODE_ENABLE="false" |
Enable/disable download and install of US postcode data. |
NOMINATIM_DATA_US_POSTCODE_URL="https://www.nominatim.org/data/us_postcode_data.sql.gz" |
Url to download US postcode data. |
NOMINATIM_DATA_WIKIPEDIA_ARTICLE_ENABLE="false" |
Enable/disable download and install of wikipedia article data. |
NOMINATIM_DATA_WIKIPEDIA_ARTICLE_URL="https://www.nominatim.org/data/wikipedia_article.sql.bin" |
Url to download wikipedia article data. |
NOMINATIM_DATA_WIKIPEDIA_REDIRECT_ENABLE="false" |
Enable/disable download and install of wikipedia redirect data. |
NOMINATIM_DATA_WIKIPEDIA_REDIRECT_URL="https://www.nominatim.org/data/wikipedia_redirect.sql.bin" |
Url to download wikipedia redirect data. |
NOMINATIM_IMPORT_STYLE="import-full" |
Specify data import style import-full|import-address|import-street|import-admin Filtering Imported Data |
NOMINATIM_OSM2PGSQL_CACHE="2000" |
Maximum cache memory in megabytes available to osm2pgsql. |
NOMINATIM_PBF_DIR=${NOMINATIM_DATA_DIR}"/pbf" |
|
NOMINATIM_PBF_PLANET_ENABLE="false" |
Enable/disable download and install of planet PFB file. Enabling planet and continent variables will result in an error. |
NOMINATIM_PBF_PLANET_URL="https://ftp.osuosl.org/pub/openstreetmap/pbf/planet-latest.osm.pbf" |
Url to download planet PFB file. |
NOMINATIM_PBF_AFRICA_ENABLE="false" |
Enable/disable download and install of Africa PFB file. |
NOMINATIM_PBF_AFRICA_REGION="" |
Comma separated list of Africa regions to download and import. Ex: algeria,benin,sao-tome-and-principe,equatorial-guinea |
NOMINATIM_PBF_AFRICA_REGION_URL="https://download.geofabrik.de/africa" |
Base url to download Africa region PFB files. |
NOMINATIM_PBF_AFRICA_URL="https://download.geofabrik.de/africa-latest.osm.pbf" |
Url to download Africa PFB file. |
NOMINATIM_PBF_ANTARCTICA_ENABLE="false" |
Enable/disable download and install of Antartica PFB file. |
NOMINATIM_PBF_ANTARCTICA_URL="https://download.geofabrik.de/antarctica-latest.osm.pbf" |
Url to download Antartica PFB file. |
NOMINATIM_PBF_ASIA_ENABLE="false" |
Enable/disable download and install of Asia PFB file. |
NOMINATIM_PBF_ASIA_REGION="" |
Comma separated list of Asia regions to download and import. Ex: armenia,china,japan |
NOMINATIM_PBF_ASIA_REGION_URL="https://download.geofabrik.de/asia" |
Base url to download Asia region PFB files. |
NOMINATIM_PBF_ASIA_URL="https://download.geofabrik.de/asia-latest.osm.pbf" |
Url to download Asia PFB file. |
NOMINATIM_PBF_AUSTRALIA_OCEANIA_ENABLE="false" |
Enable/disable download and install of Australia-Oceania PFB file. |
NOMINATIM_PBF_AUSTRALIA_OCEANIA_REGION="" |
Comma separated list of Australia-Oceania regions to download and import. Ex: australia,palau |
NOMINATIM_PBF_AUSTRALIA_OCEANIA_REGION_URL="https://download.geofabrik.de/australia-oceania" |
Base url to download Australia-Oceania region PFB files. |
NOMINATIM_PBF_AUSTRALIA_OCEANIA_URL="https://download.geofabrik.de/australia-oceania-latest.osm.pbf" |
Url to download Australia-Oceania PFB file. |
NOMINATIM_PBF_CENTRAL_AMERICA_ENABLE="false" |
Enable/disable download and install of Central America PFB file. |
NOMINATIM_PBF_CENTRAL_AMERICA_REGION="" |
Comma separated list of Central America regions to download and import. Ex: cuba,jamaica |
NOMINATIM_PBF_CENTRAL_AMERICA_REGION_URL="https://download.geofabrik.de/central-america" |
Base url to download Central America region PFB files. |
NOMINATIM_PBF_CENTRAL_AMERICA_URL="https://download.geofabrik.de/central-america-latest.osm.pbf" |
Url to download Central America PFB file. |
NOMINATIM_PBF_EUROPE_ENABLE="false" |
Enable/disable download and install of Europe PFB file. |
NOMINATIM_PBF_EUROPE_REGION="" |
Comma separated list of Europe regions to download and import. Ex: great-britain/england/bedfordshire,italy/isole |
NOMINATIM_PBF_EUROPE_REGION_URL="https://download.geofabrik.de/europe" |
Base url to download Europe region PFB files. |
NOMINATIM_PBF_EUROPE_URL="https://download.geofabrik.de/europe-latest.osm.pbf" |
Url to download Europe PFB file. |
NOMINATIM_PBF_NORTH_AMERICA_ENABLE="false" |
Enable/disable download and install of North America PFB file. |
NOMINATIM_PBF_NORTH_AMERICA_REGION="" |
Comma separated list of North America regions to download and import. Ex: canada,mexico |
NOMINATIM_PBF_NORTH_AMERICA_REGION_URL="https://download.geofabrik.de/north-america" |
Base url to download North America region PFB files. |
NOMINATIM_PBF_NORTH_AMERICA_URL="https://download.geofabrik.de/north-america-latest.osm.pbf" |
Url to download North America PFB file. |
NOMINATIM_PBF_SOUTH_AMERICA_ENABLE="false" |
Enable/disable download and install of South America PFB file. |
NOMINATIM_PBF_SOUTH_AMERICA_REGION="" |
Comma separated list of South America regions to download and import. Ex: argentina,peru |
NOMINATIM_PBF_SOUTH_AMERICA_REGION_URL="https://download.geofabrik.de/south-america" |
Base url to download South America region PFB files. |
NOMINATIM_PBF_SOUTH_AMERICA_URL="https://download.geofabrik.de/south-america-latest.osm.pbf" |
Url to download South America PFB file. |
NOMINATIM_PBF_UPDATE_ENABLE="true" |
Enable/disable automatic updates of imported PFB files. |
NOMINATIM_PBF_UPDATE_MAX_INTERVAL="0" |
|
NOMINATIM_PBF_UPDATE_OPTS="" |
Optional PBF update parameters. Ex: --verbose |
NOMINATIM_PBF_UPDATE_SCHEDULE="daily" |
Schedule of automatic updates daily|weekly|monthly |
NOMINATIM_PBF_UPDATE_URL="https://download.geofabrik.de" |
Base url to download updates of imported PBF files. |
NOMINATIM_PBF_VERIFY_MD5="true" |
Enable/disable md5 erification of downloaded PFB files. |
NOMINATIM_REVERSE_ONLY_ENABLE="false" |
Enable/disable creating database without search indexes for reverse lookups. |
NOMINATIM_SETUP_ENABLE="false" |
Enable/disable setup of Nominatim database. WARNING: drops database on container start when enabled. |
NOMINATIM_SETUP_OPTS="" |
Optional Nominatim setup parameters. Ex: --verbose |
NOMINATIM_SYSTEM_UID="1000" |
Uid/Gid of user/group created for Nominatim system user |
NOMINATIM_SYSTEM_USER="nominatim" |
Username of the Nominatim system user |
NOMINATIM_THREADS=${CPU_COUNT}} |
Number of cpu threads used during Nominatim setup. |
NOMINATIM_WEBSITE_BASEURL="/" |
PHPFPM_CATCH_WORKERS_OUTPUT="yes" |
Redirect worker stdout and stderr into main error log. |
PHPFPM_CLEAR_ENV="no" |
Prevents arbitrary environment variables from reaching FPM worker processes by clearing the environment in workers before env vars are added. |
PHPFPM_DECORATE_WORKERS_OUTPUT="no |
Enable the output decoration for workers output when PHPFPM_CATCH_WORKERS_OUTPUT is enabled. |
PHPFPM_LISTEN="127.0.0.1:9000" |
The address on which to accept FastCGI requests. |
PHPFPM_MAX_CHILDREN="100" |
Number of child processes to create when PHPFPM_PROCESS_MANAGER="static" and max number of child processes to create when PHPFPM_PROCESS_MANAGER="dynamic" . |
PHPFPM_MAX_REQUESTS="1000" |
The number of requests each child process should execute before respawning. |
PHPFPM_PING_PATH="/fpm-ping" |
The ping URI to call the monitoring page of FPM. Also used in nginx configuration. |
PHPFPM_PING_STATUS_ALLOW="127.0.0.1" |
Default crt file. |
PHPFPM_PROCESS_IDLE_TIMEOUT="10s" |
The number of seconds after which an idle process will be killed. Used only when PHPFPM_PROCESS_MANAGER="ondemand" . |
PHPFPM_PROCESS_MANAGER="ondemand" |
Choose how the process manager will control the number of child processes. Possible values: static|ondemand|dynamic |
PHPFPM_STATUS_PATH="/fpm-status" |
The URI to view the FPM status page. Also used in nginx configuration. |
POSTGRES_AUTOVACUUM_WORK_MEM="2GB" |
Nominatim install docs suggests 2GB |
POSTGRES_CHECKPOINT_COMPLETION_TARGET="0.9" |
Nominatim install docs suggests 0.9, postgresql suggests maximum of 0.9 |
POSTGRES_CHECKPOINT_TIMEOUT="10min" |
Nominatim install docs suggests 10min |
POSTGRES_EFFECTIVE_CACHE_SIZE="8GB" |
Nominatim install docs suggests 24GB, postgresql suggests 50% of total memory |
POSTGRES_MAINTENANCE_WORK_MEM="10GB" |
Nominatim install docs suggests 10GB, postgresql suggests 2X or more than POSTGRES_WORK_MEM |
POSTGRES_MAX_WAL_SIZE="1GB" |
Nominatim install docs suggests 1GB |
POSTGRES_SHARED_BUFFERS="2GB" |
Nominatim install docs suggests 2GB, postgresql suggests 25% of total memory |
POSTGRES_SYNCHRONOUS_COMMIT="off" |
Nominatim install docs suggests off |
POSTGRES_WORK_MEM="50MB" |
Nominatim install docs suggests 50MB |
- Depending upon the size of import file you might get the following postgresql error during import: "could not resize shared memory segment". You can resolve this by adding
--shm-size=1g
to your run command or adding a tempfs volume in your docker-compose.yml file. See example in repo.
- Get connectivity to external postgresql database server working.
- Add Planet PDF update capability.
- Resolve Nominatim Flatnode_File issue.
- Verify scheduled updates actually run.