Closed IceMan1910 closed 1 year ago
@IceMan1910 are you able to run psql "postgres://postgres:[pass]@[local_ip_for_ubuntu]:5432/OSM"
? (assuming you have psql installed on your windows box)
@nyurik I don't have it instaled locally. Does it make sense to install it, just to test? With psql on the pgAdmin4 on this machine, I can connect fine.
I also have another ubuntu server on my local network. Should I install martin on ubuntu instead of windows 10?
I think it would be helpful - it seems to be happening on your machine, plus having psql when working with PG is highly useful for any kind of simple querying
P.S. To be honest, I would never use Windows for any kind of server-related activities :)
@nyurik OK so... I'm really stuck here. Steps done:
./martin --config config.yaml
Same old, same old :\
[2022-12-02T04:01:24Z INFO martin] Starting Martin v0.6.1
[2022-12-02T04:01:24Z INFO martin] Using config.yaml
[2022-12-02T04:01:24Z INFO martin::pg::db] Connecting to database
[2022-12-02T04:01:54Z ERROR martin] Can't retrieve connection from the pool: Timed out in bb8
Now, with psql client installed, and copying the connection string from the config file to make sure it is exactly the same:
[user]@[server]:~/martin$ psql "postgres://postgres:[pass]@[ip]:5432/OSM"
psql (14.5 (Ubuntu 14.5-0ubuntu0.22.04.1), server 15.1 (Ubuntu 15.1-1.pgdg22.04+1))
WARNING: psql major version 14, server major version 15.
Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
OSM=# select version();
version
-----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 15.1 (Ubuntu 15.1-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, 64-bit
(1 row)
OSM=#
It connects fine. Only with martin it does not.
What can it be? Could it be something with Rust? I have nothing related to Rust installed on this machine.
Thanks for testing, this is indeed weird. Could you try this:
./martin "postgres://postgres:[pass]@[ip]:5432/OSM"
./martin "postgres://postgres:[pass]@[ip]:5432/OSM"
@nyurik
- try running martin without config, i.e.
./martin "postgres://postgres:[pass]@[ip]:5432/OSM"
same output
- try using an old, pre-.6 version and also run
./martin "postgres://postgres:[pass]@[ip]:5432/OSM"
sucessfull with 0.5 version
[2022-12-02T16:05:41Z INFO martin] Starting martin v0.5.0
[2022-12-02T16:05:41Z INFO martin] Config is not set, scanning database
[2022-12-02T16:05:42Z INFO martin] Connected to ..://..@...:5432/OSM
[2022-12-02T16:05:42Z INFO martin::table_source] Found public.boundaries table source
[2022-12-02T16:05:42Z INFO martin::table_source] Found public.lines table source
[2022-12-02T16:05:42Z INFO martin::table_source] Found public.points table source
[2022-12-02T16:05:42Z INFO martin::table_source] Found public.polygons table source
[2022-12-02T16:05:42Z INFO martin::table_source] Found public.routes table source
[2022-12-02T16:05:44Z INFO martin] Martin has been started on 0.0.0.0:3000.
Is it a bug on 0.6 ?
Hm, this is not good. In 0.6 we switched to a newer postgres accesss lib, async in nature. This (in theory) should not have any consequences. Also, in 0.6 we added tons of itnegration testing on all platforms, including external hosted DBs like digital ocean. All was seemed to be working fine until your report :) So now we need to figure out how your DB setup or networking is different from all the test setups we have.
So a few things we could try next:
# in shell 1
docker run --rm -it -p 5000:5432 -e POSTGRES_PASSWORD=abc123 postgis/postgis:15-3.3-alpine
# in shell 2
./martin postgres://postgres:abc123@localhost:5000
You can try it with both martin versions to see if there are any differences. I expect it to show a bunch of junk tiger tables discovered as found sources
Ok. I will try the docker approach. I'll give feedback asap.
- See what custom configurations you have done to the database, i.e. any restrictions on who can connect and how? Authentication protocols? SSL? Some other interesting methods?
That's where you are going to be disappointed :\ It's a brand new setup. New Ubuntu 22.0, new postegres 15. From a clean format on the machine. Only 1 user on the BD, postegres, only setup done was to open up the standard port to allow for connections. 0 customization.
@IceMan1910 thx, i wonder if it would be possible to build a docker using those steps? Basically try to create a Dockerfile
file that is based on ubuntu
base image, and the steps would install Postgres and do any needed configuration, plus download martin as last step using curl? This way we can have a reproducible test.
@IceMan1910 any luck creating a reproducible docker image? I'm really concerned about this bug. Could it be some old (or new?) authentication method?
@IceMan1910 please confirm you are still having this issue. We need a way to reproduce this bug as it may have a lot of consequences for other users if confirmed.
@nyurik I am tring to use it:
COMMAND: docker run --rm -it -p 5001:5432 -e POSTGRES_PASSWORD=abc123 postgis/postgis:15-3.3-alpine
COMMAND:
docker run \
--net=host \
-p 3000:3000 \
-e DATABASE_URL=postgres://postgres:abc123@localhost:5001 \
maplibre/martin
yes, i'm getting the same result -- seems like everything is working as expected
One important note though -- your docker image seems a bit old. You may want to pull the latest or specify the version:
docker run --net host --rm -it maplibre/martin:v0.6.1 postgres://postgres:abc123@localhost:5001
P.S. oops, i misread - you are using the latest 0.6.1
I have the same error right now if try to connect to an external DB ( Google Cloud ). PGAdmin works fine with the same string connection.
@carlosrziegler thanks for the feedback. We need a clear way to replicate the issue in order to diagnose it. How do you set up the postgres? What configuration settings do you set on it? What PG version do you use? Ideally, if you can give an exact reproducible steps, especially in a docker container, it would help us immensely. Thanks!
Same issue
Ubuntu version: 20.04.5
Postgres: 15
martin: 0.6
docker run -p 3000:3000 -e DATABASE_URL='postgres://postgres:postgres@localhost:5432/propedia' maplibre/martin
Error: Can't retrieve connection from the pool: Timed out in bb8
@dwweb0309 I suspect in your case this is due to the martin docker image not having access to the port 5432 from your database's localhost. Try to run --net host
instead of -p 3000:3000
?
@dwweb0309 I suspect in your case this is due to the martin docker image not having access to the port 5432 from your database's localhost. Try to run
--net host
instead of-p 3000:3000
?
The same result
docker run --net host -e DATABASE_URL='postgres://postgres:postgres@localhost:5432/propedia' maplibre/martin
@dwweb0309 are you able to run psql postgres://postgres:postgres@localhost:5432/propedia
(from the host)
P.S. one more thing - try to remove the quote symbols around the db url - just in case they get passed incorrectly. And please describe how your db is set up on the localhost, and what configurations you used. What do postgresql.conf
and pg_hba.conf
look like? etc
psql postgres://postgres:postgres@localhost:5432/propedia
works.
My postgresql.conf
and pg_hba.conf
are initial state. And I was advised to update listen_addresses='*'
in postgresql.conf
and host all all 127.0.0.1/32 md5
to host all all 0.0.0.0/0 md5
in pg_hba.conf
, but all failed.
@dwweb0309 do you think you could help me debug this issue further? I am currently installing virtualbox and will install ubuntu-server in it, plus install postgres and copy/paste martin binary into it for simplest case. If that still works ok, will try to set up docker inside the virtualbox. This way we can have exact reproducible steps to get to the error.
P.S. see if you can get Martin to run without docker (just get the binary for your platform from the releases and run it directly), and if you could do similar steps to get to an error, would be great
@dwweb0309 do you think you could help me debug this issue further? I am currently installing virtualbox and will install ubuntu-server in it, plus install postgres and copy/paste martin binary into it for simplest case. If that still works ok, will try to set up docker inside the virtualbox. This way we can have exact reproducible steps to get to the error.
Thanks!. That is what I did exactly. I am using windows, and have ubuntu 20 in wmware. I have installed postgres 15 in it, and tried to run martin using docker command.
Is there a way you can record every single step you went through? I know its tricky, but it would greatly help us pin down this nasty issue
I might have been able to reproduce it using a downloaded image, but I need to know how you configured postgres. I used this method:
apt install postgis
sudo -u postgres createuser -s -P mypg
psql postgres://mypg:mypg@localhost:5432/postgres
sudo docker run --rm -it --net host postgres psql postgres://mypg:mypg@localhost:5432/postgres
Thank you for your effort.
Yes, I installed postgres and postgis using these steps
But I didn't add a new user, I am just using postgres user with password reset. No more changes in postgres configuration.
Can you try docker run
with some postgres config changes?
Hello, literally just found Martin 2 hours ago, got similar issues with connecting to the db. Here are my steps:
I've created a new postgres database in Azure with the PostGIS extension. (filled with some test spatial data)
pgAdmin and psql work fine with my connection string/details.
I tried to test martin from my host machine (Mac). Using Homebrew, it installed v0.5.0 (is that expected?).
I ran martin with the same connection string and got this: Can't setup connection pool: timed out waiting for connection
.
Found this issue.
And tried to run with docker, got the error message you have here Can't retrieve connection from the pool: Timed out in bb8
(Docker installed v0.6.2).
I'm not sure how helpful this information is, can provide more details if needed. Really excited to try out the software though!
@ItsCoolOnMars v0.5.0 is extremely old, back from 2019 from even before being part of MapLibre (cc @stepankuzmin) - could you try the latest release please? We should upload to homebrew. The more important aspect of your report is that https://github.com/maplibre/martin/issues/496#issuecomment-1335479043 notes that 0.5.0 did work -- which was using different lib to connect to postgres - which makes me think that this might be a different issue.
I might have been able to reproduce it using a downloaded image, but I need to know how you configured postgres. I used this method:
- install postgres using these steps
- install postgis with
apt install postgis
- add a new user + database:
sudo -u postgres createuser -s -P mypg
- ensure that postgres db has a postgis extension
psql postgres://mypg:mypg@localhost:5432/postgres
- ensure that it works from a docker:
sudo docker run --rm -it --net host postgres psql postgres://mypg:mypg@localhost:5432/postgres
@nyurik
Does above step work? I did the same step, but it doesn't work.
sudo docker run --rm -it --net host postgresql psql
command sends message like Unable to find image 'postgres:latest' locally
@dwweb0309 docker run downloads the postgres:latest
image automatically - i just tried it on my machine, works fine. If you want, you can first do docker pull postgres
and then run it.
@nyurik
I have tried to use postgres database in AWS RDS
sudo docker run --rm -it --net host postgres psql postgres://mypg:mypg@localhost:5432/postgres
works. But docker run --rm -it -p 3000:3000 -e DATABASE_URL='postgres://rds-user:rds-password@rds-host-url:5432/propedia' maplibre/martin
doesn't work.
@dwweb0309 did you mistype your reply? The postgres://...
url should be the same in both docker calls
@dwweb0309 did you mistype your reply? The
postgres://...
url should be the same in both docker calls
rds-user
, rds-password
, and rds-host-url
are just placeholders
thanks, that helps! I am beginning to suspect that it is the ssl connection
part that's not working correctly. When I use psql locally, I do not see that line
does anyone know how to have a simple docker that has a postgresql with ssl, it would be so helpful! esp if it is based on the https://github.com/postgis/docker-postgis -- this way i could try to test it reliably
I think I finally was able to reliably reproduce it. The issue (suprise!) is related to SSL -- I need to disable hostname verification during SSL handshake. Secondary issue was upstream -- https://github.com/djc/bb8/issues/151 -- that's why no errors were being reported, instead giving a silly "timeout".
I will fix this in the next few days, and republish, possibly backporting it to 0.6.0 too.
@dwweb0309 in your case it may just be missing a root cert from Amazon. Try making it visible to your container and set the CA_ROOT_CERT
env variable.
my plan to fix this:
psql
ssl modesI just merged the fix to main, could someone with this issue try it? Note that you would need to either use the maplibre/martin:main
docker image or use cargo run --features ssl --release -- postgres://...
to build it locally. Thanks!
CC: @IceMan1910 @CarlosZiegler @carlosrziegler @ItsCoolOnMars @dwweb0309
@nyurik I believe you meant maplibre/martin:main
because "latest" is 2 months old in the docker hub. It didn't work for me with the same error as before. (v0-7-0-alpha)
@ItsCoolOnMars you are absolutely right, thank you, I fixed my comment above.
@ItsCoolOnMars when you said it didn't work -- you meant the latest or the main tag?
well, technically both :). but yeah the "main" one didn't work.
I just merged the fix to main, could someone with this issue try it? Note that you would need to either use the
maplibre/martin:main
docker image or usecargo run --features ssl --release -- postgres://...
to build it locally. Thanks!CC: @IceMan1910 @CarlosZiegler @carlosrziegler @ItsCoolOnMars @dwweb0309
@nyurik Thanks, there is no issue with docker command.
But, I tried to use -c
option, but I always get No such file or directory message
One more thing. The APIs in the documentation are not available. Should the documentation be updated?
I just migrated to dead-pool, so we should never see the timeout error again. Instead, it will now actually say what the error is. The docker's main
image should be published in a few min. @ItsCoolOnMars could you take a look again and see what error you get now?
@dwweb0309 can you write the whole command please? I'm not certain what you mean. Also, you linked to the v0.6, and a lot has been changed in the main branch. Thx!
@nyurik With dead-pool it finally works for me: serves the tiles, and everything seems good. Thank you!
I just migrated to dead-pool, so we should never see the timeout error again. Instead, it will now actually say what the error is. The docker's
main
image should be published in a few min. @ItsCoolOnMars could you take a look again and see what error you get now?@dwweb0309 can you write the whole command please? I'm not certain what you mean. Also, you linked to the v0.6, and a lot has been changed in the main branch. Thx!
docker run --rm -it --net=host -p 3009:3000 -e DATABASE_URL=postgres://postgres:password@localhost/propedia maplibre/martin:main -c config.yaml
-c 'config.yaml'
, -c './config.yaml'
all doesn't work
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:
I've tried without the config file, using connection string on the terminal. Same output:
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.