Skip to content

Fix 521: add missing dofek.asherlc.com DNS record + CI check - #896

Merged
Asherlc merged 2 commits into
mainfrom
Asherlc/debug-521-settings
Apr 13, 2026
Merged

Asherlc merged 2 commits into
mainfrom
Asherlc/debug-521-settings

Conversation

@Asherlc

@Asherlc Asherlc commented Apr 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add dofek.asherlc.com A record to deploy/dns.tf pointing to hcloud_server.dofek.ipv4_address (proxied)
  • Add scripts/check-dns-records.sh CI check that validates every Traefik Host() domain has a matching DNS record in dns.tf
  • Wire the check into the quality-gate in test.yml

Root cause

The dofek.asherlc.com DNS record was managed by the homelab repo's OpenTofu with a hardcoded wrong IP (159.69.3.40 instead of 157.90.25.125). Cloudflare proxied traffic to the dead IP → 521.

The record was missing from this repo's Terraform because it was assumed to be managed by the homelab. The homelab commit on Apr 12 (Portainer + Authentik) ran tofu apply which reasserted the wrong IP.

Fix

  • Immediate: Updated the IP in Cloudflare dashboard (159.69.3.40157.90.25.125) — site is live again
  • Long-term: This PR adds the record to dofek's Terraform so it's managed correctly going forward
  • Prevention: CI check catches missing DNS records before they ship
  • Homelab: Removed the conflicting record from homelab's terraform/main.tf (separate PR)

Test plan

  • scripts/check-dns-records.sh passes with the new record
  • Script correctly fails against original dns.tf (verified with git stash)
  • pnpm lint passes
  • curl https://dofek.asherlc.com/settings returns 200

🤖 Generated with Claude Code

The dofek.asherlc.com A record was managed by the homelab repo's
OpenTofu with a wrong hardcoded IP (159.69.3.40 instead of
157.90.25.125), causing Cloudflare to return 521.

- Add dofek.asherlc.com A record to deploy/dns.tf pointing to the
  Hetzner server dynamically via hcloud_server.dofek.ipv4_address
- Add scripts/check-dns-records.sh CI check that validates every
  Traefik Host() domain has a matching DNS record in dns.tf
- Wire check into quality-gate in test.yml

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 13, 2026 14:50
@github-actions

github-actions Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Storybook previews for 7b631fdc are ready:

This comment updates automatically on each PR push.

@github-actions

github-actions Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Mobile Preview

Scan to open on device:

QR code for dofek://preview/pr-896

Channel pr-896
Deep Link dofek://preview/pr-896
Commit 7b631fd

To test on device:

  1. Build and install the preview client: PREVIEW_CHANNEL=pr-896 npx expo prebuild --clean -p ios
  2. Or tap deep link on an existing preview build: dofek://preview/pr-896

Each PR gets its own channel. Build a preview client with PREVIEW_CHANNEL=pr-{N} to test.

Copilot AI 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.

Pull request overview

Adds missing Cloudflare DNS coverage for dofek.asherlc.com and introduces a CI guard to prevent future drift between Traefik Host() rules and Terraform-managed DNS records.

Changes:

  • Add Cloudflare A record for dofek.asherlc.com pointing to the Hetzner server IPv4 (proxied).
  • Add scripts/check-dns-records.sh to ensure every Traefik Host(\...`)domain appears indeploy/dns.tf`.
  • Add a new check-dns-records job to the GitHub Actions workflow and include it in the quality-gate dependencies.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
scripts/check-dns-records.sh New CI script to cross-check Traefik Host() domains against Terraform DNS records.
deploy/dns.tf Adds the missing dofek.asherlc.com Cloudflare DNS record to be Terraform-managed.
.github/workflows/test.yml Adds a dedicated CI job to run the DNS coverage check and wires it into the workflow’s quality-gate dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/check-dns-records.sh Outdated
Comment on lines +9 to +11
# Extract all hostnames from Traefik Host(`...`) labels (portable, no -P flag)
hosts=$(sed -n 's/.*Host(`\([^`]*\)`).*/\1/p' "$COMPOSE" | tr '|' '\n' | sed -n 's/.*Host(`\([^`]*\)`).*/\1/p; s/^[[:space:]]*//p' | sort -u)
# The compose file uses || between Host() rules on a single line, so also split those

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

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

hosts is assigned twice; the first extraction pipeline is immediately overwritten by the second assignment, so those lines are dead code and can drift from the real behavior. Remove the unused assignment/comment and keep a single, correct Host() extraction implementation.

Suggested change
# Extract all hostnames from Traefik Host(`...`) labels (portable, no -P flag)
hosts=$(sed -n 's/.*Host(`\([^`]*\)`).*/\1/p' "$COMPOSE" | tr '|' '\n' | sed -n 's/.*Host(`\([^`]*\)`).*/\1/p; s/^[[:space:]]*//p' | sort -u)
# The compose file uses || between Host() rules on a single line, so also split those
# Extract all hostnames from Traefik Host(`...`) labels and deduplicate them

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 9c9330c6. Removed the dead first hosts= assignment that was immediately overwritten by the second one.

Comment thread scripts/check-dns-records.sh Outdated
# Check dns.tf has a record whose name matches this host (literal string or via zone reference)
# For bare domains like "dofek.fit", the name field is just "dofek.fit"
# For subdomains like "dofek.asherlc.com", the name field is "dofek.asherlc.com"
if ! grep -q "\"$host\"" "$DNS_TF"; then

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

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

grep -q "\"$host\"" treats the pattern as a regex, so dots in hostnames are wildcards and can create false matches. Use fixed-string matching (e.g., grep -Fq) to ensure each Host() domain is checked literally against dns.tf.

Suggested change
if ! grep -q "\"$host\"" "$DNS_TF"; then
if ! grep -Fq "\"$host\"" "$DNS_TF"; then

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 9c9330c6. Switched to grep -Fq for fixed-string matching.

Comment on lines 241 to 244
quality-gate:
name: Lint & Static Analysis
needs: [actionlint, lint, typecheck, sherif, knip, spellcheck, import-boundaries, python-checks, hadolint, terraform-validate, swiftlint, periphery]
needs: [actionlint, lint, typecheck, sherif, knip, spellcheck, import-boundaries, python-checks, hadolint, terraform-validate, check-dns-records, swiftlint, periphery]
if: always()

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

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

quality-gate now depends on check-dns-records, but the "Check results" loop does not include ${{ needs.check-dns-records.result }}. If branch protection only requires the quality-gate job, a failing DNS coverage check could be missed; add that result to the loop (or otherwise assert it) so it truly gates.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 9c9330c6. Added ${{ needs.check-dns-records.result }} to the quality-gate check loop.

- Remove dead first `hosts=` assignment that was immediately overwritten
- Use `grep -Fq` instead of `grep -q` to avoid regex dot-matching in hostnames
- Add `check-dns-records` result to the quality-gate check loop

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Asherlc
Asherlc enabled auto-merge (squash) April 13, 2026 14:56
@Asherlc
Asherlc merged commit e463538 into main Apr 13, 2026
52 checks passed
@Asherlc
Asherlc deleted the Asherlc/debug-521-settings branch April 13, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants