kosmtik / kosmtik

Make maps with OpenStreetMap and Mapnik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postgis Plugin: FATAL: Peer authentication failed

astridx opened this issue · comments

commented

I have set up a tile server with a small sample area following these instructions.: https://switch2osm.org/serving-tiles/manually-building-a-tile-server-ubuntu-22-04-lts/
This works fine and the tiles are stored in the directory /var/cache/renderd/tiles.

I am working on Ubuntu 22.04 with the user astrid.

Then I installed kosmtik from Git and I created the file /home/astrid/src/openstreetmap-carto/localconfig.json .

[
    {
        "where": "center",
        "then": [7.22, 50.28, 1]
    },
    {
        "where": "Layer",
        "if": {
            "Datasource.type": "postgis"
        },
        "then": {
   	    "Datasource.dbname": "gis",
            "Datasource.password": "",
            "Datasource.user": "_renderd",
            "Datasource.host": ""
        }
    }
]

I run kosmtik serve /home/astrid/src/openstreetmap-carto/project.mml

$ kosmtik serve /home/astrid/src/openstreetmap-carto/project.mml 
[Core] No usable config file found in /home/astrid/.config/kosmtik.yml
[Core] Loading plugin from ../plugins/base-exporters/index.js
[Core] Loading plugin from ../plugins/hash/index.js
[Core] Loading plugin from ../plugins/local-config/index.js
[Core] Loading plugin from ../plugins/datasource-loader/index.js
[Core] Loading plugin from ../plugins/version/index.js
[Core] Loading project from /home/astrid/src/openstreetmap-carto/project.mml
[Core] PreviewServer started, you can browse http://127.0.0.1:6789
[Core] Creating metatiles cache dir tmp/openstreetmap-carto/meta
[Core] Deleting previous metatiles tmp/openstreetmap-carto/meta
[Core] Created vector cache dir tmp/openstreetmap-carto/vector
[Local Config] Unable to load local config from /home/astrid/src/openstreetmap-carto/localconfig.json
[SyntaxError: Unexpected token } in JSON at position 241]
[Core] Generating Mapnik XML…
[Core] Using mapnik version 4.0.0
Warning: style/landcover.mss:608:4 line-offset is unstable. It may change in the future.
...

Warning: style/admin.mss:18:6 Styles do not match layer selector #admin-low-zoom.
[Core] Loading map…
[Core] Map ready
[Core] Loading map…
[Core] Map ready
[Core] Loading map…
[Core] Map ready

[httpserver] / 302
[httpserver] /openstreetmap-carto 302
[httpserver] /openstreetmap-carto/ 200
[httpserver] /node_modules/leaflet/dist/leaflet-src.js 200
[httpserver] /src/front/FormBuilder.js 200
[httpserver] /config/ 200
[httpserver] /openstreetmap-carto/config/ 200
[httpserver] /src/front/Autocomplete.js 200
[httpserver] /src/front/DataInspector.js 200
[httpserver] /src/front/MetatilesBounds.js 200
[httpserver] /src/front/Sidebar.js 200
[httpserver] /src/front/Toolbar.js 200
[httpserver] /node_modules/leaflet-formbuilder/Leaflet.FormBuilder.js 200
[httpserver] /src/front/Core.js 200
[httpserver] /src/front/Settings.js 200
[httpserver] /src/front/Command.js 200
[httpserver] /src/plugins/base-exporters/front/export.js 200
[httpserver] /src/front/Map.js 200
[httpserver] /hash.js 200
[httpserver] /node_modules/leaflet-hash/leaflet-hash.js 200
[httpserver] /node_modules/leaflet/dist/leaflet.css 200
[httpserver] /src/front/Toolbar.css 200
[httpserver] /src/front/Sidebar.css 200
[httpserver] /src/front/Core.css 200
[httpserver] /src/front/fonts/FiraSans-Light.woff 200
[httpserver] /src/front/header_logo.svg 200
[httpserver] /src/front/fonts/DejaVuSans-webfont.woff 200
Trace
    at ProjectServer.raise (/home/astrid/src/kosmtik/src/back/ProjectServer.js:275:17)
    at /home/astrid/src/kosmtik/src/back/ProjectServer.js:82:34
    at /home/astrid/src/kosmtik/node_modules/generic-pool/lib/generic-pool.js:283:11
    at Object.loaded (/home/astrid/src/kosmtik/node_modules/mapnik-pool/index.js:23:37)
Postgis Plugin: FATAL:  role "astrid" does not exist
Connection string: 'dbname=gis connect_timeout=4 fallback_application_name=mapnik'
  encountered during parsing of layer 'landcover-low-zoom' in Layer
[httpserver] /openstreetmap-carto/tile/4/7/7.png?t=1682773039757 500
...
Trace
    at ProjectServer.raise (/home/astrid/src/kosmtik/src/back/ProjectServer.js:275:17)
    at /home/astrid/src/kosmtik/src/back/ProjectServer.js:82:34
    at /home/astrid/src/kosmtik/node_modules/generic-pool/lib/generic-pool.js:283:11
    at Object.loaded (/home/astrid/src/kosmtik/node_modules/mapnik-pool/index.js:23:37)
Postgis Plugin: FATAL:  Peer authentication failed for user "_renderd"
Connection string: 'dbname=gis user=_renderd connect_timeout=4 fallback_application_name=mapnik'
  encountered during parsing of layer 'landcover-low-zoom' in Layer
[httpserver] /openstreetmap-carto/tile/4/11/7.png?t=1682773631807 500
[httpserver] /openstreetmap-carto/poll/ 200

When I open the URL I see this message:

Postgis Plugin: FATAL: Peer authentication failed for user "_renderd" Connection string: 'dbname=gis user=_renderd connect_timeout=4 fallback_application_name=mapnik' encountered during parsing of layer 'landcover-low-zoom' in Layer

What am I doing wrong?

Unbenannt

I asked that question here too: https://gis.stackexchange.com/questions/458705/kosmtik-postgis-plugin-fatal-peer-authentication-failed-for-user

commented

I have now done it by creating a new database using my current Linux user. Until I am more familiar with the permissions, this is a workaround.