mojodna / marblecutter-virtual

Virtual catalogs for marblecutter
Other
48 stars 30 forks source link

Error when COGs are served from the same hostname of marble server through docker-compose #5

Open francbartoli opened 6 years ago

francbartoli commented 6 years ago

I have built a stack for uploading COGs and serve them from a storage bucket server. If I add marblecutter-virtual to the stack in a docker-compose deployment all its endpoints don't work as expected if the querystring url is from the same domain/ip while they work if it is an external cog like that from the readme.

There is a docker-compose to reproduce the problem.

Just upload a geotiff with tiled overviews as the example below:

curl -X POST \
  http://192.168.99.100:30800/api/cogs/ \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Disposition: attachment; geotiff-with-ovr.tif' \
  -H 'Content-Type: image/tif' \
  -H 'Postman-Token: 0e53c7df-8096-4dc7-9de4-23e6fc916733' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F image=@/tmp/geotiff-with-ovr.tif \
  -F name=geotiff-with-ovr.tif \
  -F compression=raw
mojodna commented 6 years ago

The URL you're then using as url is http://192.168.99.100:30800/api/cogs/geotiff-with-ovr.tif?

My initial guess is that the Docker image isn't able to connect to that IP from within. To verify, run docker-compose exec marblecutter-virtual bash (while the stack is running) and from within that, curl -v <url> > /dev/null to see if it can connect. If not, you may be able to use http://webapi/api/cogs/geotiff-with-ovr.tif as the URL (webapi will resolve to the corresponding container's IP). (You may need to add a links section with webapi for the marblecutter-virtual service for them to be linked up network- and DNS-wise.)

francbartoli commented 6 years ago

Thanks @mojodna, I will definitively try it out. Anyway I have also tried with cloud kubernetes clusters and having the marblecutter container in a different k8s cluster from the webapi one everything works very well. Still not checked it into the same minikube. Need more investigations