consbio / mbtileserver

Basic Go server for mbtiles
ISC License
657 stars 104 forks source link

Docker 404 Error #174

Closed JDBourkeUbihere closed 1 year ago

JDBourkeUbihere commented 1 year ago

I am trying to run this repo as a Docker container in an EC2 Amazon Linux 2 environment, and I am getting 404 page not found errors when trying to use the map preview.

In one terminal: [ec2-user@ip-172-31-27-60 ~]$ docker run --rm -p 8080:8000 -v /home/ec2-user/files/:/tilesets consbio/mbtileserver time="2023-09-25T19:51:57Z" level=info msg="Searching for tilesets in ./tilesets\n" time="2023-09-25T19:51:57Z" level=info msg="Published 2 services"


Use Ctrl-C to exit the server

HTTP server started on 0.0.0.0:8000

In another terminal:

[ec2-user@ip-172-31-27-60 files]$ curl http://0.0.0.0:8080/services/trails/map 404 page not found

I also can't access the Public IP address like I am hoping to.

brendan-ward commented 1 year ago

I think you need to try it at http://localhost:8080/services/trail/map instead when using curl on the instance.

When you say Public IP address, do you mean the public IP address assigned by AWS? Do you have that port (8080) open to the internet in your security group settings?

Is this limited to just the preview or are you also getting a 404 error at /services as well?

JDBourkeUbihere commented 1 year ago

Thanks for the "localhost" tip and the timely response! I still am getting the error but was able to get just /services to work (included below). I do mean the AWS-assigned public IP address, and I do have that port open in the security group settings.

[ec2-user@ip-172-31-27-60 files]$ curl http://localhost:8080/services [{"imageType":"pbf","url":"http://localhost:8080/services/tilesets/bolivia","name":"bolivia.mbtiles"},{"imageType":"pbf","url":"http://localhost:8080/services/tilesets/trails","name":"trails-with-a-name"}]

brendan-ward commented 1 year ago

Looks like it is seeing an extra tilesets directory in your path, so perhaps the preview is at http://localhost:8080/services/tilesets/trails/map?

Do you have a /home/ec2-user/files/tilesets folder? If so, that is where the extra part of the URLs is coming from; you might want to do docker run --rm -p 8080:8000 -v /home/ec2-user/files/tilesets:/tilesets consbio/mbtileserver instead.

JDBourkeUbihere commented 1 year ago

That did it. Thank you!