Skip to content

feat(packaging): ship annotated config reference and align with install docs#242

Open
linkdata wants to merge 2 commits into
mainfrom
comply-techdocs-install
Open

feat(packaging): ship annotated config reference and align with install docs#242
linkdata wants to merge 2 commits into
mainfrom
comply-techdocs-install

Conversation

@linkdata

@linkdata linkdata commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Aligns this repo with the canonical install guide at
https://dnstapir.github.io/techdocs/installation.html. The packaging mechanics
(binary path, systemd unit, system user/group, /var/lib/dnstapir/edm,
make deb, Copr via .copr/Makefile, MQTT/HTTPS/Crypto-PAn config) were already
compliant; this closes the remaining gaps around the operator-edited config file
and the repo docs.

Changes

  • dnstapir-edm.toml.sample — rewritten from a one-line stub into a complete
    annotated reference. It marks the two edit points the guide calls out (the
    Crypto-PAn secret and the DNSTAP interface), shows input-tcp as the
    resolver-over-network option that matches Unbound's dnstap-ip: <IP>@<PORT>,
    and documents the full MQTT + HTTPS-to-Core surface, all with absolute
    /etc/dnstapir/edm/... paths.
  • Both packages now ship it as /etc/dnstapir/dnstapir-edm.toml.sample
    (Makefile deb/srpm targets + rpm/dnstapir-edm.spec.in Source6 /
    %install / %files). The live /etc/dnstapir/dnstapir-edm.toml stays
    %ghost since it is generated by dnstapir-cli enroll.
  • dnstapir-edm.service — added WorkingDirectory=/etc/dnstapir/edm so the
    relative default file paths (well-known-domains.dawg, MQTT/HTTP cert+key
    files) resolve to the shipped files instead of against /.
  • README.md — added an Installation section linking the techdocs and the
    deb/Copr flow, plus an input-tcp note in the usage example.
  • pkg/runner/config_sample_test.go (new) — loads the shipped sample through
    the real config loader. Because the loader rejects unknown keys and runs
    Config.Validate, this fails if the sample drifts from Config (stale key,
    missing required value, wrong input count).

Verification

  • go test -race ./... passes, including the new sample test.
  • Lint gate clean: gofumpt -l, go vet, golangci-lint (0 issues),
    staticcheck, gosec (0 issues), go build ./....
  • make deb produces a package containing /etc/dnstapir/dnstapir-edm.toml.sample
    with the unit carrying WorkingDirectory=/etc/dnstapir/edm.
  • RPM path verified by inspection only (no rpmbuild on the build host); the spec
    change mirrors the existing Source2Source5 pattern and is exercised by the
    unchanged .copr/Makefile.

Note: inaccuracies in the techdocs install page (for the dnstapir/techdocs repo)

These are doc-side issues found while doing this work; they are not addressed
here but are worth correcting in https://github.com/dnstapir/techdocs:

  1. The Unbound DNSTAP example annotates dnstap-ip: <IP>@<PORT> with
    [must match dnstapir-edm.yaml], but EDM uses TOML — it should read
    dnstapir-edm.toml.
  2. The page lists dnstapir-edm.toml directly under /etc/dnstapir, while EDM's
    other assets (well-known-domains.dawg, ignored.dawg, ignored-ips) live
    under /etc/dnstapir/edm/. A one-line clarification would avoid confusion
    about which files go where.
  3. (Minor) The RPZ/DNSTAP "must match" cross-references point at the pop/edm
    config files; once item 1 is fixed it would help to name the exact keys
    (input-tcp on the EDM side) so operators can line them up with the resolver.

Summary by CodeRabbit

  • Documentation

    • Expanded README with installation artifact locations and configuration generation guidance
    • Added network DNSTAP input usage examples and configuration options documentation
  • Configuration

    • Sample configuration file significantly expanded with comprehensive documentation, default values, and placeholder settings for all supported features
  • Packaging

    • Sample configuration file now included in installation packages for reference

…ll docs

The techdocs installation guide treats /etc/dnstapir/dnstapir-edm.toml as a
file the operator annotates in two places (the Crypto-PAn secret and the
DNSTAP interface), but the repo shipped no annotated reference and the
.toml.sample only set cryptopan-key.

- Rewrite dnstapir-edm.toml.sample into a complete annotated reference: both
  documented edit points, input-tcp matching the resolver example, and the
  MQTT/HTTPS-to-Core surface, all with absolute /etc/dnstapir/edm paths.
- Install it as /etc/dnstapir/dnstapir-edm.toml.sample from both the deb and
  rpm packages; the live toml stays %ghost (generated by dnstapir-cli enroll).
- Set WorkingDirectory=/etc/dnstapir/edm in the systemd unit so relative
  default file paths resolve to the shipped files.
- Add an Installation section and an input-tcp usage note to the README.
- Add a test that loads the shipped sample through the real config loader,
  guarding it against drift from Config.
@linkdata
linkdata requested a review from a team as a code owner June 23, 2026 07:09
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@linkdata, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 55 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf7942e1-cb02-425d-afad-3b470f450768

📥 Commits

Reviewing files that changed from the base of the PR and between 45aefc7 and ff03ba4.

📒 Files selected for processing (1)
  • dnstapir-edm.toml.sample
📝 Walkthrough

Walkthrough

The dnstapir-edm.toml.sample file is replaced with a full annotated reference configuration covering all major settings. A new test validates the sample parses and satisfies config rules. Packaging targets in the Makefile, RPM spec, and the systemd unit are updated to include the sample file. README docs are expanded with installation details and TCP input guidance.

Changes

Sample Config, Validation, Packaging, and Docs

Layer / File(s) Summary
Expanded annotated sample TOML config and validation test
dnstapir-edm.toml.sample, pkg/runner/config_sample_test.go
dnstapir-edm.toml.sample is replaced with a complete annotated reference covering Crypto-PAn, DNSTAP input transport, well-known domains, data-dir, MQTT, HTTPS histogram upload, and tuning options. A new test loads the sample via NewFileConfigProvider and asserts required fields (CryptopanKey, InputTCP) and that DisableMQTT/DisableHistogramSender remain false by default.
Package sample config into RPM and Debian artifacts
Makefile, rpm/dnstapir-edm.spec.in, rpm/SOURCES/dnstapir-edm.service
Makefile clean/srpm/deb targets are updated to copy dnstapir-edm.toml.sample into rpm/SOURCES/ and deb/etc/dnstapir/. The RPM spec adds Source6, installs the file into %{_sysconfdir}/dnstapir/, and adds a %files entry with root:root ownership. The systemd unit gains WorkingDirectory=/etc/dnstapir/edm.
README installation and TCP input documentation
README.md
Installation section is expanded with package install artifacts, dnstapir-cli enroll workflow, and make deb/Copr build commands. A new Usage subsection documents --input-tcp <IP>:<PORT> for network DNSTAP reception and the mutual exclusivity of input-unix, input-tcp, and input-tls.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • dnstapir/edm#68: Introduced the RPM packaging Makefile/spec/service groundwork that this PR extends with the new dnstapir-edm.toml.sample source.
  • dnstapir/edm#115: Introduced/renamed rpm/SOURCES/dnstapir-edm.service, the same unit file this PR updates with WorkingDirectory.
  • dnstapir/edm#123: Added the Debian deb build/cleanup scaffolding in the Makefile that this PR extends to install dnstapir-edm.toml.sample.

Poem

🐇 Hop hop, a config so bare no more,
Full of comments and secrets in store!
Packaged in RPM, tucked in deb too,
The systemd unit knows just where to go through.
Tests confirm every field is just right —
A sample worth shipping, from morning to night! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: shipping an annotated config reference and aligning documentation with installation guides.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@linkdata linkdata added the ai AI was used to write contributed code label Jun 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dnstapir-edm.toml.sample`:
- Around line 9-12: The comment on line 9 of the sample configuration file
misleadingly states that every shown value is a built-in default, but several
path values are actually absolute path equivalents that have been normalized via
the WorkingDirectory setting mentioned on line 11, rather than the literal
relative defaults used in DefaultConfig. Revise the wording to clarify this
distinction, either by changing "built-in default" to "default-equivalent
values" or by explicitly noting that relative paths in the defaults are shown
here as absolute paths due to WorkingDirectory resolution. This will prevent
confusion when comparing the sample configuration to the actual DefaultConfig
implementation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e91c4d47-b5d9-4fc6-81ea-afe4d28ed425

📥 Commits

Reviewing files that changed from the base of the PR and between 63aad07 and 45aefc7.

📒 Files selected for processing (6)
  • Makefile
  • README.md
  • dnstapir-edm.toml.sample
  • pkg/runner/config_sample_test.go
  • rpm/SOURCES/dnstapir-edm.service
  • rpm/dnstapir-edm.spec.in

Comment thread dnstapir-edm.toml.sample Outdated
The header claimed every value was a built-in default, but the two EDIT
points are placeholders and the file paths are shown as absolute package
locations while DefaultConfig uses relative names. Reword to match.

@linkdata linkdata left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@linkdata

Copy link
Copy Markdown
Contributor Author

@zluudg I can haz review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai AI was used to write contributed code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant