Table of Contents
This post was originally published on reese’s oblong notes, going forward most oblong notes will most likely be published here
I’ve started working on a new engine for Rails called Active Zone that will become the backend for manipulating DNS zones & resources in Panel v2.
The idea is fairly simple, create a native API for defining zones that use an agnostic abstract provider to allow for usage with any upstream DNS provider, from an inbuilt resolver to DNSimple.
This provider system is going to work very much like Active Storage, where you specify which provider you want to use in a YAML file, and we’ll figure it out from there. Providers will implement an API somewhat akin to libdns to update resources based on the zone. I’m still working out how the resources will be matched up, where provider-specific info will be stored like IDs, etc. (the ID will be different across providers since we don’t get to specify one).
Where I’m kinda stuck at the moment is how to specify zones. The issue I’m having is that I need both statically specified root domains, and dynamically created subdomains for users. Maybe it could be that you have a singleton for the root zone, and than RootZone.new makes a subzone which is a resource collection essentially? That doesn’t feel great or super intuitive. If you have any ideas of how to sort this out, please let me know.
For the static zones, I’ve come up with this quick syntax as a idea, not tied to it, will change a ton:
class OblOngZone < ActiveZone::Base
default_ttl 300
# Active Record Migration style syntax.
resources do |r|
r.A "@" "0.0.0.0"
r.MX "@" "mail.obl.ong" 10
end
end
This file would be stored in app/zones/obl_ong_zone.rb
.
Actually, after writing this: maybe DNS migrations could be a good idea? But I kinda doubt it. Like it allows you to test things with a migration, and then push to prod
Well please let me know if you have any thoughts on this matter, I’d be happy to take any feedback!