Skip to content

fix(AGE-64): make codecolony.online apex serve the landing - #86

Merged
LaloLalo1999 merged 2 commits into
mainfrom
fix/age-64-apex-dns
May 1, 2026
Merged

LaloLalo1999 merged 2 commits into
mainfrom
fix/age-64-apex-dns

Conversation

@LaloLalo1999

Copy link
Copy Markdown
Contributor

Problem

https://codecolony.online/ currently returns HTTP 522 because Cloudflare auto-provisioned @ and www records when the zone was added, and alchemy/dns.ts deliberately skips managing them to avoid 81053 conflicts.

Solution (Approach A — Pages custom domain)

Since Alchemy's Cloudflare provider does not expose a Pages resource, we attach codecolony.online as a custom domain to the existing Cloudflare Pages project code-colony-landing via the Cloudflare API.

Once attached, Cloudflare automatically:

  • Creates/manages the apex DNS record
  • Enables proxying + TLS termination

Changes

  • scripts/attach-pages-domain.sh: Idempotent bash script that uses the Cloudflare API to attach (or verify) the apex domain to the Pages project.
  • .github/workflows/cd-prod.yml: Added a step that runs the script after IAC deploy, plus a verification curl.
  • alchemy/landing.ts: Updated header comment to document the custom-domain approach.
  • alchemy/dns.ts: Updated comment explaining why the apex is not managed by Alchemy DnsRecords, and removed unused DnsRecords import to satisfy lint.

Post-merge verification

After this PR merges and cd-prod runs, verify with:

curl -sS -o /dev/null -w 'HTTP %{http_code}\n' https://codecolony.online/

Expected: HTTP 200

Note

The fix only takes effect after the next prod deploy (cd-prod workflow run post-merge). The script is idempotent and will skip if the domain is already attached.

Copilot AI review requested due to automatic review settings May 1, 2026 05:12
@blocksorg

blocksorg Bot commented May 1, 2026

Copy link
Copy Markdown

Mention Blocks like a regular teammate with your question or request:

@blocks review this pull request
@blocks make the following changes ...
@blocks create an issue from what was mentioned in the following comment ...
@blocks explain the following code ...
@blocks are there any security or performance concerns?

Run @blocks /help for more information.

Workspace settings | Disable this message

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffed0b7990

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/cd-prod.yml
@LaloLalo1999
LaloLalo1999 force-pushed the fix/age-64-apex-dns branch from ffed0b7 to cc93bbb Compare May 1, 2026 05:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc93bbb973

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/attach-pages-domain.sh Outdated
Comment thread .github/workflows/cd-prod.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@LaloLalo1999
LaloLalo1999 force-pushed the fix/age-64-apex-dns branch from cc93bbb to 17208a2 Compare May 1, 2026 05:44
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17208a2f02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/attach-pages-domain.sh Outdated
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

… .name + status)

- attach-pages-domain.sh: parse .name (canonical Pages API field) AND
  inspect .status before short-circuiting; only treat active/pending/etc.
  as healthy. Re-attaches if status is unknown/broken.
- cd-prod.yml verify step: use curl --fail-with-body, retry 6x with 15s
  sleep, exit non-zero on persistent 4xx/5xx so a real outage fails the
  workflow.
- Skipped: 'duplicate Slack notification step' \u2014 only one Slack step
  exists; codex false positive.
@LaloLalo1999
LaloLalo1999 force-pushed the fix/age-64-apex-dns branch from ecbbbf9 to 48701af Compare May 1, 2026 06:34
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

@LaloLalo1999
LaloLalo1999 merged commit 9d89dda into main May 1, 2026
7 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48701afeaf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +63 to +65
if echo "${ERRORS}" | grep -qi "already exists\|already added\|duplicate"; then
echo "==> Domain '${DOMAIN}' already exists (race or previous run). Treating as success."
exit 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Repair unhealthy Pages domains with PATCH before succeeding

When an existing domain is found in an unhealthy state (deactivated/blocked/error), this script falls through to a POST create call and then treats duplicate-name errors as success. That means the unhealthy domain record is never actually retried/revalidated, so the outage mode can persist across deploys even though this step exits 0. Cloudflare Pages exposes a domain PATCH endpoint specifically to retry validation of an existing domain; without using that path, the intended “repair” behavior is skipped.

Useful? React with 👍 / 👎.

Comment on lines +97 to +99
if curl --fail-with-body -sS -o /dev/null \
-w 'HTTP %{http_code} (attempt '$attempt')\n' \
https://codecolony.online/; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce 2xx in apex check instead of relying on --fail-with-body

This check currently passes on HTTP 3xx responses because curl --fail-with-body only fails for response codes 400 or greater (per curl --manual), so a redirect from codecolony.online will exit 0 on the first attempt. Since the step message and error text describe a 2xx readiness gate, not explicitly validating %{http_code} allows misrouted/incorrect redirects to be reported as healthy deploys.

Useful? React with 👍 / 👎.

@LaloLalo1999
LaloLalo1999 deleted the fix/age-64-apex-dns branch July 30, 2026 11: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