Skip to content

anvilcomputing/anvil-dns

Repository files navigation

Anvil DNS Manager

Go Version NixOS License

A modular, Go-based application for managing Cloudflare DNS records for anvilcomputing.com.

Packaged declaratively using NixOS Flakes for deployment to Proxmox VE LXC containers, this tool provides both a Command Line Interface (CLI) and a data-dense Web Admin Dashboard. It is designed to quickly provision unproxied A records that point to a VPS running a reverse proxy, prevent naming collisions, and provide simple commands to audit and clean up your Cloudflare zone.

✨ Features

  • Dual Interfaces: Manage DNS via the terminal or a data-dense, filtering-enabled web dashboard.
  • Collision Prevention: Automatically checks if a subdomain exists before provisioning.
  • Interactive Auditing: Instant client-side filtering (Web) to easily audit existing records.
  • Declarative Infrastructure: The entire OS, networking (Tailscale), SSH configuration, and Go application are built into a single, reproducible Proxmox LXC template via flake.nix.
  • GitOps Ready: Continuous deployment over SSH using deploy-rs.

🚀 1. Prerequisites (For Admins)

  1. A Cloudflare API Token with the following permissions:
    • Zone -> DNS -> Edit
    • Zone Resources: Include -> Specific Zone -> anvilcomputing.com
  2. Nix installed locally with Flakes enabled.
  3. A Proxmox VE cluster.

🛠️ 2. Initial Proxmox LXC Deployment

This process only needs to be done once to seed the initial container.

Step 2.1: Build the Template

Run this command locally to compile the Go application and the entire NixOS operating system into a single Proxmox template:

nix build .#lxc-template

Check availability

go run cmd/cli/main.go check

Provision a new record

go run cmd/cli/main.go create --target-ip <VPS_IP>

Audit records (Paginated)

go run cmd/cli/main.go list

Delete a record

go run cmd/cli/main.go delete


🌐 Usage: Web Admin Dashboard

The Web Admin provides a responsive, data-dense UI to perform the same actions as the CLI. It runs a lightweight HTTP server on port 8081.

go run cmd/web/main.go

Once running, open your browser and navigate to: http://localhost:8081

Web Features:

  • Create records using a simple form.
  • Instantly filter active subdomains by Name or Record Type without page reloads.
  • Delete records with one click (includes safety confirmations).
  • No horizontal scrolling; optimized for desktop data density.

📂 Project Structure

anvil-dns/
├── cmd/
│   ├── cli/              # The CLI interface (Cobra/Viper)
│   └── web/              # The Web Admin interface (net/http, html/template)
│       ├── main.go
│       └── index.html
├── internal/
│   └── cloudflare/       # Shared Core API logic
├── go.mod
└── go.sum

🗺️ Future Enhancements

  • web Interface (Admin UI): Create a lightweight, data-dense HTML frontend.
  • NixOS & Proxmox Packaging:
    • Add a flake.nix to package the Go binaries.
    • Create a declarative NixOS LXC configuration for Proxmox.
    • Implement sops-nix for secure, encrypted Cloudflare API token management.
    • Enable continuous deployment via deploy-rs.
  • api Interface: Add cmd/api/main.go to expose the core logic as a REST/Webhook interface for CI/CD automation agents.
  • Cloudflare Proxy Support: Add a flag/toggle to optionally enable the Cloudflare proxy ("orange cloud").

About

Tool for helping manage Cloudflare DNS. Allows for LIST, CHECK, DELETE, and CREATE functions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors