milestone 20: declarative configuration for iac
This commit is contained in:
+19
-9
@@ -41,10 +41,9 @@ Do not create `/var/lib/nxdns` or `/var/log/nxdns` by hand. The unit's
|
||||
`StateDirectory` and `LogsDirectory` settings make systemd create them on first
|
||||
start, `/var/lib/nxdns` at mode 0700 owned by `nxdns`.
|
||||
|
||||
## 2. Write the seed configuration
|
||||
## 2. Write the configuration
|
||||
|
||||
nxdns starts from an empty database only if a configuration file tells it what
|
||||
to forward to. Write `/etc/nxdns/config.zon`:
|
||||
nxdns will not start with nothing to forward to. Write `/etc/nxdns/config.zon`:
|
||||
|
||||
```zon
|
||||
.{
|
||||
@@ -76,16 +75,27 @@ A good file ends with `OK: no problems found`. Exit 2 means `check` found
|
||||
something to fix and printed every problem it found. The upstream probe sends a
|
||||
real query, so this needs working DNS on the host.
|
||||
|
||||
The file seeds the database once. From the second start onwards it is ignored
|
||||
and the database is the configuration. The seed's `web.password` is hashed at
|
||||
import time and the plaintext is never stored, so once you have logged in you
|
||||
can delete the file:
|
||||
Load it into the database:
|
||||
|
||||
```sh
|
||||
nxdns import /etc/nxdns/config.zon
|
||||
```
|
||||
|
||||
The packaged unit runs `nxdns run` with no `--config`, so from here the database
|
||||
is the configuration and nothing reads the file again. `web.password` is hashed
|
||||
and the plaintext is never stored, so once you have logged in you can delete the
|
||||
file:
|
||||
|
||||
```sh
|
||||
rm /etc/nxdns/config.zon
|
||||
```
|
||||
|
||||
A kept seed is not a backup. `nxdns export` is.
|
||||
A kept file is not a backup. `nxdns export` is.
|
||||
|
||||
To keep the file as the configuration instead — converged at every start, with
|
||||
the UI refusing configuration edits — do not delete it, and add a drop-in that
|
||||
appends `--config=/etc/nxdns/config.zon` to `ExecStart`. See
|
||||
`docs/how-to/install-with-systemd.md`.
|
||||
|
||||
## 3. Start it
|
||||
|
||||
@@ -107,7 +117,7 @@ dig @<server-ip> example.com A +short
|
||||
```
|
||||
|
||||
The admin interface is on port 8080 by default; log in with the password from
|
||||
the seed file. `http://<server-ip>:8080/api/health` reports upstream
|
||||
the configuration file. `http://<server-ip>:8080/api/health` reports upstream
|
||||
availability and disk state without a login.
|
||||
|
||||
## More
|
||||
|
||||
Reference in New Issue
Block a user