Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nominatim 4.5 #587

Merged
merged 26 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
86f1d34
Update build process for Nominatim 4.5
leonardehrenfried Nov 11, 2024
3325901
Replace apache with gunicorn
leonardehrenfried Nov 11, 2024
c805c1c
Remove more apache stuff
leonardehrenfried Nov 11, 2024
582ea9e
Run gunicorn under correct user
leonardehrenfried Nov 11, 2024
bf2b3e7
Update URL for Rutland
leonardehrenfried Nov 11, 2024
9fcfb15
Remove apache.conf
leonardehrenfried Nov 11, 2024
217effd
Update docs, remove build-essential
leonardehrenfried Nov 11, 2024
209b8b0
Remove apache config from Dockerfile
leonardehrenfried Nov 11, 2024
e84cd34
Use cache again
leonardehrenfried Nov 11, 2024
c4de1f0
Update docs
leonardehrenfried Nov 11, 2024
ac40703
Use correct versions
leonardehrenfried Nov 11, 2024
1caf485
Update docs
leonardehrenfried Nov 11, 2024
3fd19fb
Shutdown cleanly
leonardehrenfried Nov 12, 2024
b024960
Update version in docs, mention n7m
leonardehrenfried Nov 12, 2024
f937445
Change gunicorn killing
leonardehrenfried Nov 12, 2024
17676ea
Update execution
leonardehrenfried Nov 12, 2024
c7e46ed
Try running in daemon mode
leonardehrenfried Nov 12, 2024
deb09cf
Don't buffer output
leonardehrenfried Nov 12, 2024
81261b5
Enable stdio inheritance
leonardehrenfried Nov 12, 2024
c0fbd54
Don't assert that a reverse-only returns a 404
leonardehrenfried Nov 12, 2024
6a247d4
Remove nominatim container during CI
leonardehrenfried Nov 12, 2024
17ed3da
Properly shutdown background processes
leonardehrenfried Nov 12, 2024
c04f181
Sleep after stopping container
leonardehrenfried Nov 12, 2024
37a9cd9
Lower sleep
leonardehrenfried Nov 13, 2024
70b16f0
Remove startpostgres.sh
leonardehrenfried Nov 13, 2024
d8abeb7
Rephrase README
leonardehrenfried Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
strategy:
matrix:
nominatim:
- version: "4.3"
- version: "4.4"

- version: "4.5"

runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -43,9 +43,9 @@ jobs:
strategy:
matrix:
nominatim:
- version: "4.3"
- version: "4.4"

- version: "4.5"

test_scenario:
- name: Import with PBF_URL and update
commands: |-
Expand Down Expand Up @@ -89,6 +89,8 @@ jobs:

# Stop container
docker stop nominatim
# the container needs a few seconds to shutdown cleanly apparently
sleep 15

# import to bind mount is done previously
docker run -i --rm \
Expand Down Expand Up @@ -196,7 +198,7 @@ jobs:
- name: GB postcode import
commands: |-
docker run -i --rm \
-e PBF_URL=https://download.geofabrik.de/europe/great-britain/england/rutland-latest.osm.pbf \
-e PBF_URL=https://download.geofabrik.de/europe/united-kingdom/england/rutland-latest.osm.pbf \
-e IMPORT_GB_POSTCODES="true" \
-p 8010:8080 \
nominatim &
Expand All @@ -213,7 +215,7 @@ jobs:
-p 8011:8080 \
nominatim &

./assert-reverse-only "http://localhost:8011/search.php?q=avenue%20pasteur"
#./assert-reverse-only "http://localhost:8011/search.php?q=avenue%20pasteur"
./assert-non-empty-json "http://localhost:8011/reverse.php?lat=43.734&lon=7.42&format=jsonv2"

- name: Check for clean shutdown
Expand Down Expand Up @@ -257,9 +259,9 @@ jobs:
strategy:
matrix:
nominatim:
- version: "4.3"
- version: "4.4"

- version: "4.5"

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
108 changes: 108 additions & 0 deletions 4.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
ARG NOMINATIM_VERSION=4.5.0
ARG USER_AGENT=mediagis/nominatim-docker:${NOMINATIM_VERSION}

FROM ubuntu:24.04 AS build

ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8

WORKDIR /app

# Inspired by https://github.com/reproducible-containers/buildkit-cache-dance?tab=readme-ov-file#apt-get-github-actions
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
# Keep downloaded APT packages in the docker build cache
rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
# Do not start daemons after installation.
echo '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d \
&& chmod +x /usr/sbin/policy-rc.d \
# Install all required packages.
&& apt-get -y update -qq \
&& apt-get -y install \
locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 \
&& apt-get -y install \
-o APT::Install-Recommends="false" \
-o APT::Install-Suggests="false" \
# Build tools from sources. \
build-essential \
osm2pgsql \
pkg-config \
libicu-dev \
python3-dev \
python3-pip \
# PostgreSQL.
postgresql-contrib \
postgresql-server-dev-16 \
postgresql-16-postgis-3 \
postgresql-16-postgis-3-scripts \
# Misc.
curl \
sudo \
sshpass \
openssh-client


# Configure postgres.
RUN true \
&& echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/16/main/pg_hba.conf \
&& echo "listen_addresses='*'" >> /etc/postgresql/16/main/postgresql.conf

ARG NOMINATIM_VERSION
ARG USER_AGENT

# Nominatim install.
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked pip install --break-system-packages \
nominatim-db==$NOMINATIM_VERSION \
osmium \
psycopg[binary] \
falcon \
uvicorn \
gunicorn \
nominatim-api


# remove build-only packages
RUN true \
# Remove development and unused packages.
&& apt-get -y remove --purge --auto-remove \
build-essential \
postgresql-server-dev-16 \
# Clear temporary files and directories.
&& rm -rf \
/tmp/* \
/var/tmp/* \
&& pip cache purge

# Postgres config overrides to improve import performance (but reduce crash recovery safety)
COPY conf.d/postgres-import.conf /etc/postgresql/16/main/conf.d/postgres-import.conf.disabled
COPY conf.d/postgres-tuning.conf /etc/postgresql/16/main/conf.d/

COPY config.sh /app/config.sh
COPY init.sh /app/init.sh
COPY start.sh /app/start.sh

# Collapse image to single layer.
FROM scratch

COPY --from=build / /

# Please override this
ENV NOMINATIM_PASSWORD=qaIACxO6wMR3

ENV PROJECT_DIR=/nominatim

ARG USER_AGENT
ENV USER_AGENT=${USER_AGENT}

WORKDIR /app

EXPOSE 5432
EXPOSE 8080

COPY conf.d/env $PROJECT_DIR/.env

CMD ["/app/start.sh"]
Loading