Skip to content

Keep your DNS records synchronized automatically with this extensible DNS updater, featuring easy configuration and containerized deployment.

License

Notifications You must be signed in to change notification settings

OrKarstoft/dns-updater

Repository files navigation

dns-updater

A lightweight DNS record updater that supports multiple DNS providers (DigitalOcean and Google Cloud Platform) to automatically update DNS records with your current public IP address.

Features

  • Supports multiple DNS providers:
    • DigitalOcean DNS
    • Google Cloud Platform DNS
  • Automatic IP address detection
  • Docker support with minimal secure image
  • Configurable updates for multiple domains and records
  • YAML-based configuration

Installation

Using Docker (Recommended)

Pull the latest version from GitHub Container Registry:

docker pull ghcr.io/orkarstoft/dns-updater:latest

From source

  1. Clone the repository:
git clone https://github.com/orkarstoft/dns-updater.git
cd dns-updater
  1. Build the binary:
go build -o dnsupdater cmd/main.go

Configuration

Create a config.yaml file with your DNS provider credentials and update configuration:

DigitalOcean Example:

doToken: "your-digitalocean-api-token"
updates:
  - domain: "example.com"
    zone: "example.com"
    records: 
      - "www"
      - "@"
    type: "A"

Google Cloud Platform Example:

gcp:
  credentialsFile: "/path/to/credentials.json"
  projectId: "your-project-id"
updates:
  - domain: "example.com"
    zone: "example-com"
    records: 
      - "www"
      - "@"
    type: "A"

Usage

Running with Docker

docker run -v /path/to/config.yaml:/config.yaml ghcr.io/orkarstoft/dns-updater:latest

For GCP authentication, mount your credentials file:

docker run -v /path/to/config.yaml:/config.yaml \
          -v /path/to/credentials.json:/credentials.json \
          ghcr.io/orkarstoft/dns-updater:latest

Running from binary

./dns-updater

Development

Prerequisites

  • Go 1.23 or higher
  • Docker (for container builds)

Building

Build the binary:

go build -o dnsupdater cmd/main.go

Build the Docker image:

docker build -t dns-updater .

Testing

go test ./...

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Security

  • The Docker image runs as a non-root user
  • Credentials should be properly secured and never committed to version control
  • For production use, store sensitive configuration in secure locations

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Uses the godo client for DigitalOcean API
  • Uses the Google Cloud DNS API for GCP integration

About

Keep your DNS records synchronized automatically with this extensible DNS updater, featuring easy configuration and containerized deployment.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages