Skip to content

Commit 5eb140a

Browse files
authored
Merge pull request #3 from smithmicro/feature/4.2
Feature/4.2
2 parents 0baeb26 + 34a4dea commit 5eb140a

File tree

8 files changed

+48
-162
lines changed

8 files changed

+48
-162
lines changed

README.md

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ Minimalistic Docker images for Nominatim
44
## About
55
n7m is a [Numeronym](https://en.wikipedia.org/wiki/Numeronym) for [Nominatim](https://nominatim.org/).
66

7-
n7m is Nominatim packaged in Docker images with separation of responsibilities between housing the web server, ui, applicaiton server, setup processes, tests and PostgreSQL.
7+
n7m is Nominatim packaged in Docker images with separation of responsibilities between housing the web server, ui, applicaiton server, setup processes and PostgreSQL.
88

99
## Overview
1010
This set of Docker images seperates responsbility into 5 areas:
1111
* **n7m-app** - The main Nomainatim service running Apache/PHP connecting to `n7m-gis`
1212
* **feed** - Uses the `n7m-app` image to set up the `n7m-gis` database. Can also be used for updates and downloading files.
13-
* **n7m-test** - Runs all unit tests
1413
* **n7m-gis** - Postgis database
1514
* **n7m-ui** - Test web user interface
1615
* **n7m-web** - nginx web sever that hosts:
@@ -30,22 +29,22 @@ This set of Docker images seperates responsbility into 5 areas:
3029
+--------------+ +--------------+
3130
| |
3231
v 80 v
33-
+--------------+ +--------------+ +--------------+
34-
| | | | | |
35-
| n7m-app | | n7m-test | | feed |
36-
| | | | | |
37-
+--------------+ +--------------+ +--------------+
38-
| debian | | debian | | n7m-app |
39-
+--------------+ +--------------+ +--------------+
40-
| | | |
41-
v 5432 v v v
42-
/--------\ +----------------------------+ /--------\
43-
| volume |<---| | | volume |
44-
| pgdata | | n7m-gis | | data |
45-
\--------/ + + \--------/
46-
|----------------------------+
47-
| postgis/postgis |
48-
+----------------------------+
32+
+--------------+ +--------------+
33+
| | | |
34+
| n7m-app | | feed |
35+
| | | |
36+
+--------------+ +--------------+
37+
| ubuntu:jammy | | n7m-app |
38+
+--------------+ +--------------+
39+
| | |
40+
v 5432 v v
41+
/--------\ +-----------------+ /--------\
42+
| volume |<---| | | volume |
43+
| pgdata | | n7m-gis | | data |
44+
\--------/ + + \--------/
45+
|-----------------+
46+
| postgis/postgis |
47+
+-----------------+
4948
```
5049
## To Use
5150
1. Build all the images:
@@ -67,29 +66,12 @@ This set of Docker images seperates responsbility into 5 areas:
6766
* `docker-compose run feed setup`
6867
3. To update:
6968
* `docker-compose run feed update`
70-
3. To run unit tests:
71-
* `docker-compose run test make`
7269

7370
## Configuration Hints
7471
For updates, consider these configurations:
7572
* NOMINATIM_REPLICATION_MAX_DIFF - you will want to set this to a larger number.
7673
* NOMINATIM_REPLICATION_URL - you will want to set this to a closer mirror.
7774

78-
## Ubuntu vs Debian
79-
`ubuntu:jammy` was selected as the base image for branch image as to begin testing the lastest LTS release. Versions that are included below (at the time of this writing):
80-
* `debian:bullseye-slim`
81-
* 454MB Image for `n7m-app`
82-
* Python 3.9.2, PHP 7.4.28, psql 13.7
83-
* `ubuntu:focal`
84-
* 485MB Image for `n7m-app`
85-
* Python 3.8.10, PHP 7.4.3, psql 12.11
86-
* `debian:bookworm-slim` (not released)
87-
* 501MB Image for `n7m-app`
88-
* Python 3.10.5, PHP 8.1.5, psql 14.4
89-
* `ubuntu:jammy`
90-
* 528MB Image for `n7m-app`
91-
* Python 3.10.4, PHP 8.1.2, psql 14.3
92-
9375
## Advanced Tokenizer
9476
This image only uses the ICU Tokenizer. By default the included `tokenizer.php` file drives the PHP code and has a simple English tokenizer.
9577

@@ -109,8 +91,3 @@ To run n7m in AWS, the minimum EC2 Instance sizing is:
10991
* Storage: 500GB SSD (270G required for North America)
11092

11193
Note: At 16 GB RAM, `t3.xlarge` is too small and runs out of memory for osm2pgsql during a North America test.
112-
113-
## Downloading data
114-
https://wiki.openstreetmap.org/wiki/Downloading_data
115-
116-
docker run -v $PWD:/data openmaptiles/openmaptiles-tools download-osm

app/Dockerfile

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
FROM ubuntu:jammy AS build
22

3-
# https://nominatim.org/release-docs/develop/appendix/Install-on-Ubuntu-20/
4-
# Changes from the docs:
5-
# We do not need git
6-
# Other than that, upgraded to PostgreSQL 13 and alphabetized
3+
# https://nominatim.org/release-docs/develop/appendix/Install-on-Ubuntu-22/
74
ENV DEBIAN_FRONTEND=noninteractive
85

9-
RUN apt-get update && apt-get install -y \
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
107
build-essential \
8+
ca-certificates \
119
cmake \
1210
curl \
11+
git \
1312
g++ \
1413
libboost-dev \
1514
libboost-filesystem-dev \
1615
libboost-system-dev \
1716
libbz2-dev \
1817
libexpat1-dev \
1918
libicu-dev \
19+
liblua5.4-dev \
2020
libpq-dev \
2121
libproj-dev \
2222
php \
@@ -36,16 +36,17 @@ RUN apt-get update && apt-get install -y \
3636
python3-yaml \
3737
zlib1g-dev
3838

39-
ENV NOMINATIM_VERSION=4.0.1
39+
ENV NOMINATIM_VERSION=4.2.3
4040

41+
# Fetch
4142
WORKDIR /nominatim
42-
43-
# Build as install
4443
RUN curl -O -L http://www.nominatim.org/release/Nominatim-$NOMINATIM_VERSION.tar.bz2 \
4544
&& tar xvf Nominatim-$NOMINATIM_VERSION.tar.bz2 \
46-
&& mkdir build \
47-
&& cd build \
48-
&& cmake ../Nominatim-$NOMINATIM_VERSION \
45+
&& mv Nominatim-$NOMINATIM_VERSION Nominatim
46+
47+
# Build as install
48+
WORKDIR /nominatim/build
49+
RUN cmake ../Nominatim \
4950
&& make \
5051
&& make install
5152

@@ -55,10 +56,13 @@ FROM ubuntu:jammy
5556
ENV DEBIAN_FRONTEND=noninteractive
5657

5758
# install dependencies of the built binaries
58-
RUN apt-get update && apt-get install -y \
59+
RUN apt-get update && apt-get install -y --no-install-recommends \
5960
apache2 \
61+
ca-certificates \
6062
curl \
6163
libapache2-mod-php \
64+
libboost-filesystem-dev \
65+
liblua5.4 \
6266
libproj-dev \
6367
php \
6468
php-cgi \
@@ -73,7 +77,9 @@ RUN apt-get update && apt-get install -y \
7377
python3-psutil \
7478
python3-psycopg2 \
7579
python3-pyosmium \
76-
python3-yaml
80+
python3-yaml \
81+
&& apt-get clean \
82+
&& rm -rf /var/lib/apt/lists/*
7783

7884
# For settings, see: https://nominatim.org/release-docs/develop/customize/Settings/
7985
ENV NOMINATIM_TOKENIZER=icu \

app/download.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66

77
set -e
88

9+
# https://nominatim.org server requires a User Agent
10+
USER_AGENT="smithmicro/n7m-app"
11+
912
download() {
1013
DOWNLOAD_FILENAME=$(basename "$1")
1114
DOWNLOAD_PATH=/data/$DOWNLOAD_FILENAME
1215

1316
if [ -s ${DOWNLOAD_PATH} ]; then
1417
echo "OSM file $DOWNLOAD_PATH already exists, skipping download"
1518
else
16-
curl -L -o $DOWNLOAD_PATH $1
19+
curl -L -A $USER_AGENT -o $DOWNLOAD_PATH $1
1720
if [ $? != 0 ]; then
1821
echo "Failed to download file $DOWNLOAD_FILENAME"
1922
exit 1
@@ -37,22 +40,22 @@ while [[ $# -gt 0 ]]; do
3740
case $1 in
3841
-w|--wiki)
3942
# improve the quality of search results
40-
download https://www.nominatim.org/data/wikimedia-importance.sql.gz
43+
download https://nominatim.org/data/wikimedia-importance.sql.gz
4144
shift
4245
;;
4346
-u|--us-postal)
4447
# improve US postal code search
45-
download https://www.nominatim.org/data/us_postcodes.csv.gz
48+
download https://nominatim.org/data/us_postcodes.csv.gz
4649
shift
4750
;;
4851
-k|--uk-postal)
4952
# improve UK postal code search
50-
download https://www.nominatim.org/data/gb_postcodes.csv.gz
53+
download https://nominatim.org/data/gb_postcodes.csv.gz
5154
shift
5255
;;
5356
-g|--grid)
5457
# grab country grids
55-
download https://www.nominatim.org/data/country_grid.sql.gz
58+
download https://nominatim.org/data/country_grid.sql.gz
5659
shift
5760
;;
5861
-h|--help)

docker-compose.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ services:
3737
command: setup
3838
volumes:
3939
- ${PWD}/data:/data/
40-
test:
41-
build: test
42-
image: smithmicro/n7m-test
43-
environment:
44-
- PGPASSWORD=n7m-geocoding
45-
depends_on:
46-
- gis
47-
mem_limit: 200m
48-
command: "true"
4940
gis:
5041
build: gis
5142
image: smithmicro/n7m-gis

gis/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM postgis/postgis:14-3.2-alpine
1+
FROM postgis/postgis:14-3.3-alpine
22

33
# Nominatim recommended configuration
44
COPY --chown=postgres:postgres postgresql.conf /etc/postgresql/postgresql.conf

test/Dockerfile

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

ui/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM nginx:1.22-alpine
1+
FROM nginx:1.24-alpine
22

33
# https://nominatim.org/release-docs/latest/admin/Setup-Nominatim-UI/
44

5-
ENV NOMINATIM_UI_VERSION=3.2.4
5+
ENV NOMINATIM_UI_VERSION=3.2.12
66
ENV NOMINATIM_UI_FILENAME=nominatim-ui-$NOMINATIM_UI_VERSION
77
ENV NOMINATIM_APINOMINATIM_API_ENDPOINT_URI=/api/v4/
88
ENV NGINX_HTML_PATH=/usr/share/nginx/html

web/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM nginx:1.22-alpine
1+
FROM nginx:1.24-alpine
22

33
COPY site.conf /etc/nginx/conf.d/default.conf

0 commit comments

Comments
 (0)