maplibre / martin

Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling.
https://martin.maplibre.org
Apache License 2.0
2.31k stars 216 forks source link

Cant retrieve connection from the pool: Timed out in bb8 #496

Closed IceMan1910 closed 1 year ago

IceMan1910 commented 1 year ago

Hi all. Just started on this mapping tools quest :) I'm not being able to solve what seems to be a simple issue with martin.

I have my postgres bd running (OSM is the bd name), it is already fed with data coming from osm2pgsql with flex output. No issues there. It has a points, lines, polygons table with geometries. Now i want to serve my vector tiles with martin :)

I'm on windows 10, my postegres is running on a local server on ubuntu. Running on terminal: PS C:\Users\[user]\Desktop\martin> .\martin.exe -c .\config.yaml

On yaml file I have:

connection_string: "postgres://postgres:[pass]@[local_ip_for_ubuntu]:5432/OSM"
default_srid: 4326
listen_addresses: "0.0.0.0:4000"

I've tried without the config file, using connection string on the terminal. Same output:

[2022-11-29T16:13:46Z INFO  martin] Starting Martin v0.6.1
[2022-11-29T16:13:46Z INFO  martin] Using .\config.yaml
[2022-11-29T16:13:46Z INFO  martin::pg::db] Connecting to database
[2022-11-29T16:14:16Z ERROR martin] Can't retrieve connection from the pool: Timed out in bb8

I can connect just fine with pgadmin to the bd, and I ran the osm2pgsql process on this windows machine with output going to this same bd. I can´t seem to make this work. What am I missing? Thanks in advance.

dwweb0309 commented 1 year ago

@nyurik Do you know tileserver-gl? Which is similar to martin but it feeds vector tiles from sqlite database. By default, tileserver-gl uses config file in the folder where the command runs. I think that is good practice.

nyurik commented 1 year ago

@dwweb0309 ah, you forgot to share the file with the docker container itself, and doing the same thing as tileserve-gl wouldn't help here.

try this:

docker run --rm -it --net=host -v $PWD:/martin-config -p 3009:3000 \
   -e DATABASE_URL=postgres://postgres:password@localhost/propedia \
   maplibre/martin:main -c /martin-config/config.yaml

from the dir that contains your config file (or specify the full path in -v param. This way you share the file with the docker container, and it can read it.

dwweb0309 commented 1 year ago

@dwweb0309 ah, you forgot to share the file with the docker container itself, and doing the same thing as tileserve-gl wouldn't help here.

try this:

docker run --rm -it --net=host -v $PWD:/martin-config -p 3009:3000 \
   -e DATABASE_URL=postgres://postgres:password@localhost/propedia \
   maplibre/martin:main -c /martin-config/config.yaml

from the dir that contains your config file (or specify the full path in -v param. This way you share the file with the docker container, and it can read it.

Thanks @nyurik I think above comment should be in documentation

nyurik commented 1 year ago

Sure! Want to do a pr?

nyurik commented 1 year ago

this will be released as part of 0.7.0