Mitch's Blog

DNS Management with LuaDNS

Last modified August 12, 2024

Managing DNS records can be a pain, especially once you’re juggling multiple domains and setting up different services and email support for each of them.

In the past, my setup was a mess:

This has worked alright for my purposes. Cloudflare is free to use for their basic DNS service, has a nice GUI for managing records and is well supported by dynamic DNS updating apps to keep my self-hosted services reachable through the internet.

However, this setup had some drawbacks.

The management was slightly improved by transferring the domain at Namecheap to Porkbun so that was my sole domain registrar, followed by Porkbun adding an API for managing DNS programmatically. In theory, this would make managing records with Porkbun easier (although scripts or tooling would still need to be made for creating and updated records).

DNS Management

With all that laid out, I’ve been looking for a better way to manage DNS records with less manual work involved and to have some source of truth for them that’s not in a web GUI somewhere.

Evaluating a bunch of options, a couple among them being DNSimple, No-IP, and FreeDNS, none seemed to offer compelling features over sticking with Cloudflare and Porkbun. Factoring in price after the free tiers for these services also made them tough to go with.

Ultimately the one I’ve landed on that has the features I want, at the price point I’m good with, is LuaDNS.

Killer features include:

Using LuaDNS

After creating an account and logging in, you’ll be greeted by a simple but functional dashboard:

LuaDNS dashboard


Your Zones page is where you can add your sites and records via the UI:

LuaDNS zones page

LuaDNS records for a single domain


The last bit in the UI that’s interesting (aside from your Profile settings page that contains about what you’d expect) is the ability to create your own templates which are a way to define a batch of records to quickly get a new site up and running with some common configuration.

LuaDNS template example


However, the goal here is to not ever need to use the website to add sites and records.

Instead, it’s possible to set up Git integration where you can follow a setup wizard that walks you through adding a Git repository you have access to, adding a build key for LuaDNS to access it (if it’s not public), and setting up a webhook so that on a push of your code it triggers LuaDNS to build and update your records

LuaDNS profile settings page


Now, managing zones and records via the UI isn’t possible in favor of using files in your Git repository like the docs spell out.

For example, I can create a file in my repository named fossen.sh.lua with the contents:

a("foo", "192.0.2.3", 900)
cname("www", "_a", 900)
redirect("dev", "https://fossen.dev", 0)
redirect("app", "https://fossen.dev", 0)

which ends up looking like:

LuaDNS records generated from git

Build success or failure messages are delivered by email, in my experience they arrive a couple seconds after pushing the updated file to your Git repository.

Likewise, adding a new zone is as easy as creating a file named mydomain.tld.lua and running git add . ; git commit ; git push and it will show up in the LuaDNS Zones page in seconds.

Conclusion

Overall, I’ve been pleased with the experience LuaDNS offers while I’ve been experimenting with it.

No-nonsense, no-frills DNS management that has a clean UI, reasonable cost for the higher tier of service with no “gotchas”, and the killer feature of simple and easy management of domains using Git repos.

Coming up, I plan to move all DNS management of my domains to LuaDNS and in doing so, transition from the mess of manual record management I use currently to the bliss of DNS-as-code that LuaDNS allows.


Tags