aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nominatim/Dockerfile27
-rw-r--r--nominatim/postgresql.conf14
-rwxr-xr-xnominatim/run.sh2
3 files changed, 43 insertions, 0 deletions
diff --git a/nominatim/Dockerfile b/nominatim/Dockerfile
new file mode 100644
index 0000000..2571467
--- /dev/null
+++ b/nominatim/Dockerfile
@@ -0,0 +1,27 @@
+FROM ubuntu:20.04 as build
+ENV DEBIAN_FRONTEND noninteractive
+WORKDIR serv
+
+RUN apt update && apt upgrade -y
+RUN apt install tzdata -y
+RUN apt install -y build-essential cmake g++ libboost-dev libboost-system-dev \
+ libboost-filesystem-dev libexpat1-dev zlib1g-dev \
+ libbz2-dev libpq-dev libproj-dev \
+ postgresql-server-dev-12 postgresql-12-postgis-3 \
+ postgresql-contrib postgresql-12-postgis-3-scripts \
+ apache2 php php-pgsql libapache2-mod-php \
+ php-intl python3-setuptools python3-dev python3-pip \
+ python3-psycopg2 python3-tidylib
+ RUN apt install -y systemctl sudo osmium-tool wget postgresql-12
+
+RUN useradd -d /srv/nominatim -s /bin/bash -m nominatim
+ENV USERNAME=nominatim
+ENV USERHOME=/srv/nominatim
+RUN chmod a+x $USERHOME
+RUN systemctl restart postgresql
+RUN systemctl enable postgresql
+RUN systemctl start postgresql
+RUN (su postgres -c 'cd /root && wget https://download.bbbike.org/osm/bbbike/Tehran/Tehran.osm.pbf')
+RUN su postgres -c '/usr/lib/postgresql/12/bin/pg_ctl start -l logfile -D /root/Tehran.osm.pbf'
+# RUN sudo -u postgres createuser -s $USERNAME
+# RUN sudo -u postgres createuser www-data
diff --git a/nominatim/postgresql.conf b/nominatim/postgresql.conf
new file mode 100644
index 0000000..d5a30b9
--- /dev/null
+++ b/nominatim/postgresql.conf
@@ -0,0 +1,14 @@
+shared_buffers = 1GB
+maintenance_work_mem = 4GB
+autovacuum_work_mem = 1GB
+work_mem = 50MB
+effective_cache_size = 4GB
+synchronous_commit = off
+checkpoint_segments = 100 # only for postgresql <= 9.4
+max_wal_size = 500MB # postgresql > 9.4
+checkpoint_timeout = 20min
+checkpoint_completion_target = 0.9
+autovacuum_max_workers = 2
+# reenable after initial import
+fsync = off
+full_page_writes = off
diff --git a/nominatim/run.sh b/nominatim/run.sh
new file mode 100755
index 0000000..6aae931
--- /dev/null
+++ b/nominatim/run.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+docker run -it --entrypoint bash $1