Closed jokroese closed 5 months ago
Update:
I've been learning how to use the various Cloudflare products and the tooling around it
It's possible we'd also need to use the "Pro" plan to use Cloudflare which is 20 USD per month (on top of the costs above).
@queeringthemap, does QtM's relationship with Cloudflare cover any of this?
Yes! QtM is part of Project Galileo with Cloudflare, which gives it a free Business Plan, which is one level higher than the Pro Plan.
@narcode mentioned Supabase Storage as an option for this to reduce the number of platforms we use https://github.com/radical-data/queering-the-map/issues/16#issuecomment-2025963585. I think it's supported (based on this https://github.com/mapbasedev/mapbasedev?tab=readme-ov-file#storage and this fix https://github.com/supabase/storage/issues/322). However, I'm not sure how expensive it would be for our use case.
So, how is it progressing with Cloudflare R2 @nielsbom? If it's still a bit of a journey, we could look into the cost of doing this through Supabase Storage.
To serve files from Cloudflare's R2 we need Cloudflare Workers.
I've got a minimal example of a Worker reading R2 files working. But not using Range Requests (which we need for PMTiles).
Protomaps has some example code that should just work but doesn't.
Because I need to debug that code I've been investigating Cloudflare Workers and getting a local dev environment setup for them and R2 (using Wrangler).
The Protomaps example code is bundled JavaScript. To be able to debug I need to use the TypeScript that produces that bundled JavaScript. I'm in the process of getting that working now.
I discovered that most, but not all example code that Protomaps provides uses a different setup than a "serverless" one. That was kind of confusing.
But I (finally!) got my local dev setup working, so now I can debug my locally running Cloudflare Worker with local R2. For some reason the Worker can't access the PMTiles file that R2 has/should have. But there might be a local/remote problem. Still debugging that.
As is often the case: it was a small problem, but I'm now serving the contents of a PMTiles file via Cloudflare workers:
I got stuck for a long time because I was asking for a URL ending in /0/0/0.mvt
and the PMTiles JavaScript library is not very clear in its error messages.
Next steps:
Yahoo! Thank you so much for figuring this out!
I have added you both as Admin's in the QTM Cloudflare account, you should receive emails to join shortly.
I want to add Workers and R2 to the QTM CloudFlare account, but I don't have access to those. See attached screenshots below.
I think I'd need the roles:
Cloudflare R2 Admin
Cloudflare Workers Admin
The docs for managing members' roles are here: https://developers.cloudflare.com/fundamentals/setup/manage-members/manage/
@queeringthemap can you assign me those roles? Thanks!
Hiya! I have just changed the permissions to make you a full account Admin. Let me know if this works!
Ah, next hurdle: "You do not have permission to purchase R2 on this account. Contact your Super Administrator or Billing Administrator."
https://dash.cloudflare.com/316bd8bc9db62493abfc73555426587b/r2/plans
I think the "class B operations" plan is enough, because we're not going to let users write any data into R2 from the web (except for us putting files in there).
Did a few things this morning. Will continue a little later today. Up- and downloading 110GB is a bit of a bottleneck, who knew 🤪
I've created PR #33 which makes this repo use the tiles at https://tiles.queeringthemap.com.
Closing this issue.
We want to use Protomaps to serve the tiles (#7). Given that our demand will be pretty high, we'll be beyond protomaps.com's free and by-donation tier. This means we need to set up our own server for this.
What is the cheapest and most performative way to set up a server for Protomaps? There are some details at https://docs.protomaps.com/deploy/.
Currently, @nielsbom is leading on the research and implementation of this.
Costs
Lucas said:
Putting the high-end number into Protomaps cost calculator:
Update (2024-03-26 14:50:25): It's possible we'd also need to use the "Pro" plan to use Cloudflare which is 20 USD per month (on top of the costs above).