← Back to Runbooks

Cloudflare Deployment Runbook

Goal Description

The objective is to take our newly created Next.js Cooperlux Runbook application and deploy it live to the internet using Cloudflare (CF) Pages via the wrangler CLI and a Cloudflare API token.

This will ensure the runbooks and pipeline artifacts are globally distributed, highly available, and accessible at edge speeds.

User Review Required

Important


In order to execute this deployment, I will need you to securely provide your Cloudflare Account ID and Cloudflare API Token. Please review this plan, and when you approve it, provide the credentials so I can execute the wrangler deployment.

Open Questions

  1. Credentials: Please provide your CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN when you approve this plan.
  2. Next.js Rendering: Since this is a runbook/documentation site, the fastest and most reliable deployment method on Cloudflare Pages is a Static Site Export (out/ directory). Is it acceptable to configure Next.js for static export?

Proposed Changes

1. Next.js Configuration

We will modify the Next.js config to enable static exports, which Cloudflare Pages can serve directly from the edge.

  • [MODIFY] /root/ecosystems/ecosystem-cooperlux/next.config.js or next.config.mjs
    • Add output: 'export' to the NextConfig object.
  • [MODIFY] /root/ecosystems/ecosystem-cooperlux/package.json
    • Update the build script to ensure it generates the out/ directory.

2. Cloudflare Wrangler Deployment

We will install wrangler and use it to deploy the exported site.

  • [NEW] We will execute npm install -D wrangler inside the project.
  • [EXECUTE] We will run the build command npm run build.
  • [EXECUTE] We will deploy the out/ directory to Cloudflare Pages using: CLOUDFLARE_API_TOKEN=<your_token> CLOUDFLARE_ACCOUNT_ID=<your_id> npx wrangler pages deploy ./out --project-name cooperlux-runbook --branch main

Verification Plan

Automated Tests

  • The npm run build command will verify that the Next.js app can be successfully statically exported without errors.
  • The wrangler pages deploy command will output the live Cloudflare .pages.dev URL.

Manual Verification

You will be able to click the live Cloudflare URL outputted by Wrangler to verify the site is online globally. Later, you can attach your custom cooperlux.com domain to this Pages project in your Cloudflare dashboard.