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

External database issue #588

Closed
KOPACb opened this issue Nov 14, 2024 · 1 comment
Closed

External database issue #588

KOPACb opened this issue Nov 14, 2024 · 1 comment
Labels

Comments

@KOPACb
Copy link

KOPACb commented Nov 14, 2024

Cant bring to life nominatim 4.5 with external postgis.
got error if dabase exists

nominatim       | + sudo -E -u nominatim nominatim import --osm-file /tiles/pbf/russia-latest.osm.pbf --threads 32
nominatim       | 2024-11-14 16:14:28: Using project directory: /nominatim
nominatim       | 2024-11-14 16:14:32: Creating database
postgis         | 2024-11-14 16:14:32.732 UTC [39176] ERROR:  database "gis" already exists
postgis         | 2024-11-14 16:14:32.732 UTC [39176] STATEMENT:  CREATE DATABASE gis;
nominatim       | createdb: error: database creation failed: ERROR:  database "gis" already exists
nominatim       | 2024-11-14 16:14:32: FATAL: Creating new database failed.

Partically fixed in #394

Also got error if DB dropped:

nominatim       | + sudo -E -u postgres psql postgres -tAc 'ALTER USER nominatim WITH ENCRYPTED PASSWORD '\''Zx3y2OFBGJ'\'''
nominatim       | ALTER ROLE
nominatim       | + sudo -E -u postgres psql postgres -tAc 'ALTER USER "www-data" WITH ENCRYPTED PASSWORD '\''Zx3y2OFBGJ'\'''
nominatim       | ALTER ROLE

...

nominatim       | 2024-11-14 16:01:02: Using project directory: /nominatim
nominatim       | 2024-11-14 16:01:05: Creating database
nominatim       | 2024-11-14 16:01:06: Web user 'www-data' does not exist. Create it with:
nominatim       |
nominatim       |       createuser www-data
nominatim       | 2024-11-14 16:01:06: FATAL: Missing read-only user.

on remote server:

root@0f9a6cd6f447:/app# psql -d "$(echo $NOMINATIM_DATABASE_DSN | cut -d: -f2 | tr ';' ' ' )"
psql (16.4 (Ubuntu 16.4-0ubuntu0.24.04.2), server 17.0 (Debian 17.0-1.pgdg110+1))
WARNING: psql major version 16, server major version 17.
         Some psql features might not work.
Type "help" for help.

gis=# \du
                             List of roles
 Role name |                         Attributes
-----------+------------------------------------------------------------
 nominatim | Superuser, Create role, Create DB
 postgis   | Superuser, Create role, Create DB, Replication, Bypass RLS
 www-data  | Cannot login

To Reproduce
My latest docker-compose:

version: '3'

services:
  postgis:
    image: postgis/postgis
    container_name: postgis
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: postgresql
    volumes:
      - /tiles/postgres-data:/var/lib/postgresql/data
#      - ./postgis-entrypoint/postgres-tuning.conf:/docker-entrypoint-initdb.d//postgres-tuning.conf
#      - ./postgis-entrypoint/tune_db.sh:/docker-entrypoint-initdb.d/tune_db.sh


  nominatim:
    image: mediagis/nominatim:4.5
    container_name: nominatim
    ports:
      - "8001:8080"
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_HOST: postgis
      DB_HOST: "postgis"
      PGHOST: "postgis"
      PGUSER: ${POSTGRES_USER}
      PGPASSWORD: ${POSTGRES_PASSWORD}
      PBF_PATH: /tiles/pbf/russia-latest.osm.pbf
      PGDATABASE: ${POSTGRES_DB}
      NOMINATIM_REPLICATION_URL: https://download.geofabrik.de/russia-updates/
      NOMINATIM_IMPORT_WIKIPEDIA: "true"
      NOMINATIM_DATABASE_DSN: "pgsql:dbname=${POSTGRES_DB};user=${POSTGRES_USER};password=${POSTGRES_PASSWORD};host=postgis"
      NOMINATIM_DATABASE_WEBUSER: "www-data"
      NOMINATIM_PASSWORD: ${POSTGRES_PASSWORD}
#      SKIP_IMPORT: True
    volumes:
      - ./init.sh:/app/init.sh
      - /tiles/pbf:/tiles/pbf  # Монтирование директории для PBF-файлов
    depends_on:
      - postgis
@KOPACb KOPACb added the bug label Nov 14, 2024
@leonardehrenfried
Copy link
Collaborator

This feature is not supported by the core maintainers. If you want to try anyway, you can ask the people in this thread: #245 (comment)

Or use https://github.com/smithmicro/n7m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants