protomaps / go-pmtiles

Single-file executable tool for working with PMTiles archives
https://docs.protomaps.com/pmtiles/cli
BSD 3-Clause "New" or "Revised" License
370 stars 51 forks source link

Configure port number #9

Closed showcaseearth closed 2 years ago

showcaseearth commented 2 years ago

I'll admit up front that I am least familiar with Go apps generally, so please excuse any very basic misses here. I love the concept of PMTiles and hope to test, initially focusing on python, but it seems this Go server is the more robust option.

I had hoped to take a shortcut to free deployment via Heroku for testing (following this workaround for compiled app https://medium.com/ki-labs-engineering/deploying-a-native-go-binary-on-heroku-6d4c955819d8), but the lack of configuration of port seems to be the main blocker. There appears to be no way to utilize a dynamic port currently.

Please disregard if this is an edge case, or if there is generally a better way to approach deployment of a precompiled Go app such as this. Excited to figure this out...

bdon commented 2 years ago

I've updated the help text, your command should look like:

go-pmtiles serve -p $PORT PATH

Let me know if that works

showcaseearth commented 2 years ago

That works! Humming along on Heroku with the sample data, look forward to expanding and digging more into PMTiles. Thanks for updating the help text, though I really should have seen it.

bdon commented 2 years ago

Please disregard if this is an edge case, or if there is generally a better way to approach deployment of a precompiled Go app such as this. Excited to figure this out...

running on Heroku or a SaaS like http://fly.io seems like something go-pmtiles should support well, but there may be other configuration options missing, so let me know what you run into. Heroku should handle things like SSL termination, but you may need other header values to be configurable: https://github.com/protomaps/go-pmtiles/issues/8

showcaseearth commented 2 years ago

Thanks @bdon ! I'll definitely flag anything else I see. At least immediately, my goal is to try a simple server config and just put a configurable CDN up in front (BunnyCDN is great!), which has quite a number of good defaults and more flexibility via edge rules. Nowhere near any production use cases yet, but PMTiles might just take the MBTiles/directory pains away finally.