From 719ba926789aa138ce5bd1ec675867df11e5e78e Mon Sep 17 00:00:00 2001 From: Loris Leitner Date: Tue, 24 Dec 2024 03:56:33 +0100 Subject: [PATCH] Add ENABLE_WARMUP parameter --- 4.5/README.md | 1 + 4.5/example.md | 3 +++ 4.5/start.sh | 27 +++++++++++++++++---------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/4.5/README.md b/4.5/README.md index 12d436e..989496c 100644 --- a/4.5/README.md +++ b/4.5/README.md @@ -63,6 +63,7 @@ Other places at Geofabrik follow the pattern `https://download.geofabrik.de/$CON - `IMPORT_TIGER_ADDRESSES`: Whether to download and import the Tiger address data (`true`) or path to a preprocessed Tiger address set in the container. (default: `false`) - `THREADS`: How many threads should be used to import (default: number of processing units available to the current process via `nproc`) - `NOMINATIM_PASSWORD`: The password to connect to the database with (default: `qaIACxO6wMR3`) +- `ENABLE_WARMUP`: Enable or disable database warmup. Skipping warmup allows the container to answer requests immediately but possibly slower. (default: true) The following run parameters are available for configuration: diff --git a/4.5/example.md b/4.5/example.md index 0a70a25..566d65d 100644 --- a/4.5/example.md +++ b/4.5/example.md @@ -62,6 +62,9 @@ docker run -it \ #Sets the used threads at the import (default 16) -e THREADS=10 \ + #Enable or disable database warmup. Skipping warmup allows the container to answer requests immediately but possibly slower. (default: true) + -e ENABLE_WARMUP=true/false + #Sets the Docker tmpfs. Highly recommended for bigger imports like Europe. At least 1GB - ideally half of the available RAM. --shm-size=60g \ diff --git a/4.5/start.sh b/4.5/start.sh index 0634939..7462cfe 100755 --- a/4.5/start.sh +++ b/4.5/start.sh @@ -67,18 +67,25 @@ fi tail -Fv /var/log/postgresql/postgresql-16-main.log & tailpid=${!} -export NOMINATIM_QUERY_TIMEOUT=600 -export NOMINATIM_REQUEST_TIMEOUT=3600 -if [ "$REVERSE_ONLY" = "true" ]; then - echo "Warm database caches for reverse queries" - sudo -H -E -u nominatim nominatim admin --warm --reverse > /dev/null +if [ "$ENABLE_WARMUP" = "true" ] || [ -z "$ENABLE_WARMUP" ]; then + export NOMINATIM_QUERY_TIMEOUT=600 + export NOMINATIM_REQUEST_TIMEOUT=3600 + + if [ "$REVERSE_ONLY" = "true" ]; then + echo "Warm database caches for reverse queries" + sudo -H -E -u nominatim nominatim admin --warm --reverse > /dev/null + else + echo "Warm database caches for search and reverse queries" + sudo -H -E -u nominatim nominatim admin --warm > /dev/null + fi + + export NOMINATIM_QUERY_TIMEOUT=10 + export NOMINATIM_REQUEST_TIMEOUT=60 + + echo "Warming finished" else - echo "Warm database caches for search and reverse queries" - sudo -H -E -u nominatim nominatim admin --warm > /dev/null + echo "skipping database warmup" fi -export NOMINATIM_QUERY_TIMEOUT=10 -export NOMINATIM_REQUEST_TIMEOUT=60 -echo "Warming finished" echo "--> Nominatim is ready to accept requests"