DNSControl Setup
exported directly from my Logseq graph cuz I’m lazy.
- Setting up DNSControl
- Referrences
- Troubleshooting
- Complained on Fedi…
- Setup
- Install DNSControl
- via Homebrew, on macOS
brew install StackExchange/tap/dnscontrol - download pre-built binary see releases
- via Homebrew, on macOS
- Set up Git repository for configuration files
mkdir dns && cd dnsgit initnvim creds.json- For Cloudflare credentials
{ "cloudflare": { "TYPE": "CLOUDFLAREAPI", "accountid": "$CLOUDFLARE_ACCOUNT_ID", "apitoken": "$CLOUDFLARE_API_TOKEN" } } - It can read from enviroment variables, as long as it start with a
$
- For Cloudflare credentials
nvim dnsconfig.js- Don’t type
dnscontrol.js… I made that mistake - Set up registrar (
noneis OK) and DNS provider (Cloudflare in this case)var REG_NONE = NewRegistrar("none"); var DSP_CLOUDFLARE = NewDnsProvider('cloudflare'); - Use
D()to add domain.D("example.com", REG_NONE, DSP_CLOUDFLARE, ...)
- Don’t type
- Get existing DNS records in JavaScript
- use
dnscontrol get-zonednscontrol get-zone --format=js -out=draft.js "cloudflare" "CLOUDFLAREAPI" "geedea.pro" dnscontrol get-zone --format=js -out=draft.js "cloudflare" "CLOUDFLAREAPI" "eltr.ac" - copy the content from
draft.jstodnsconfig.js, and modify it correctly
- use
- Preview and push
dnscontrol previewdnscontrol push
- Set up automatic workflow (with Forgejo Action)
name: Push on: push: branches: - master jobs: push: runs-on: docker steps: - uses: actions/checkout@v3 - name: Install and Push env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} run: | curl -sL https://github.com/StackExchange/dnscontrol/releases/download/v4.36.1/dnscontrol_4.36.1_linux_amd64.tar.gz | tar xz ./dnscontrol push
- Install DNSControl
2026-03-13