-
Notifications
You must be signed in to change notification settings - Fork 0
Deploy to Cloudflare Workers instead of R2 bucket #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request migrates the deployment infrastructure from GitHub Actions with AWS S3/R2 to Cloudflare Workers using Wrangler. It consolidates separate auto-deploy and manual-deploy workflows into a single push-triggered workflow, updates the Astro configuration to use the Cloudflare adapter, adds Wrangler dependencies, and normalizes internal documentation links by removing trailing slashes. Changes
Sequence DiagramsequenceDiagram
participant GitHub as GitHub (Push to main)
participant OldWF as Old Workflows
participant NewWF as New Workflow
participant Wrangler as Cloudflare Wrangler
participant CF as Cloudflare Workers
rect rgb(240, 248, 255)
Note over OldWF: Previous Approach
GitHub->>OldWF: Trigger auto-deploy.yaml
OldWF->>OldWF: workflow_call deploy.yaml
OldWF->>OldWF: AWS S3/R2 credentials
OldWF->>OldWF: s3 sync build/
end
rect rgb(240, 255, 240)
Note over NewWF: New Approach
GitHub->>NewWF: Push to main
NewWF->>NewWF: Setup Node 22
NewWF->>NewWF: Install pnpm<br/>(--frozen-lockfile)
NewWF->>NewWF: pnpm build
NewWF->>Wrangler: Deploy with wrangler-action
Wrangler->>CF: Deploy to Workers + Assets
CF-->>Wrangler: Deployment confirmed
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (7)
src/content/docs/mcp-lite/core-concepts/type-safety.md (1)
135-136: Consistent with repository-wide URL normalization.Link changes align with the broader trailing-slash removal pattern across documentation files in this PR. Routing verification for one file applies to all.
src/content/docs/mcp-lite/features/sessions.md (1)
72-73: Consistent with repository-wide URL normalization.Link changes align with the broader trailing-slash removal pattern across documentation files in this PR. Routing verification for one file applies to all.
src/content/docs/index.mdx (1)
12-13: Consistent with repository-wide URL normalization.Link changes align with the broader trailing-slash removal pattern across documentation files in this PR. Routing verification for one file applies to all.
src/content/docs/mcp-lite/advanced/sampling.md (1)
90-91: Consistent with repository-wide URL normalization.Link changes align with the broader trailing-slash removal pattern across documentation files in this PR. Routing verification for one file applies to all.
src/content/docs/mcp-gateway/core-concepts/activity-logging.md (1)
237-239: Consistent with repository-wide URL normalization.Link changes align with the broader trailing-slash removal pattern across documentation files in this PR. Routing verification for one file applies to all.
src/content/docs/mcp-gateway/getting-started.md (1)
118-120: Consistent with repository-wide URL normalization.Link changes align with the broader trailing-slash removal pattern across documentation files in this PR. Routing verification for one file applies to all.
src/content/docs/mcp-gateway/features/terminal-ui.md (1)
307-309: Consistent with repository-wide URL normalization.Link changes align with the broader trailing-slash removal pattern across documentation files in this PR. Routing verification for one file applies to all.
🧹 Nitpick comments (1)
.github/workflows/deploy.yaml (1)
17-21: Consider adding dependency caching for faster builds.The workflow doesn't cache pnpm dependencies, which could slow down builds.
Add caching between checkout and install steps:
- uses: actions/checkout@v5 - uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (35)
.github/workflows/auto-deploy.yaml(0 hunks).github/workflows/deploy.yaml(1 hunks).github/workflows/manual-deploy.yaml(0 hunks)astro.config.ts(5 hunks)package.json(1 hunks)public/.assetsignore(1 hunks)src/content/docs/index.mdx(1 hunks)src/content/docs/mcp-gateway/core-concepts/activity-logging.md(1 hunks)src/content/docs/mcp-gateway/core-concepts/interfaces.md(1 hunks)src/content/docs/mcp-gateway/core-concepts/server-management.md(1 hunks)src/content/docs/mcp-gateway/features/cli-options.md(1 hunks)src/content/docs/mcp-gateway/features/storage.md(1 hunks)src/content/docs/mcp-gateway/features/terminal-ui.md(1 hunks)src/content/docs/mcp-gateway/features/web-interface.md(1 hunks)src/content/docs/mcp-gateway/getting-started.md(1 hunks)src/content/docs/mcp-gateway/index.md(1 hunks)src/content/docs/mcp-gateway/troubleshooting.md(1 hunks)src/content/docs/mcp-lite/advanced/elicitation.md(1 hunks)src/content/docs/mcp-lite/advanced/protocol-versions.md(1 hunks)src/content/docs/mcp-lite/advanced/sampling.md(1 hunks)src/content/docs/mcp-lite/core-concepts/prompts.md(1 hunks)src/content/docs/mcp-lite/core-concepts/resources.md(1 hunks)src/content/docs/mcp-lite/core-concepts/tools.md(1 hunks)src/content/docs/mcp-lite/core-concepts/type-safety.md(1 hunks)src/content/docs/mcp-lite/deployment/environments.md(1 hunks)src/content/docs/mcp-lite/deployment/patterns.md(1 hunks)src/content/docs/mcp-lite/examples.md(1 hunks)src/content/docs/mcp-lite/features/adapters.md(1 hunks)src/content/docs/mcp-lite/features/error-handling.md(1 hunks)src/content/docs/mcp-lite/features/middleware.md(1 hunks)src/content/docs/mcp-lite/features/sessions.md(1 hunks)src/content/docs/mcp-lite/getting-started.md(1 hunks)src/content/docs/mcp-lite/index.mdx(1 hunks)src/content/docs/reference/example.md(1 hunks)wrangler.jsonc(1 hunks)
💤 Files with no reviewable changes (2)
- .github/workflows/manual-deploy.yaml
- .github/workflows/auto-deploy.yaml
🔇 Additional comments (28)
src/content/docs/mcp-lite/advanced/protocol-versions.md (1)
106-107: Clarify trailing slash handling to align with PR objectives.There is a contradiction between the PR objectives and the actual code changes:
- PR objectives state: "updating all doc page routes to use trailing slashes for consistent routing"
- Actual changes: removing trailing slashes from internal links
The links at lines 106-107 are being updated to remove trailing slashes (
/sessions/→/sessions,/elicitation/→/elicitation), which is the opposite of what the PR summary describes.Please clarify:
- Should trailing slashes be added or removed for consistent Cloudflare Workers routing?
- Is the PR objective description accurate, or were the objectives updated after implementation?
- Are there other files in this PR that define the authoritative routing behavior (e.g.,
astro.config.mjs, route definitions)?This clarification is important to ensure routing consistency across the entire documentation site.
src/content/docs/mcp-lite/features/error-handling.md (1)
105-106: Verify trailing-slash routing configuration.These links now point to non-trailing-slash URLs. Ensure that
astro.config.tsis configured to handle these routes correctly and that this normalization is applied consistently across the build output.src/content/docs/mcp-lite/getting-started.md (1)
101-104: Verify trailing-slash routing configuration.Four Next Steps links now use non-trailing-slash URLs. Ensure that Astro's routing configuration handles these paths correctly and applies this normalization consistently across all pages.
src/content/docs/mcp-lite/deployment/patterns.md (1)
121-123: Next Steps links normalized.Three links updated to non-trailing-slash URLs. Verify routing configuration handles these paths.
src/content/docs/mcp-gateway/features/cli-options.md (1)
239-241: Next Steps links normalized for MCP-Gateway.Three links updated to non-trailing-slash URLs, maintaining consistency with MCP-Lite documentation changes.
src/content/docs/mcp-lite/deployment/environments.md (1)
159-160: Next Steps links normalized.Two links updated to non-trailing-slash URLs.
src/content/docs/mcp-gateway/troubleshooting.md (1)
467-469: Next Steps links normalized.Three links updated to non-trailing-slash URLs.
src/content/docs/mcp-lite/core-concepts/prompts.md (1)
89-90: Next Steps links normalized.Two links updated to non-trailing-slash URLs.
package.json (2)
23-26: TypeScript correctly moved to devDependencies.Moving TypeScript to devDependencies is the right approach since it's a build-time tool. Ensure your build script (astro build) includes TypeScript compilation as needed.
15-26: All dependency versions are compatible; no changes needed.@astrojs/cloudflare v12.6.10 is compatible with Astro 5.6.1, and wrangler v4.45.3 can be used to deploy Astro 5 sites. TypeScript placement in devDependencies is correct for a build-time dependency.
src/content/docs/mcp-gateway/features/web-interface.md (1)
358-360: Consistent with trailing slash removal pattern across documentation.Internal links have been updated to remove trailing slashes from paths. Assuming the Astro configuration is set to
trailingSlash: 'never', these changes align with the deployment migration to Cloudflare Workers. Link syntax and formatting are correct.Verify that the
astro.config.tsis configured withtrailingSlash: 'never'or equivalent setting to ensure these slash-less paths are properly routed in the Cloudflare Workers environment.src/content/docs/mcp-lite/features/middleware.md (1)
95-96: Links normalized to slash-less paths.Trailing slashes removed from internal navigation links. Consistent with the repository-wide documentation URL normalization.
src/content/docs/mcp-gateway/core-concepts/interfaces.md (1)
252-254: Next Steps links updated consistently.All trailing slashes removed from internal documentation paths in the Next Steps section.
src/content/docs/mcp-lite/core-concepts/resources.md (1)
88-89: Internal link normalization applied.Next Steps links updated to slash-less paths consistent with the trailing slash configuration.
src/content/docs/mcp-lite/advanced/elicitation.md (1)
75-76: Trailing slashes removed from Next Steps links.Consistent normalization of internal navigation paths.
src/content/docs/mcp-lite/examples.md (1)
133-134: Next Steps links normalized.Trailing slashes removed from internal documentation paths.
src/content/docs/mcp-lite/features/adapters.md (1)
116-117: Trailing slash normalization in Next Steps section.Internal documentation links updated to remove trailing slashes.
src/content/docs/mcp-gateway/core-concepts/server-management.md (1)
178-180: No routing issues identified — links are already slash-less and consistent with site configuration.The internal navigation links in lines 178-180 are already slash-less and align with the existing sidebar configuration in
astro.config.ts. Astro v5 with the Cloudflare adapter handles slash-less routes correctly when trailingSlash is configured as 'never' or left to the default 'ignore' behavior, which applies 301/308 redirects from slash URLs when needed. The Starlight-rendered documentation pages will work without issue with this link format.src/content/docs/mcp-lite/core-concepts/tools.md (1)
168-170: Link normalization looks correct.The removal of trailing slashes aligns with the Astro configuration changes and Cloudflare adapter usage. However, note that the PR summary states "updating all doc page routes to use trailing slashes" when the actual change is removing them. This inconsistency should be corrected in the PR description.
src/content/docs/mcp-gateway/index.md (1)
94-96: Link normalization is consistent.These changes align with the project-wide URL normalization to slash-less routes.
src/content/docs/mcp-gateway/features/storage.md (1)
368-370: LGTM!Link updates are consistent with the routing changes.
src/content/docs/mcp-lite/index.mdx (1)
89-99: LGTM!All link updates follow the slash-less routing convention.
astro.config.ts (2)
58-169: Extensive link normalization completed successfully.All sidebar links have been updated to use slash-less routes, ensuring consistency across the documentation navigation.
1-6: The review concern is incorrect for this codebase.This is a pure static documentation site powered by Starlight with no dynamic routes, API endpoints, or server-side logic. The default
output: "static"mode is appropriate and intentional. The Cloudflare adapter's default advanced mode handles static sites correctly. No explicitoutput: "server"configuration is needed.Likely an incorrect or invalid review comment.
public/.assetsignore (1)
1-2: Appropriate ignore patterns for Cloudflare Workers artifacts.These patterns correctly exclude the worker script and routing configuration from being treated as static assets.
wrangler.jsonc (2)
5-12: Configuration looks appropriate for the deployment target.The compatibility flags and observability settings are well-suited for a documentation site deployment on Cloudflare Workers.
3-3: Entry point path is correct.The path
./dist/_worker.js/index.jsis the standard output structure for the Astro Cloudflare adapter. Thedist/_worker.js/index.jsis the Module Worker entry that Cloudflare Pages uses in advanced mode and should be configured as the Wrangler "main" target. The nested structure is intentional and properly configured in yourwrangler.jsonc..github/workflows/deploy.yaml (1)
26-31: Deployment configuration is secure and correct.The Wrangler action is properly configured with required secrets, and the workflow will automatically deploy on pushes to main.
Summary
Migrate docs site deployment from static R2 bucket hosting to Cloudflare Workers with on-demand rendering.
Changes
@astrojs/cloudflareadapter and configured Astro for SSR deploymentwranglerand addedwrangler.jsoncconfigurationwrangler deployinstead of R2 syncWhy
Static R2 hosting doesn't support dynamic pages or custom error handling. By deploying to Workers, we can now serve dynamically generated pages and provide a better user experience with proper 404 handling.
Summary by CodeRabbit
Infrastructure & Deployment
Documentation
Chores