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

Upgrade to Nominatim 4.4 #541

Merged
merged 8 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
strategy:
matrix:
nominatim:
- version: "4.2"
update_command: docker exec -i nominatim sudo -u nominatim nominatim replication --project-dir /nominatim --once
postgres_version: 14
user_agent: mediagis/nominatim-docker-action:4.2
- version: "4.3"
update_command: docker exec -i nominatim sudo -u nominatim nominatim replication --project-dir /nominatim --once
postgres_version: 14
user_agent: mediagis/nominatim-docker-action:4.3
- version: "4.4"
update_command: docker exec -i nominatim sudo -u nominatim nominatim replication --project-dir /nominatim --once
postgres_version: 14
user_agent: mediagis/nominatim-docker-action:4.4

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
-p 8004:8080 \
--name nominatim \
nominatim &
sleep 180
sleep 120
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
echo "check replication log for Update completed. Count:"
docker exec -i nominatim grep -c 'Update completed.' /var/log/replication.log
Expand All @@ -139,7 +139,7 @@ jobs:
-p 8004:8080 \
--name nominatim \
nominatim &
sleep 180
sleep 120
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
echo "check replication log for Update completed. Count:"
docker exec -i nominatim grep -c 'Update completed.' /var/log/replication.log
Expand Down
156 changes: 156 additions & 0 deletions 4.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
ARG NOMINATIM_VERSION=4.4.0
ARG USER_AGENT=mediagis/nominatim-docker:${NOMINATIM_VERSION}

FROM ubuntu:jammy AS build

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

WORKDIR /app

RUN true \
# 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 \
g++ \
cmake \
libpq-dev \
zlib1g-dev \
libbz2-dev \
libproj-dev \
libexpat1-dev \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
liblua5.4-dev \
nlohmann-json3-dev \
# PostgreSQL.
postgresql-contrib \
postgresql-server-dev-14 \
postgresql-14-postgis-3 \
postgresql-14-postgis-3-scripts \
# PHP and Apache 2.
php \
php-intl \
php-pgsql \
php-cgi \
apache2 \
libapache2-mod-php \
# Python 3.
python3-dev \
python3-pip \
python3-tidylib \
python3-psycopg2 \
python3-setuptools \
python3-dotenv \
python3-psutil \
python3-jinja2 \
python3-sqlalchemy \
python3-asyncpg \
python3-datrie \
python3-icu \
python3-argparse-manpage \
# Misc.
git \
curl \
sudo \
sshpass \
openssh-client


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

# Osmium install to run continuous updates.
RUN pip3 install osmium

# Nominatim install.
ARG NOMINATIM_VERSION
ARG USER_AGENT

RUN true \
&& curl -A $USER_AGENT https://nominatim.org/release/Nominatim-$NOMINATIM_VERSION.tar.bz2 -o nominatim.tar.bz2 \
&& tar xf nominatim.tar.bz2 \
&& mkdir build \
&& cd build \
&& cmake ../Nominatim-$NOMINATIM_VERSION \
&& make -j`nproc` \
&& make install

RUN true \
# Remove development and unused packages.
&& apt-get -y remove --purge \
cpp-9 \
gcc-9* \
g++ \
git \
make \
cmake* \
llvm-10* \
libc6-dev \
linux-libc-dev \
libclang-*-dev \
build-essential \
liblua*-dev \
postgresql-server-dev-14 \
nlohmann-json3-dev \
&& apt-get clean \
# Clear temporary files and directories.
&& rm -rf \
/tmp/* \
/var/tmp/* \
/root/.cache \
/app/src/.git \
/var/lib/apt/lists/* \
# Remove nominatim source and build directories
&& rm /app/*.tar.bz2 \
&& rm -rf /app/build \
&& rm -rf /app/Nominatim-$NOMINATIM_VERSION

# Apache configuration
COPY conf.d/apache.conf /etc/apache2/sites-enabled/000-default.conf

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

COPY config.sh /app/config.sh
COPY init.sh /app/init.sh
COPY start.sh /app/start.sh
COPY startapache.sh /app/startapache.sh
COPY startpostgres.sh /app/startpostgres.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
Loading