Skip to content

Commit bae0f91

Browse files
author
Ruben L. Mendoza
authored
Merge pull request #245 from developmentseed/new_version/nominatim
Nominatim 4.0
2 parents 1985880 + e7c0092 commit bae0f91

20 files changed

+169
-578
lines changed

chartpress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ charts:
3333
# tiler-visor:
3434
# valuesPath: tilerVisor.image
3535
nominatim:
36-
valuesPath: nominatim.image
36+
valuesPath: nominatimApi.image
3737
overpass-api:
3838
valuesPath: overpassApi.image
3939
taginfo:

compose/nominatim.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,15 @@ services:
33
#####################################################
44
## Nominatim DB-API section
55
#####################################################
6-
nominatim-db:
7-
image: nominatim-db:v1
8-
build:
9-
context: ../images/nominatim
10-
dockerfile: Dockerfile
11-
ports:
12-
- '5434:5432'
13-
volumes:
14-
- ../data/nominatim-db-data:/var/lib/postgresql/data
15-
command: >
16-
/bin/bash -c "
17-
sh /app/start.sh
18-
"
19-
env_file:
20-
- ../envs/.env.nominatim
216
nominatim-api:
227
image: nominatim-api:v1
238
build:
249
context: ../images/nominatim
2510
dockerfile: Dockerfile
2611
ports:
27-
- '7070:8080'
28-
entrypoint: sh /app/startapache.sh
12+
- '8080:8080'
13+
- '5432:5432'
14+
volumes:
15+
- ../data/nominatim-data:/var/lib/postgresql/12/main
2916
env_file:
30-
- ../envs/.env.nominatim
17+
- ../envs/.env.nominatim

envs/.env.nominatim.example

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
#######################################
22
# Environment variables for nominatim settings
33
#######################################
4-
##### DB
5-
PG_HOST=nominatim-db
6-
PG_PORT=5432
7-
PG_USER=nominatim
8-
PG_PASSWORD=1234
9-
PG_DATABASE=nominatim
10-
PGDATA=/var/lib/postgresql/data
11-
### API
12-
OSM_URL_FILE=http://download.geofabrik.de/europe/monaco-latest.osm.bz2
13-
THREADS=4
4+
PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf
145
REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates
15-
REPLICATION_MAXINTERVAL=86500
16-
REPLICATION_UPDATE_INTERVAL=86500
6+
REPLICATION_UPDATE_INTERVAL=86400
177
REPLICATION_RECHECK_INTERVAL=900
18-
OSMSEED_WEB_API_DOMAIN=localhost
19-
OSMSEED_OVERPASS_API_DOMAIN=localhost.overpass
8+
FREEZE=false
9+
IMPORT_WIKIPEDIA=false
10+
IMPORT_US_POSTCODES=false
11+
IMPORT_GB_POSTCODES=false
12+
IMPORT_TIGER_ADDRESSES=false
13+
THREADS=4
14+
NOMINATIM_PASSWORD=abcd1234
15+
PGDATA=/var/lib/postgresql/12/main

images/nominatim/Dockerfile

Lines changed: 2 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,2 @@
1-
FROM ubuntu:focal AS build
2-
3-
ENV DEBIAN_FRONTEND noninteractive
4-
ENV LANG C.UTF-8
5-
6-
WORKDIR /app
7-
8-
RUN true \
9-
# Do not start daemons after installation.
10-
&& echo '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d \
11-
&& chmod +x /usr/sbin/policy-rc.d \
12-
# Install all required packages.
13-
&& apt-get -y update -qq \
14-
&& apt-get -y install \
15-
locales \
16-
&& locale-gen en_US.UTF-8 \
17-
&& update-locale LANG=en_US.UTF-8 \
18-
&& apt-get -y install \
19-
-o APT::Install-Recommends="false" \
20-
-o APT::Install-Suggests="false" \
21-
# Build tools from sources.
22-
build-essential \
23-
g++ \
24-
cmake \
25-
libpq-dev \
26-
zlib1g-dev \
27-
libbz2-dev \
28-
libproj-dev \
29-
libexpat1-dev \
30-
libboost-dev \
31-
libboost-system-dev \
32-
libboost-filesystem-dev \
33-
# PostgreSQL.
34-
postgresql-contrib \
35-
postgresql-server-dev-12 \
36-
postgresql-12-postgis-3 \
37-
postgresql-12-postgis-3-scripts \
38-
# PHP and Apache 2.
39-
php \
40-
php-intl \
41-
php-pgsql \
42-
apache2 \
43-
libapache2-mod-php \
44-
# Python 3.
45-
python3-dev \
46-
python3-pip \
47-
python3-tidylib \
48-
python3-psycopg2 \
49-
python3-setuptools \
50-
# Misc.
51-
git \
52-
curl \
53-
wget \
54-
sudo
55-
56-
# Configure postgres.
57-
RUN true \
58-
&& echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/12/main/pg_hba.conf \
59-
&& echo "listen_addresses='*'" >> /etc/postgresql/12/main/postgresql.conf
60-
61-
# Osmium install to run continuous updates.
62-
RUN pip3 install osmium
63-
64-
# Nominatim install.
65-
ENV NOMINATIM_VERSION v3.6.0
66-
67-
RUN true \
68-
&& git clone \
69-
--config advice.detachedHead=false \
70-
--single-branch \
71-
--branch $NOMINATIM_VERSION \
72-
--depth 1 \
73-
--recursive \
74-
https://github.com/openstreetmap/Nominatim.git \
75-
src \
76-
&& cd src \
77-
&& mkdir build \
78-
&& cd build \
79-
&& cmake .. \
80-
&& make -j`nproc` \
81-
&& ./utils/setup.php --setup-website \
82-
&& chmod o=rwx .
83-
84-
# Apache configure.
85-
# COPY local.php /app/src/build/settings/local.php
86-
COPY nominatim.conf /etc/apache2/sites-enabled/000-default.conf
87-
88-
# Load initial data.
89-
ARG with_postcodes_gb
90-
ARG with_postcodes_us
91-
92-
RUN if [ "$with_postcodes_gb" = "" ]; then \
93-
echo "Skipping optional GB postcode file"; \
94-
else \
95-
echo "Downloading optional GB postcode file"; \
96-
curl http://www.nominatim.org/data/gb_postcode_data.sql.gz > /app/src/data/gb_postcode_data.sql.gz; \
97-
fi;
98-
99-
RUN if [ "$with_postcodes_us" = "" ]; then \
100-
echo "Skipping optional US postcode file"; \
101-
else \
102-
echo "Downloading optional US postcode file"; \
103-
curl http://www.nominatim.org/data/us_postcode_data.sql.gz > /app/src/data/us_postcode_data.sql.gz; \
104-
fi;
105-
106-
RUN curl http://www.nominatim.org/data/country_grid.sql.gz > /app/src/data/country_osm_grid.sql.gz
107-
108-
RUN true \
109-
# Remove development and unused packages.
110-
&& apt-get -y remove --purge \
111-
cpp-9 \
112-
gcc-9* \
113-
g++ \
114-
git \
115-
make \
116-
cmake* \
117-
llvm-10* \
118-
libc6-dev \
119-
linux-libc-dev \
120-
libclang-*-dev \
121-
build-essential \
122-
postgresql-server-dev-12 \
123-
&& apt-get clean \
124-
# Clear temporary files and directories.
125-
&& rm -rf \
126-
/tmp/* \
127-
/var/tmp/* \
128-
/root/.cache \
129-
/app/src/.git \
130-
/var/lib/apt/lists/* \
131-
/var/lib/postgresql/12/main/*
132-
133-
# Postgres PGDATA as volume
134-
ENV PATH $PATH:/usr/lib/postgresql/12/bin
135-
ENV PGDATA /var/lib/postgresql/data
136-
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
137-
VOLUME /var/lib/postgresql/data
138-
139-
COPY local_api.php /app/src/build/settings/local_api.php
140-
COPY init.sh /app/init.sh
141-
COPY startapache.sh /app/startapache.sh
142-
COPY startpostgres.sh /app/startpostgres.sh
143-
COPY update.sh /app/update.sh
144-
COPY start.sh /app/start.sh
145-
COPY replace_domain.sh /app/replace_domain.sh
146-
147-
# Collapse image to single layer.
148-
FROM scratch
149-
150-
COPY --from=build / /
151-
152-
WORKDIR /app
153-
154-
EXPOSE 5432
155-
EXPOSE 8080
1+
FROM mediagis/nominatim:4.0
2+
ENV PGDATA=/var/lib/postgresql/12/main

images/nominatim/README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Nominatim (Nominatim version 3.6)
1+
# Nominatim (Nominatim version 4.0)
22

3-
This version of Nominatim was copy from https://github.com/mediagis/nominatim-docker/tree/master/3.6, with certain updates to fit in osm-seed enviroment
3+
This version of Nominatim was copy from https://github.com/mediagis/nominatim-docker/tree/master/4.0, with certain updates to fit in osm-seed enviroment
44

55
### Configuration
66

@@ -9,11 +9,3 @@ In order to run this container we need environment variables, these can be found
99
- [.env.nominatim.example](./../../envs/.env.nominatim.example)
1010

1111
**Note**: Rename the above files as `.env.nominatim`
12-
13-
#### Running nominatim - DB and API container
14-
15-
```sh
16-
# Docker compose
17-
docker-compose run nominatim-db
18-
docker-compose run nominatim-api
19-
```

images/nominatim/init.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

images/nominatim/local_api.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

images/nominatim/nominatim.conf

Lines changed: 0 additions & 13 deletions
This file was deleted.

images/nominatim/replace_domain.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

images/nominatim/start.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

images/nominatim/startapache.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

images/nominatim/startpostgres.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

images/nominatim/update.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)