Move docs-dev to S3 backends as the docs.ruby-lang.org migration canary - #72
Open
znz wants to merge 1 commit into
Open
Move docs-dev to S3 backends as the docs.ruby-lang.org migration canary#72znz wants to merge 1 commit into
znz wants to merge 1 commit into
Conversation
Add a public-read docs.r-l.o bucket (us-east-1, the cheapest tier; every request reaches it through Fastly so the client distance does not matter) and route docs-dev to it, with the doxygen pages still proxied from the rubyci bucket and docs-origin left as the fallback for unflagged paths. The custom VCL takes over everything the nginx origin does today: the five redirect rules, per-version Surrogate-Key and Cache-Control (the purge key scheme is unchanged), directory index.html, text/markdown for the .md twins, and the 50x page. On top of that it resolves /ja/latest and /ja/master through an edge dictionary instead of filesystem symlinks, temporarily redirects the unreleased version (en/4.1 and ja/4.1 to the master alias, 302, keyed off the same dictionary so a release only updates dictionary values), and serves Markdown content negotiation on /ja/ pages (Accept: text/markdown fetches the .md twin, falling back to .html where no twin exists). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Canary for moving docs.ruby-lang.org off the docs-origin server onto S3 +
Fastly, on the docs-dev service (production docs.tf is untouched).
A targeted plan has been run and comes out exactly as intended —
Plan: 6 to add, 1 to change, 0 to destroy(the five bucket resources andthe dictionary items created, docs_dev updated in place, nothing destroyed).
Please apply with the real
datadog_token: the local plan passed-var datadog_token=dummy, which is why it shows the logging_datadog blockreplaced; applying that literally would break the logging endpoint.
cdn/s3.tf: new public-readdocs.r-l.obucket (us-east-1 likeftp.r-l.o — everything is fetched through Fastly, so the cheapest tier wins
over client proximity). Prefix layout and writers are documented in the
file; write access is meant to be split per pipeline with IAM prefix
conditions rather than per-bucket.
cdn/docs_dev.tf: three backends — the docs bucket (shielded iad-va-us,default_host/domain arrangement from cache.tf), the rubyci bucket for
/capi/en/master/(step 1 keeps Doxygen where it is; step 2 later moves itinto the docs bucket), and docs-origin as the fallback for unflagged paths
so prefixes can be moved one at a time. Routing is request_conditions on a
header flag set before
#FASTLY recv(assigning req.backend in VCL wouldbypass shielding, per the cache.tf comment). Adds the
docs_versionsdictionary (latest=4.0, master=4.1).
cdn/vcl/docs_dev.vcl: replaces the behavior-neutral boilerplate withthe actual origin logic:
/en/4.1/*and/ja/4.1/*go to the
masteralias until the release; keyed off the dictionary, soa release only updates dictionary values
index.htmlappended internally for trailing-slash URLs/ja/latest/・/ja/master/resolved internally via the dictionary (thebucket holds no symlink objects; client URLs stay on the alias)
/ja/pages:Accept: text/markdownonan
.htmlURL internally fetches the.mdtwin, with a restart fallbackto
.htmlwhere no twin exists (generated index pages, frozen RDversions); Accept is normalized to two values to keep Vary cacheable
purge-key scheme (alias and real version share one object, so its key
carries both names)
short negative-cache TTL;
x-amz-*headers stripped; 50x synthetic pageTesting (once content is synced to the bucket)
Against https://docs-rlo-dev.global.ssl.fastly.net/ (no DNS/TLS setup needed,
per the existing comment in docs_dev.tf). Minimum sync for testing:
rurema/generated-documentshtml/ja/4.0 →ja/4.0/, docs repo public/ →root, one en version →
en/<v>/.//ja//ja/latest//ja/latest/doc/index.html200/ja/latest/class/Array.html==/ja/4.0/class/Array.html/ja/latest/class/Array.md→text/markdown; charset=utf-8curl -H 'Accept: text/markdown' /ja/latest/class/Array.html→ the .mdtwin; same on
/ja/latest/class/index.html→ falls back to HTML/ja/latest→ 301/ja/latest//en/trunk/x→ 301,/en/3.4/doc/y→ 301,/ja/2.8.0/z→ 301/ja/3.0/z/ja/search/query:%E9%85%8D%E5%88%97/→ 301/ja/search/?q=%E9%85%8D%E5%88%97/en/4.1/anything→ 302/en/master/anything,/ja/4.1/x→ 302/ja/master/x/capi/en/master/serves Doxygen,/capi/en/master/sitemap.xml200Fastly-Debug: 1shows the Surrogate-Keyand purging
ja/4.0/ja/latestworksFollow-ups (separate PRs)
aws-actions/configure-aws-credentials) with per-pipeline IAM prefix
conditions, replacing the long-lived secrets currently used for rubyci
ja/, ruby/actions docs.yml →en/<v>/, docs repopublic/ → root; one-off sync for frozen en versions and old ja versions
🤖 Generated with Claude Code