Setup redundant DNS with AdGuard Home Sync - #173
Conversation
WalkthroughThe changes introduce new environment variables for secondary node configuration and local credentials, add a new AdGuard Home synchronization service using Docker Compose, update service states, and enhance environment variable masking logic in a Python script. Comments and best practices are also updated in configuration files, with no changes to application control flow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (5)
docker/infra/adguardhome.yaml (2)
3-7: Fix YAML lint issue (trailing spaces) and a typo in comments.Yamllint flags trailing spaces at Line 3; also fix “alow” -> “allow”.
-# To fix "listen tcp4 0.0.0.0:53: bind: address already in use" error on Ubuntu: disable `DNSStubListener` (see Ansible). -# Follow the AdguardHome installation wizard for first-time configuration. (Note: Firefox may not alow access to the admin interface) +# To fix "listen tcp4 0.0.0.0:53: bind: address already in use" error on Ubuntu: disable `DNSStubListener` (see Ansible). +# Follow the AdguardHome installation wizard for first-time configuration. (Note: Firefox may not allow access to the admin interface)
31-31: Optional: Restrict the admin UI port or rely solely on Traefik.You can bind 3000 to LOCAL_NODE_IP (or remove it) if Traefik fronts the UI to reduce exposure.
# Option A (restrict to local IP): - "3000:3000/tcp" + "${LOCAL_NODE_IP}:3000:3000/tcp" # Option B (remove mapping if only Traefik is used): # - 3000:3000/tcpconfig-example/docker/myhost/.env (1)
40-42: Reorder ADGUARDHOME_ keys to satisfy dotenv-linter UnorderedKey rule.*Keep quotes if that’s your convention; just reorder PASSWORD before USERNAME.
-ADGUARDHOME_USERNAME="use-some-very-secure-value-here" -ADGUARDHOME_PASSWORD="use-some-very-secure-value-here" +ADGUARDHOME_PASSWORD="use-some-very-secure-value-here" +ADGUARDHOME_USERNAME="use-some-very-secure-value-here"docker/infra/adguardhome-sync.yaml (2)
22-27: Quote URL environment values to avoid YAML parsing edge casesUnquoted URLs can trip linters or tooling (because of colon and
${...}expansion). Quote them for robustness.- ORIGIN_URL: http://${MAIN_NODE_IP}:3000 + ORIGIN_URL: "http://${MAIN_NODE_IP}:3000" - REPLICA1_URL: http://${SECOND_NODE_IP}:3000 + REPLICA1_URL: "http://${SECOND_NODE_IP}:3000"
12-12: Verify Docker Compose version for top-levelname:We weren’t able to run
docker compose versionin the sandbox (Docker isn’t installed), so please confirm your deployment environments support Docker Compose V2.20+ if you intend to keep the top-levelname:field. If any environment uses an older version, remove thename:line and define the project name via theCOMPOSE_PROJECT_NAMEenvironment variable instead.• File: docker/infra/adguardhome-sync.yaml
Line 12 –name: adguardhome-syncSuggested fallback patch:
- name: adguardhome-syncThen in your environment (e.g.,
.env, CI):COMPOSE_PROJECT_NAME=adguardhome-syncPlease verify your Compose versions across all environments. Let me know if you’d like a patch that removes the
name:field and adds documentation for usingCOMPOSE_PROJECT_NAME.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
config-example/docker/.env(1 hunks)config-example/docker/myhost/.env(3 hunks)config-example/docker/myhost/services.yaml(1 hunks)docker/infra/adguardhome-sync.yaml(1 hunks)docker/infra/adguardhome.yaml(2 hunks)scripts/create-example-env.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{sh,Dockerfile,yml,yaml,tf}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Follow the pre-commit rules defined in .pre-commit-config.yaml, which includes linting for shell scripts, Dockerfiles, YAML files, Ansible playbooks, and Terraform configurations.
Files:
docker/infra/adguardhome.yamlconfig-example/docker/myhost/services.yamldocker/infra/adguardhome-sync.yaml
docker/**/*.{yml,yaml}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Docker Compose files for services should be placed under the docker/ directory, organized by service type (e.g., security, media, storage, monitoring).
Files:
docker/infra/adguardhome.yamldocker/infra/adguardhome-sync.yaml
config-example/**
📄 CodeRabbit Inference Engine (CLAUDE.md)
Example configuration files should be placed under the config-example/ directory.
Files:
config-example/docker/myhost/services.yaml
🧠 Learnings (2)
📚 Learning: 2025-08-06T20:29:29.578Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.578Z
Learning: Applies to docker/**/*.{yml,yaml} : Docker Compose files for services should be placed under the docker/ directory, organized by service type (e.g., security, media, storage, monitoring).
Applied to files:
docker/infra/adguardhome-sync.yaml
📚 Learning: 2025-08-06T20:29:29.578Z
Learnt from: CR
PR: bubacoder/infra#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-06T20:29:29.578Z
Learning: Use Docker and Docker Compose for containerized services.
Applied to files:
docker/infra/adguardhome-sync.yaml
🪛 YAMLlint (1.37.1)
docker/infra/adguardhome.yaml
[error] 3-3: trailing spaces
(trailing-spaces)
🪛 dotenv-linter (3.3.0)
config-example/docker/myhost/.env
[warning] 40-40: [QuoteCharacter] The value has quote characters (', ")
[warning] 41-41: [QuoteCharacter] The value has quote characters (', ")
[warning] 41-41: [UnorderedKey] The ADGUARDHOME_PASSWORD key should go before the ADGUARDHOME_USERNAME key
[warning] 67-67: [QuoteCharacter] The value has quote characters (', ")
🔇 Additional comments (7)
config-example/docker/myhost/services.yaml (1)
29-30: Compose definition confirmed under docker/infra/adguardhome-sync.yaml
- Found file:
docker/infra/adguardhome-sync.yaml- Contains matching
name: adguardhome-syncservice blockEverything aligns with the repository layout. No further changes needed.
config-example/docker/.env (1)
16-17: Verify SECOND_NODE variable usage
- docker/infra/adguardhome-sync.yaml:25 references
SECOND_NODE_IPforREPLICA1_URL.- No occurrences of
SECOND_NODE(without_IP) found elsewhere.Please confirm whether
SECOND_NODEis intended for use in other configs or scripts (e.g., Docker Compose, orchestration scripts), and either add the necessary references or remove the unused variable.scripts/create-example-env.py (1)
5-13: Masking USERNAME fields is appropriate and aligns with new vars.This will properly mask ADGUARDHOME_USERNAME and UNIFI_*_USERNAME while preserving ADMIN_USER via GENERALIZE precedence.
docker/infra/adguardhome.yaml (1)
23-24: LOCAL_NODE_IP DNS bindings verified
The use of LOCAL_NODE_IP on lines 23–24 is correct, and there are no remaining MAIN_NODE_IP references in docker/infra/adguardhome.yaml.config-example/docker/myhost/.env (2)
28-31: LOCAL_NODE_IP addition is consistent with compose changes.Matches the adguardhome.yaml port binding. No further action.
67-67: Username placeholder switch aligns with new masking logic.Good move to avoid committing real usernames in example configs.
docker/infra/adguardhome-sync.yaml (1)
15-21: Service setup, image pin, and cron look goodImage, command, restart policy, and the 2-hour cron are sensible defaults. Nice touch linking to the upstream config reference.
dd8c2f6 to
be32ae4
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
config-example/docker/myhost/.env (1)
67-67: Fix dotenv-linter warning: drop quotesQuotes are unnecessary here and flagged by dotenv-linter.
-UNIFI_LOCAL_VIEWONLY_USERNAME="use-some-very-secure-value-here" +UNIFI_LOCAL_VIEWONLY_USERNAME=use-some-very-secure-value-here
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
config-example/docker/.env(1 hunks)config-example/docker/myhost/.env(3 hunks)config-example/docker/myhost/services.yaml(1 hunks)docker/infra/adguardhome-sync.yaml(1 hunks)docker/infra/adguardhome.yaml(2 hunks)docs/setup.md(1 hunks)scripts/create-example-env.py(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- docs/setup.md
🚧 Files skipped from review as they are similar to previous changes (4)
- config-example/docker/myhost/services.yaml
- config-example/docker/.env
- scripts/create-example-env.py
- docker/infra/adguardhome-sync.yaml
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{sh,Dockerfile,yml,yaml,tf}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Follow the pre-commit rules defined in .pre-commit-config.yaml, which includes linting for shell scripts, Dockerfiles, YAML files, Ansible playbooks, and Terraform configurations.
Files:
docker/infra/adguardhome.yaml
docker/**/*.{yml,yaml}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Docker Compose files for services should be placed under the docker/ directory, organized by service type (e.g., security, media, storage, monitoring).
Files:
docker/infra/adguardhome.yaml
🪛 dotenv-linter (3.3.0)
config-example/docker/myhost/.env
[warning] 40-40: [QuoteCharacter] The value has quote characters (', ")
[warning] 41-41: [QuoteCharacter] The value has quote characters (', ")
[warning] 41-41: [UnorderedKey] The ADGUARDHOME_PASSWORD key should go before the ADGUARDHOME_USERNAME key
[warning] 67-67: [QuoteCharacter] The value has quote characters (', ")
🪛 YAMLlint (1.37.1)
docker/infra/adguardhome.yaml
[error] 3-3: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: check
🔇 Additional comments (1)
config-example/docker/myhost/.env (1)
28-31: LOCAL_NODE_IP addition looks goodHost-scoped bind IP is appropriate and aligns with docker/infra/adguardhome.yaml usage.
Summary by CodeRabbit
New Features
Improvements