Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

kamilchm/nixops-dns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

NixOps-DNS

DNS server for resolving NixOps machines.

Why

When using NixOps you could easily spawn clusters of machines using VirtualBox or any cloud provider. Machines from the same deployment use their names for network connections.

It's useful to access same names locally from the node where NixOps was run.

How

NixOps-DNS listens for DNS queries on 127.0.0.1:5300. It looks into NixOps state file and returns machine IP if there is corresponding entry.

Installation

NixOps-DNS is built with Go and you can install it by doing:

$ go get github.com/kamilchm/nixops-dns

You can then run it:

$ nixops-dns

Try it!

There's simple example of running multiple machines in NixOps manual.

Run it, start nixops-dns and you should be able to resolve NixOps machine names:

$ dig +short proxy @127.0.0.1 -p 5300
192.168.56.103
$ dig +short backend1 @127.0.0.1 -p 5300
192.168.56.101
$ dig +short backend2 @127.0.0.1 -p 5300
192.168.56.102

System wide NixOps-DNS

The simplest way of using NixOps-DNS from any program (terminal, chrome, firefox ...) is to add it to DNSMASQ config:

server=/./127.0.0.1#5300

Fake domains

NixOps-DNS can translate fake development domains like .dev or .ops if you want to use it along with other DNS servers and route only part of the queries to it.

Start NixOps-DNS with the domain switch:

nixops-dns -domain=.ops

Modify DNSMASQ config:

server=/ops/127.0.0.1#5300

and you can query NixOps machines under .ops domain:

$ dig +short proxy.ops
192.168.56.103