Skip to content

Commit

Permalink
Add ENABLE_WARMUP parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleitner committed Dec 24, 2024
1 parent b1ca923 commit 719ba92
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions 4.5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
3 changes: 3 additions & 0 deletions 4.5/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 \

Expand Down
27 changes: 17 additions & 10 deletions 4.5/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 719ba92

Please sign in to comment.