Docker compose with local Postgres #494
Unanswered
FlorentinBouchendhomme
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, I wanted to know how I could make nominatim in Docker with a local postgres database.
I have this current docker-compose.yml but I can't make it work, I have my file at the same level than my docker-compose
docker-compose.yml
france-latest.osm.pbf
Here's the docker-compose :
nominatim:
container_name: nominatim
image: mediagis/nominatim:4.2
restart: always
ports:
- "8080:8080"
environment:
PBF_PATH: "/nominatim/france-latest.osm.pbf"
IMPORT_WIKIPEDIA: false
# PBF_URL: https://download.geofabrik.de/europe/france-latest.osm.pbf
REPLICATION_URL: https://download.geofabrik.de/europe/france-updates/
NOMINATIM_PASSWORD: very_secure_password
POSTGRES_MAX_WAL_SIZE: 6GB
POSTGRES_WORK_MEM: 2GB
POSTGRES_HOST: gambapet_postgres
POSTGRES_PORT: 5432
POSTGRES_USER: nominatim
POSTGRES_PASSWORD: postgrespassword
POSTGRES_DB: nominatim
volumes:
- ./france-latest.osm.pbf:/nominatim/france-latest.osm.pbf
shm_size: 1gb
depends_on:
- postgres
networks:
- network
postgres:
container_name: postgres
image: postgres:13
environment:
POSTGRES_PASSWORD: postgrespassword
POSTGRES_USER: nominatim
POSTGRES_DB: nominatim
volumes:
- ./postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- network
volumes:
postgres_data:
Here's the logs of the nominatim container :
tailpid=0
2023-10-18 09:10:13 + replicationpid=0
2023-10-18 09:10:13 + trap stopServices SIGTERM TERM INT
2023-10-18 09:10:13 + /app/config.sh
2023-10-18 09:10:13 + id nominatim
2023-10-18 09:10:13 + useradd -m -p very_secure_password nominatim
2023-10-18 09:10:13 + IMPORT_FINISHED=/var/lib/postgresql/14/main/import-finished
2023-10-18 09:10:13 + '[' '!' -f /var/lib/postgresql/14/main/import-finished ']'
2023-10-18 09:10:13 + /app/init.sh
2023-10-18 09:10:13 + OSMFILE=/nominatim/data.osm.pbf
2023-10-18 09:10:13 + CURL=("curl" "-L" "-A" "${USER_AGENT}" "--fail-with-body")
2023-10-18 09:10:13 + SCP='sshpass -p DMg5bmLPY7npHL2Q scp -o StrictHostKeyChecking=no [email protected]'
2023-10-18 09:10:13 + '[' -z '' ']'
2023-10-18 09:10:13 ++ nproc
2023-10-18 09:10:13 + THREADS=8
2023-10-18 09:10:13 + '[' false = true ']'
2023-10-18 09:10:13 + '[' -f false ']'
2023-10-18 09:10:13 + echo 'Skipping optional Wikipedia importance import'
2023-10-18 09:10:13 + '[' '' = true ']'
2023-10-18 09:10:13 + '[' -f '' ']'
2023-10-18 09:10:13 + echo 'Skipping optional GB postcode import'
2023-10-18 09:10:13 + '[' '' = true ']'
2023-10-18 09:10:13 + '[' -f '' ']'
2023-10-18 09:10:13 + echo 'Skipping optional US postcode import'
2023-10-18 09:10:13 + '[' '' = true ']'
2023-10-18 09:10:13 + '[' -f '' ']'
2023-10-18 09:10:13 + echo 'Skipping optional Tiger addresses import'
2023-10-18 09:10:13 + '[' '' '!=' '' ']'
2023-10-18 09:10:13 + '[' /nominatim/france-latest.osm.pbf '!=' '' ']'
2023-10-18 09:10:13 + echo Reading OSM extract from /nominatim/france-latest.osm.pbf
2023-10-18 09:10:13 + OSMFILE=/nominatim/france-latest.osm.pbf
2023-10-18 09:10:13 + '[' '!' -f /var/lib/postgresql/14/main/PG_VERSION ']'
2023-10-18 09:10:13 + cp /etc/postgresql/14/main/conf.d/postgres-import.conf.disabled /etc/postgresql/14/main/conf.d/postgres-import.conf
2023-10-18 09:10:13 + sudo service postgresql start
2023-10-18 09:10:16 + sudo -E -u postgres psql postgres -tAc 'SELECT 1 FROM pg_roles WHERE rolname='''nominatim''''
2023-10-18 09:10:16 + grep -q 1
2023-10-18 09:10:16 + grep -q 1
2023-10-18 09:10:16 + sudo -E -u postgres psql postgres -tAc 'SELECT 1 FROM pg_roles WHERE rolname='''www-data''''
2023-10-18 09:10:17 + sudo -E -u postgres psql postgres -tAc 'ALTER USER nominatim WITH ENCRYPTED PASSWORD '''very_secure_password''''
2023-10-18 09:10:17 + sudo -E -u postgres psql postgres -tAc 'ALTER USER "www-data" WITH ENCRYPTED PASSWORD '''very_secure_password''''
2023-10-18 09:10:17 + sudo -E -u postgres psql postgres -c 'DROP DATABASE IF EXISTS nominatim'
2023-10-18 09:10:18 + chown -R nominatim:nominatim /nominatim
2023-10-18 09:10:18 + cd /nominatim
2023-10-18 09:10:18 + '[' '' = true ']'
2023-10-18 09:10:18 + sudo -E -u nominatim nominatim import --osm-file /nominatim/france-latest.osm.pbf --threads 8
2023-10-18 09:10:19 2023-10-18 07:10:19: Using project directory: /nominatim
2023-10-18 09:10:31 2023-10-18 07:10:31: Creating database
2023-10-18 09:10:33 2023-10-18 07:10:33: Setting up country tables
2023-10-18 09:10:40 2023-10-18 07:10:40: Importing OSM data file
2023-10-18 09:10:40 2023-10-18 07:10:40 osm2pgsql version 1.7.2
2023-10-18 09:10:40 2023-10-18 07:10:40 Database version: 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1)
2023-10-18 09:10:40 2023-10-18 07:10:40 PostGIS version: 3.2
2023-10-18 09:10:40 2023-10-18 07:10:40 Parsing gazetteer style file '/usr/local/etc/nominatim/import-full.style'.
2023-10-18 09:10:40 NOTICE: table "place" does not exist, skipping
2023-10-18 09:10:13 Skipping optional Wikipedia importance import
2023-10-18 09:10:13 Skipping optional GB postcode import
2023-10-18 09:10:13 Skipping optional US postcode import
2023-10-18 09:10:13 Skipping optional Tiger addresses import
2023-10-18 09:10:13 Reading OSM extract from /nominatim/france-latest.osm.pbf
2023-10-18 09:10:13 * Starting PostgreSQL 14 database server
2023-10-18 09:10:16 ...done.
2023-10-18 09:10:17 ALTER ROLE
2023-10-18 09:10:17 ALTER ROLE
2023-10-18 09:10:18 DROP DATABASE
2023-10-18 09:10:16 + sudo -E -u postgres psql postgres -tAc 'SELECT 1 FROM pg_roles WHERE rolname='''nominatim''''
2023-10-18 09:10:16 + grep -q 1
2023-10-18 09:10:16 + grep -q 1
2023-10-18 09:10:16 + sudo -E -u postgres psql postgres -tAc 'SELECT 1 FROM pg_roles WHERE rolname='''www-data''''
2023-10-18 09:10:17 + sudo -E -u postgres psql postgres -tAc 'ALTER USER nominatim WITH ENCRYPTED PASSWORD '''very_secure_password''''
2023-10-18 09:10:17 + sudo -E -u postgres psql postgres -tAc 'ALTER USER "www-data" WITH ENCRYPTED PASSWORD '''very_secure_password''''
2023-10-18 09:10:17 + sudo -E -u postgres psql postgres -c 'DROP DATABASE IF EXISTS nominatim'
2023-10-18 09:10:18 + chown -R nominatim:nominatim /nominatim
2023-10-18 09:10:18 + cd /nominatim
2023-10-18 09:10:18 + '[' '' = true ']'
2023-10-18 09:10:18 + sudo -E -u nominatim nominatim import --osm-file /nominatim/france-latest.osm.pbf --threads 8
2023-10-18 09:10:19 2023-10-18 07:10:19: Using project directory: /nominatim
2023-10-18 09:10:31 2023-10-18 07:10:31: Creating database
2023-10-18 09:10:33 2023-10-18 07:10:33: Setting up country tables
2023-10-18 09:10:40 2023-10-18 07:10:40: Importing OSM data file
2023-10-18 09:10:40 2023-10-18 07:10:40 osm2pgsql version 1.7.2
2023-10-18 09:10:40 2023-10-18 07:10:40 Database version: 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1)
2023-10-18 09:10:40 2023-10-18 07:10:40 PostGIS version: 3.2
2023-10-18 09:10:40 2023-10-18 07:10:40 Parsing gazetteer style file '/usr/local/etc/nominatim/import-full.style'.
2023-10-18 09:10:40 NOTICE: table "place" does not exist, skipping
And it stay stucks here.
Regards,
Beta Was this translation helpful? Give feedback.
All reactions