Skip to content

feat: add archive infrastructure for EOL distribution packages#47

Open
abtreece wants to merge 8 commits into
fullstaq-ruby:mainfrom
abtreece:feat/eol-archive-repos
Open

feat: add archive infrastructure for EOL distribution packages#47
abtreece wants to merge 8 commits into
fullstaq-ruby:mainfrom
abtreece:feat/eol-archive-repos

Conversation

@abtreece

@abtreece abtreece commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add GCS buckets for APT/YUM archive repositories (public-read, no CI write access)
  • Add Azure DNS zones, NS delegation, and A/AAAA records for apt-archive.fullstaqruby.org and yum-archive.fullstaqruby.org
  • Add Caddy server blocks to redirect archive subdomains to the versioned GCS bucket paths
  • Update query-latest-repo-versions.rb to query archive bucket versions, with graceful fallback (version 0) before first migration

Context

Addresses fullstaq-ruby/server-edition#190 — CI disk space exhaustion from the growing Aptly state archive.

Archive repos follow the PostgreSQL (apt-archive.postgresql.org) and HashiCorp (archive.releases.hashicorp.com) pattern: frozen repositories for EOL distributions, served as static redirects to GCS.

Companion PR: fullstaq-ruby/server-edition#191 (migration scripts, build config, runbook)
Implementation plan: context/plans/EOL-ARCHIVE-MIGRATION.md (Tasks 1-3)

Design notes

  • Archive buckets intentionally lack CI write access. The live apt/yum buckets grant roles/storage.objectAdmin to the github-ci-deploy workload identity; the archive buckets deliberately omit this binding. Migration happens out-of-band via the companion server-edition#191 scripts, and the frozen-mirror invariant is enforced in IAM, not by convention.
  • NS delegation timing. Each archive subdomain is its own azurerm_dns_zone with an NS record in the apex zone. Caddy's ACME DNS-01 challenge for the new subdomains will fail until the apex NS records propagate, so the Caddy restart in step 3 must happen after propagation completes (verified by step 2's dig check), not concurrent with terraform apply.
  • force_destroy = true on archive buckets is inherited from the existing bucket pattern and applies here as well. Worth flagging since the data is by definition irreplaceable EOL package archives — accepting the risk to stay consistent with the surrounding module, but reviewers should confirm this is the intended trade-off.

Deployment sequence

  1. terraform apply in terraform/ to create buckets and DNS
  2. Wait for DNS propagation (verify with dig per test plan)
  3. Restart Caddy (via Ansible or SSH) to pick up new Caddyfile and env vars
  4. Run migration scripts from the server-edition companion PR

Test plan

  • terraform init -backend=false && terraform validate && terraform fmt -check -diff -recursive passes
  • DNS resolves: dig apt-archive.fullstaqruby.org A and dig yum-archive.fullstaqruby.org A return backend server IP
  • Caddy starts without error even before first migration (archive version defaults to 0)
  • After migration: curl -I https://apt-archive.fullstaqruby.org/dists/ returns 302 to GCS

The previous code degraded any non-2xx response (auth errors, 5xx,
redirects) to LATEST_VERSION=0 whenever the suffix indicated an
archive bucket. That silently turns a transient outage or
misconfiguration into Caddy redirecting clients to /versions/0/...
404s — broken behavior masquerading as valid config.

Only treat HTTP 404 as the legitimate "archive not yet populated"
case; surface every other failure.
@abtreece abtreece requested a review from FooBarWidget May 15, 2026 05:06
noahssarcastic
noahssarcastic previously approved these changes May 19, 2026

@noahssarcastic noahssarcastic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, reviewed in tandem with fullstaq-ruby/server-edition#191.

Comment thread ansible/files/query-latest-repo-versions.rb Outdated
FooBarWidget
FooBarWidget previously approved these changes May 21, 2026

@FooBarWidget FooBarWidget left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also looks good to me, agree with @noahssarcastic: query_repo_version could use some code clarity improvements but not blocking.

Also, the infra overview docs need to be updated. Since #57 is not yet merged, I suggest updating #57 with the changes made in this PR #47.

Feel free to deploy @abtreece.

Comment thread ansible/files/query-latest-repo-versions.rb Outdated
Documents the new APT/YUM archive infrastructure introduced in this PR:
the two new public-read GCS buckets, the deliberate absence of CI write
access (frozen-mirror invariant enforced in IAM), the Azure DNS zones
and apex NS delegation for the archive subdomains, and the 404 fallback
behavior in query-latest-repo-versions.rb that lets the web server
start cleanly before the first migration runs.

Addresses FooBarWidget's note on PR fullstaq-ruby#57 that fullstaq-ruby#47's changes should ship
with their own documentation.
@abtreece abtreece dismissed stale reviews from FooBarWidget and noahssarcastic via b58dae6 May 22, 2026 20:03
Address review feedback on PR fullstaq-ruby#47 from @noahssarcastic and
@FooBarWidget: the awkward `suffix:` parameter in
query-latest-repo-versions.rb was a downstream symptom of inconsistent
bucket naming (`-repo-archive` broke the `-repo` terminal-suffix
convention used by the live buckets).

Rename:
  <prefix>-server-edition-apt-repo-archive -> -apt-archive-repo
  <prefix>-server-edition-yum-repo-archive -> -yum-archive-repo

Safe to do now -- the buckets don't exist yet (PR not deployed).

With consistent naming, query_repo_version becomes a direct lookup:
`type` is the bucket-name slot, and the only special-casing for
archives is a semantic `allow_missing:` flag for the pre-migration
bootstrap window. No string manipulation, no latent type/suffix
mismatch footgun.

Coordination: server-edition#191's CI workflow sets
ARCHIVE_REPO_BUCKET_NAME -- that value will need to match the new
bucket name before the first migration runs.
@abtreece

Copy link
Copy Markdown
Collaborator Author

For reviewers tracking both PRs: c1814eb renames the archive buckets from -repo-archive to -archive-repo for naming consistency with the live buckets. Companion update to #191's runbook + script docstrings is in fullstaq-ruby/server-edition@0f8fc5d (no script logic changes — they only reference ENV['ARCHIVE_REPO_BUCKET_NAME']).

@FooBarWidget FooBarWidget left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Feel free to deploy.

@abtreece

Copy link
Copy Markdown
Collaborator Author

Feel free to deploy.

@FooBarWidget I've been deep in some home repair things this past week. I'll try to get it deployed this weekend.

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.

3 participants