Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale ATProto handle resolution #744

Open
3 tasks done
snarfed opened this issue Dec 7, 2023 · 24 comments
Open
3 tasks done

Scale ATProto handle resolution #744

snarfed opened this issue Dec 7, 2023 · 24 comments
Labels

Comments

@snarfed
Copy link
Owner

snarfed commented Dec 7, 2023

We need to serve ATProto handle resolution for all users bridged into ATProto (background: #381). They support both DNS and HTTPS methods, but our ATProto handles are multi-level, eg @[email protected] becomes user.mastodon.social.ap.brid.gy, and you can't make multi-level wildcard SSL certs, so HTTPS won't work, so DNS it is.

We're currently using Google Cloud DNS. It serves the entire brid.gy DNS zone, and we create _atproto records for handle resolution manually. The catch is that GCP DNS has a hard limit of 10k records per zone, which we'll likely outgrow. Grr.

We could make a zone per sub-subdomain, eg per fediverse instance, so mastodon.social.ap.brid.gy would become its own zone, but GCP DNS also has a hard limit of 10k zones total.

To do:

So, we eventually need to switch to a different programmatic DNS service or run our own DNS server. Whee.

@snarfed snarfed changed the title Scale ATProto handle resolution (whether DNS or HTTPS) Scale ATProto handle resolution Dec 7, 2023
@snarfed
Copy link
Owner Author

snarfed commented Dec 26, 2023

Upcoming option: https://dns.kitchen/ , all you can eat zones/records, $5/mo.

@snarfed
Copy link
Owner Author

snarfed commented Feb 10, 2024

@neatnik mentioned https://desec.io/ too.

@snarfed
Copy link
Owner Author

snarfed commented Feb 11, 2024

@snarfed
Copy link
Owner Author

snarfed commented Feb 12, 2024

Maybe obsoleted by #830 🤞

@snarfed
Copy link
Owner Author

snarfed commented Apr 9, 2024

...nope, turns out #830 probably won't work after all, so this issue definitely still applies.

@snarfed
Copy link
Owner Author

snarfed commented Apr 16, 2024

The 10k limit in Google Cloud DNS is a quota, rrsetsPerManagedZone, that I can request an increase for. May try that.

@snarfed
Copy link
Owner Author

snarfed commented May 5, 2024

Tried requesting a quota bump. 🤞

@snarfed
Copy link
Owner Author

snarfed commented May 5, 2024

In unrelated very good news, @bnewbold built us a whole new microservice to solve this! bluesky-social/atproto#1697 (comment) . Extremely generous of him. Thank you Bryan!!!

@snarfed
Copy link
Owner Author

snarfed commented May 7, 2024

More good news, I asked for a GCP DNS quota bump to 50k and got it. Woo!

@snarfed snarfed removed the now label May 9, 2024
@snarfed snarfed added now infra and removed now labels May 19, 2024
@snarfed
Copy link
Owner Author

snarfed commented Jul 26, 2024

We're currently at 6500 DNS records, with the limit still at 50k. We'll (hopefully) still need to figure this out eventually, but it seems like we have plenty of time.

@snarfed
Copy link
Owner Author

snarfed commented Nov 12, 2024

Count is 28k now! Out of quota of 50k. 😳 I think a decent number of those are disabled, many but not all from Flipboard.

@snarfed
Copy link
Owner Author

snarfed commented Nov 25, 2024

37k DNS records now! Time to get serious about this.

@louis-lau
Copy link

louis-lau commented Nov 25, 2024

I have no idea what this software is, but stumbled across this issue while researching secondary dns providers. :)

Given the programmatic nature of these records, maybe you'd be better off with something like powerdns with the remote backend?
https://doc.powerdns.com/authoritative/backends/remote.html

Or if you need a managed service, Bunny DNS?
https://bunny.net/dns/

You'd never run into record limitations, as the responses are just created on the fly.

@bnewbold
Copy link

bnewbold commented Nov 25, 2024

Here is a direct link to handlr, the DNS proxying service I wrote:

bluesky-social/indigo#665

it hasn't been reviewed or merged to main branch yet. If I get a chance I can respond to things and try to get it merged, but may or may not be responsive about updating/maintaining it. If bridgy ends up depending on it, might be worth pulling the code out in to a separate repo? I wrote this in spare time and am flexible/amenable to basically any license on the code. Or you could re-write in python for something more familiar/maintainable.

(bumping quota is probably the near-term solution though?)

@shiribailem
Copy link

Just chiming in here as it's related to another I just added a comment to... Have you considered just running your own nameserver?

This would both mean no limits and faster updates as records change among other possible gains?

@snarfed
Copy link
Owner Author

snarfed commented Nov 26, 2024

@shiribailem yes! Definitely considered that, hence "or run our own DNS server" in the original description here. It would mean no limits and faster updates, but it would also mean running and maintaining our own nameserver. One more level of admin cost and risk. Whee.

But yeah we may end up doing that regardless, esp since @bnewbold built us one! #744 (comment)

@shiribailem
Copy link

I mean the good news is that nameservers are very very low requirements on resources, performance, and effort, even for security.

The worst risk is the fully custom service vs just using internal APIs/config-files to update zones on an established DNS server.

Given that DNS isn't a big attack surface compared to the entire bridge software itself, I wouldn't stress as much over that.

@snarfed
Copy link
Owner Author

snarfed commented Nov 28, 2024

#1268 and #1458 have been productive here, we've already reclaimed more than 12k DNS records, down to just 25k now and still shrinking.

@snarfed
Copy link
Owner Author

snarfed commented Nov 28, 2024

Done! Reclaimed ~13.5k total, currently at 24.5k out of 50k quota.

@snarfed
Copy link
Owner Author

snarfed commented Nov 28, 2024

Requested a quota bump to 200k. 🤞

@shiribailem
Copy link

just randomly thinking... have you considered stripping periods from the converted usernames? That would make it trivial to switch to HTTPS resolution... Sadly that's something that would be easier at the beginning of the project before you had thousands of users, but I could still see it working.

If you did that, I'd probably leverage the code for setting custom domains and just convert all existing listings to custom domains (which would otherwise leave them unchanged). From there you could just use HTTPS verification going forward.

@snarfed
Copy link
Owner Author

snarfed commented Nov 29, 2024

@shiribailem we have, #744 (comment), #830

@snarfed
Copy link
Owner Author

snarfed commented Dec 4, 2024

Holy crap, they gave us the quota bump to 200k records! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants