# Deployment ## Installing from repo.linuxiarz.pl Signed packages for Debian/Ubuntu, RHEL/Alma/Rocky and SUSE (amd64) are built from https://git.linuxiarz.pl/gru/EasyDNS and published on https://repo.linuxiarz.pl. ```bash # Debian / Ubuntu curl -fsSL https://repo.linuxiarz.pl/repo-key.gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/linuxiarz.gpg echo "deb [signed-by=/usr/share/keyrings/linuxiarz.gpg] https://repo.linuxiarz.pl/apt stable main" \ | sudo tee /etc/apt/sources.list.d/linuxiarz.list sudo apt update && sudo apt install easydns # RHEL / Alma / Rocky sudo rpm --import https://repo.linuxiarz.pl/repo-key.gpg sudo curl -fsSL -o /etc/yum.repos.d/linuxiarz.repo https://repo.linuxiarz.pl/linuxiarz.repo sudo dnf install easydns # SUSE / openSUSE sudo rpm --import https://repo.linuxiarz.pl/repo-key.gpg sudo zypper addrepo --refresh --gpgcheck https://repo.linuxiarz.pl/suse/x86_64/ linuxiarz sudo zypper install easydns ``` ## After installing the package The service is not started automatically (port 53 is often in use, see below). ```bash sudo easydns zone create example.com --ns ns1.example.com=192.0.2.10 --ip 192.0.2.80 sudo systemctl enable --now easydns sudo easydns status # no key to generate or pass easydig @127.0.0.1 example.com SOA +short ``` The package installs the default hybrid configuration (`/etc/easydns/config.yaml`: `0.0.0.0:53` + `[::1]:53`, recursion for `192.168.0.0/16`, `10.0.0.0/8`, `127.0.0.1`), creates `/etc/easydns/{zones.d,keys.d,data/zones}` and the `easydns` user. Layout: [configuration.md](configuration.md#default-installation-layout). Example configurations are in `/usr/share/doc/easydns/examples/`. ### Port 53 and systemd-resolved The default `0.0.0.0:53` cannot be bound while another service holds any address on port 53 – including the `127.0.0.53:53` stub of systemd-resolved (Ubuntu, Fedora, some Debian installs); the server then stops with `Address already in use`. Either turn the stub off and let the host use EasyDNS: ```bash sudo install -d /etc/systemd/resolved.conf.d printf '[Resolve]\nDNSStubListener=no\nDNS=127.0.0.1\n' | sudo tee /etc/systemd/resolved.conf.d/easydns.conf sudo systemctl restart systemd-resolved sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf ``` or list concrete addresses in `server.listen` (for example `["192.0.2.53:53", "127.0.0.1:53"]`), which do not collide with `127.0.0.53`. dnsmasq, BIND or Unbound on port 53 must be stopped or moved the same way. Check what holds the port: `sudo ss -lntup 'sport = :53'`. ## Upgrading the package (keeping your configuration) ```bash sudo tar czf /root/easydns-backup-$(date +%F).tgz /etc/easydns # config, zones, keys, data sudo apt update && sudo apt install -o Dpkg::Options::=--force-confold easydns # RHEL: sudo dnf upgrade easydns SUSE: sudo zypper update easydns ``` * `/etc/easydns/config.yaml` and `root.hints` are conffiles: `--force-confold` keeps your version without asking; the new default is saved next to it as `config.yaml.dpkg-dist` (without the option dpkg asks – answer **N** to keep yours). RPM keeps a modified file and writes the new default as `config.yaml.rpmnew`. * Files in `zones.d/`, `keys.d/` and `data/` are never touched by the package. * A running server is restarted only if the new version accepts the configuration (`easydns check-config` as the `easydns` user); otherwise the old version keeps running and the reason is in `/tmp/easydns-upgrade-check.log`. * Secondary zone copies from older versions (`data/secondary/`) are moved automatically to `data/zones/secondary/` on the first start, so zones are served immediately. * After the upgrade: `sudo easydns check-config`, `journalctl -u easydns -n 50`, and query a few zones (`easydig @127.0.0.1 example.com SOA +short`). ## systemd (manual installation) ```bash sudo useradd --system --home /etc/easydns/data --shell /usr/sbin/nologin easydns sudo deploy/install.sh /usr # binaries (+ short tool names when free) sudo install -d -o root -g easydns -m 0750 /etc/easydns /etc/easydns/zones.d /etc/easydns/keys.d sudo install -d -o easydns -g easydns -m 0750 /etc/easydns/data /etc/easydns/data/zones sudo install -m 0640 -g easydns config/config.yaml /etc/easydns/config.yaml # or config/primary.yaml, secondary.yaml, … sudo cp deploy/systemd/easydns.service /etc/systemd/system/ sudo systemctl daemon-reload && sudo systemctl enable --now easydns sudo systemctl reload easydns # hot reload (SIGHUP) ``` Secrets for `env:` references (optional) go to `/etc/easydns/easydns.env` (mode 0640). Block list updates: `deploy/systemd/easydns-blocklists.{service,timer}`. ## Docker `docker compose up -d` builds `deploy/docker/Dockerfile` (multi-stage, Debian slim, non-root, `CAP_NET_BIND_SERVICE` only, read-only root). Mount `./config` to `/etc/easydns` and keep `/etc/easydns/data` on a volume. Multi-arch: `docker buildx build --platform linux/amd64,linux/arm64 -f deploy/docker/Dockerfile .` ## Ports 53/udp+tcp (DNS), 853/tcp (DoT, optional), DoH port as configured (e.g. 443), 9953 API (loopback) and 9090 metrics on loopback by default. Do not expose the API, metrics or recursion to the Internet without explicit ACLs and TLS (reverse proxy). ## Building packages yourself The official packages come from repo.linuxiarz.pl (see above). To build locally: `scripts/build-deb.sh [--arch amd64,arm64] [--debian bookworm] [--revision N] [--test]` builds `dist/easydns_-_.deb` entirely inside Docker (`deploy/docker/Dockerfile.deb`, control/maintainer scripts in `deploy/packaging/debian/`); `--test` installs the package in a clean container and runs a smoke query. The package installs a `easydns` system user, the systemd units, `/etc/easydns/config.yaml` (conffile), man page, completions, and creates short tool names only where they are free. `deploy/release.sh` builds x86_64/aarch64 archives with SHA256SUMS; `deploy/packaging/nfpm.yaml` builds .deb/.rpm (`nfpm pkg -p deb|rpm`). `cargo install --path crates/dns-cli` and `--path crates/dns-tools` work too. `easydns --version` prints version and commit. ## Backup / restore / upgrade * Back up `/etc/easydns` – one directory holds everything: config, `zones.d/`, `keys.d/` (secrets!) and `data/` (zone files, snapshots, journals, signed zones, audit log). * Purging the package never deletes `/etc/easydns` (your zones and keys). * Restore: put the directories back and start; secondaries re-validate EXPIRE on startup. * Upgrades are in place; formats are versionless/forward-tolerant (zone files, JSON lines). Rollback = previous binary + the same directories. A corrupt journal is truncated automatically (IXFR then falls back to AXFR).