From ecb9a93e09ff0804e71d7f632fd35ef96a18d02f Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 07:19:58 +0000 Subject: [PATCH 1/2] Deploy map through Cloudflare Pages Git integration instead of a workflow Remove the wrangler-based deploy workflow (it needed repository secrets that will not be added) and document the Pages project build settings. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01PS44Q7WRmAzMJLhi44dzdo --- .github/workflows/deploy-map.yml | 100 ------------------------------- README.md | 39 ++++++------ 2 files changed, 20 insertions(+), 119 deletions(-) delete mode 100644 .github/workflows/deploy-map.yml diff --git a/.github/workflows/deploy-map.yml b/.github/workflows/deploy-map.yml deleted file mode 100644 index bdbcfcc..0000000 --- a/.github/workflows/deploy-map.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Deploy Map (Cloudflare Pages) - -# Builds the map as a static export and publishes it to Cloudflare Pages. -# - push to main -> production deployment -# - pull request (same repo) -> preview deployment -# - manual run -> deploys the selected ref -# -# Required repository secrets: -# CLOUDFLARE_API_TOKEN API token with "Account > Cloudflare Pages > Edit" -# CLOUDFLARE_ACCOUNT_ID Cloudflare account ID -# Optional repository variables: -# CLOUDFLARE_PAGES_PROJECT Pages project name (default: airframes-coverage) -# NEXT_PUBLIC_COVERAGE_API_URL Coverage API base URL -# NEXT_PUBLIC_MAP_STYLE_URL Default MapLibre style URL - -on: - push: - branches: [main] - paths: - - map/** - - .github/workflows/deploy-map.yml - pull_request: - branches: [main] - paths: - - map/** - - .github/workflows/deploy-map.yml - workflow_dispatch: - -concurrency: - group: deploy-map-${{ github.ref }} - cancel-in-progress: true - -permissions: - contents: read - deployments: write - -jobs: - deploy: - name: Deploy - runs-on: ubuntu-latest - # Fork and Dependabot pull requests do not receive secrets. - if: >- - github.event_name != 'pull_request' || - (github.event.pull_request.head.repo.full_name == github.repository && - github.actor != 'dependabot[bot]') - env: - NEXT_TELEMETRY_DISABLED: 1 - NEXT_PUBLIC_COVERAGE_API_URL: ${{ vars.NEXT_PUBLIC_COVERAGE_API_URL || 'https://coverage-api.airframes.io' }} - NEXT_PUBLIC_WS_URL: ${{ vars.NEXT_PUBLIC_WS_URL || 'wss://coverage-api.airframes.io/ws' }} - NEXT_PUBLIC_MAP_STYLE_URL: ${{ vars.NEXT_PUBLIC_MAP_STYLE_URL || 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json' }} - PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT || 'airframes-coverage' }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - steps: - - uses: actions/checkout@v5 - - - uses: actions/setup-node@v5 - with: - node-version-file: map/.nvmrc - cache: npm - cache-dependency-path: map/package-lock.json - - - name: Install - working-directory: map - run: npm ci - - - name: Build static export - working-directory: map - run: npm run build:static - - - name: Check Cloudflare credentials - id: creds - run: | - if [ -n "$CLOUDFLARE_API_TOKEN" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ]; then - echo "present=true" >> "$GITHUB_OUTPUT" - else - echo "present=false" >> "$GITHUB_OUTPUT" - echo "::warning::CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID are not set; skipping deploy." - fi - - - name: Deploy to Cloudflare Pages - if: steps.creds.outputs.present == 'true' - id: deploy - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - workingDirectory: map - command: >- - pages deploy out - --project-name=${{ env.PAGES_PROJECT }} - --branch=${{ github.head_ref || github.ref_name }} - --commit-hash=${{ github.event.pull_request.head.sha || github.sha }} - --commit-dirty=true - - - name: Summary - if: steps.creds.outputs.present == 'true' - run: | - echo "### Cloudflare Pages deployment" >> "$GITHUB_STEP_SUMMARY" - echo "${{ steps.deploy.outputs.deployment-url }}" >> "$GITHUB_STEP_SUMMARY" diff --git a/README.md b/README.md index 71d10a0..f2d7654 100644 --- a/README.md +++ b/README.md @@ -55,25 +55,26 @@ cd service && docker compose up ### Map on Cloudflare Pages -The map is fully client-rendered, so it ships to Cloudflare Pages as a static export: - -```bash -cd map -npm run build:static # writes map/out -npx wrangler pages deploy out --project-name=airframes-coverage -``` - -`.github/workflows/deploy-map.yml` does this automatically: pushes to `main` publish production, -pull requests publish a preview. It needs two repository secrets: - -| Secret | Description | -|--------|-------------| -| `CLOUDFLARE_API_TOKEN` | API token with **Account → Cloudflare Pages → Edit** | -| `CLOUDFLARE_ACCOUNT_ID` | Cloudflare account ID | - -Optional repository variables: `CLOUDFLARE_PAGES_PROJECT` (default `airframes-coverage`), -`NEXT_PUBLIC_COVERAGE_API_URL`, `NEXT_PUBLIC_WS_URL`, `NEXT_PUBLIC_MAP_STYLE_URL`. -The workflow skips the deploy step (with a warning) until the secrets exist. +The map is fully client-rendered, so it ships to Cloudflare Pages as a static export. The Pages +project is connected to this repository through Cloudflare's Git integration (same as the globe), +so pushes to `main` publish production and pull requests get preview deployments. No GitHub +secrets or deploy workflow are involved. + +Pages project build settings: + +| Setting | Value | +|---------|-------| +| Root directory | `map` | +| Build command | `npm run build:static` | +| Build output directory | `out` | +| Environment variable `NODE_VERSION` | `24` | +| Environment variable `NEXT_PUBLIC_COVERAGE_API_URL` | `https://coverage-api.airframes.io` | +| Environment variable `NEXT_PUBLIC_WS_URL` | `wss://coverage-api.airframes.io/ws` | + +`NEXT_PUBLIC_MAP_STYLE_URL` is optional. Without the API variables the build falls back to +`http://localhost:3002`, so set them for both Production and Preview. + +To build the same output locally: `cd map && npm run build:static` (writes `map/out`). ### Docker From 20749b587d8b8d8e0ad4e5a4f2c355af968428c1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 08:14:45 +0000 Subject: [PATCH 2/2] Point map builds at the staging coverage API coverage-api.airframes.io has no DNS record. The coverage service runs only on the staging cluster at staging-coverage.airframes.io, so use that host in the CI build args and the documented Pages settings. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01PS44Q7WRmAzMJLhi44dzdo --- .github/workflows/map.yml | 12 ++++++------ README.md | 8 ++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/map.yml b/.github/workflows/map.yml index 34f49c0..89c4b5c 100644 --- a/.github/workflows/map.yml +++ b/.github/workflows/map.yml @@ -25,8 +25,8 @@ defaults: env: NEXT_TELEMETRY_DISABLED: 1 - NEXT_PUBLIC_COVERAGE_API_URL: https://coverage-api.airframes.io - NEXT_PUBLIC_WS_URL: wss://coverage-api.airframes.io/ws + NEXT_PUBLIC_COVERAGE_API_URL: https://staging-coverage.airframes.io + NEXT_PUBLIC_WS_URL: wss://staging-coverage.airframes.io/ws NEXT_PUBLIC_MAP_STYLE_URL: https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json jobs: @@ -75,8 +75,8 @@ jobs: context: map push: false build-args: | - NEXT_PUBLIC_COVERAGE_API_URL=https://coverage-api.airframes.io - NEXT_PUBLIC_WS_URL=wss://coverage-api.airframes.io/ws + NEXT_PUBLIC_COVERAGE_API_URL=https://staging-coverage.airframes.io + NEXT_PUBLIC_WS_URL=wss://staging-coverage.airframes.io/ws cache-from: type=gha,scope=map cache-to: type=gha,scope=map,mode=max @@ -102,7 +102,7 @@ jobs: push: true tags: ghcr.io/airframesio/coverage-map:latest build-args: | - NEXT_PUBLIC_COVERAGE_API_URL=https://coverage-api.airframes.io - NEXT_PUBLIC_WS_URL=wss://coverage-api.airframes.io/ws + NEXT_PUBLIC_COVERAGE_API_URL=https://staging-coverage.airframes.io + NEXT_PUBLIC_WS_URL=wss://staging-coverage.airframes.io/ws cache-from: type=gha,scope=map cache-to: type=gha,scope=map,mode=max diff --git a/README.md b/README.md index f2d7654..4c505e4 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,12 @@ Pages project build settings: | Build command | `npm run build:static` | | Build output directory | `out` | | Environment variable `NODE_VERSION` | `24` | -| Environment variable `NEXT_PUBLIC_COVERAGE_API_URL` | `https://coverage-api.airframes.io` | -| Environment variable `NEXT_PUBLIC_WS_URL` | `wss://coverage-api.airframes.io/ws` | +| Environment variable `NEXT_PUBLIC_COVERAGE_API_URL` | `https://staging-coverage.airframes.io` | +| Environment variable `NEXT_PUBLIC_WS_URL` | `wss://staging-coverage.airframes.io/ws` | + +The coverage service currently runs only on the staging cluster, where +`staging-coverage.airframes.io` serves the API under `/api/` and the WebSocket at `/ws`. +Point these at a production host once one exists. `NEXT_PUBLIC_MAP_STYLE_URL` is optional. Without the API variables the build falls back to `http://localhost:3002`, so set them for both Production and Preview.