Skip to content

Commit c4f1220

Browse files
committed
Rename preview to staging to avoid CF terminology confusion
Cloudflare Pages uses "preview" to refer to non-production branches, which made our "preview" staging environment confusing. Renamed to "staging" for clarity: - Project: cambeerfestival-preview → cambeerfestival-staging - Domain: preview.cambeerfestival.app → staging.cambeerfestival.app - Updated CORS origins in worker - Updated all documentation This provides clearer separation between: - Production: cambeerfestival.app - Staging: staging.cambeerfestival.app - PR Previews: <branch>.cambeerfestival-staging.pages.dev
1 parent 34e7d1f commit c4f1220

4 files changed

Lines changed: 28 additions & 28 deletions

File tree

.github/workflows/build-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,13 @@ jobs:
257257
name: web-build
258258
path: build/web
259259

260-
- name: Deploy Preview to Cloudflare Pages
260+
- name: Deploy to Cloudflare Pages (Staging/PR Previews)
261261
id: deploy
262262
uses: cloudflare/wrangler-action@v3
263263
with:
264264
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
265265
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
266-
command: pages deploy build/web --project-name=cambeerfestival-preview --branch=${{ github.head_ref || github.ref_name }}
266+
command: pages deploy build/web --project-name=cambeerfestival-staging --branch=${{ github.head_ref || github.ref_name }}
267267

268268
- name: Comment PR with Preview URL
269269
if: github.event_name == 'pull_request'

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
A Flutter app for browsing beers, ciders, meads, and more at the Cambridge Beer Festival.
77

88
**Production**: [https://cambeerfestival.app](https://cambeerfestival.app)
9-
**Preview**: [https://preview.cambeerfestival.app](https://preview.cambeerfestival.app)
9+
**Staging**: [https://staging.cambeerfestival.app](https://staging.cambeerfestival.app)
1010
**Development**: [https://richardthe3rd.github.io/cambridge-beer-festival-app/](https://richardthe3rd.github.io/cambridge-beer-festival-app/)
1111

1212
## Features
@@ -141,25 +141,25 @@ The app is deployed to multiple environments:
141141

142142
- **Production** (Cloudflare Pages): [cambeerfestival.app](https://cambeerfestival.app)
143143
- Deployed on version tags (e.g., `v2025.12.0`)
144-
- Uses Cloudflare Pages `release` branch
144+
- Uses Cloudflare Pages project `cambeerfestival`, branch `release`
145145
- Workflow: `.github/workflows/release-web.yml`
146-
- **Preview/Staging** (Cloudflare Pages): [preview.cambeerfestival.app](https://preview.cambeerfestival.app)
146+
- **Staging** (Cloudflare Pages): [staging.cambeerfestival.app](https://staging.cambeerfestival.app)
147147
- Stable staging environment
148148
- Deployed automatically on push to `main`
149-
- Uses Cloudflare Pages `main` branch
149+
- Uses Cloudflare Pages project `cambeerfestival-staging`, branch `main`
150150
- Workflow: `.github/workflows/build-deploy.yml` (deploy-web-preview job)
151151
- **Development** (GitHub Pages): [richardthe3rd.github.io/cambridge-beer-festival-app](https://richardthe3rd.github.io/cambridge-beer-festival-app/)
152152
- Alternative development environment
153153
- Deployed automatically on push to `main`
154154
- Workflow: `.github/workflows/build-deploy.yml` (deploy-web job)
155155
- **PR Previews** (Cloudflare Pages): Unique URL per pull request
156-
- Each PR gets its own preview environment (e.g., `<branch-name>.cambeerfestival.pages.dev`)
156+
- Each PR gets its own preview environment (e.g., `<branch>.cambeerfestival-staging.pages.dev`)
157157
- Preview URL posted as comment on the PR
158158
- Workflow: `.github/workflows/build-deploy.yml` (deploy-web-preview job)
159159

160160
### Deployment Strategy
161161

162-
1. **Development changes**: Push to `main`Preview (Cloudflare) + GitHub Pages updated
162+
1. **Development changes**: Push to `main`Staging (Cloudflare) + GitHub Pages updated
163163
2. **PR reviews**: Open PR → Unique Cloudflare Pages preview created
164164
3. **Production releases**: Create tag (e.g., `v2025.12.0`) → Production deployment to cambeerfestival.app
165165

cloudflare-worker/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const FESTIVALS_CACHE_CONTROL = 'no-cache, must-revalidate';
2222
const ALLOWED_ORIGINS = [
2323
'https://richardthe3rd.github.io',
2424
'https://cambeerfestival.app',
25-
'https://preview.cambeerfestival.app',
25+
'https://staging.cambeerfestival.app',
2626
'http://localhost:8080',
2727
'http://localhost:3000',
2828
'http://127.0.0.1:8080',

docs/CLOUDFLARE_PAGES_SETUP.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ The app uses **two separate Cloudflare Pages projects** for clean separation bet
1717
- Deploys: Git tags (e.g., `v2025.12.0`)
1818
- Custom domain: `cambeerfestival.app`
1919

20-
**Project 2: `cambeerfestival-preview`** (Staging + PR previews)
20+
**Project 2: `cambeerfestival-staging`** (Staging + PR previews)
2121
- Production branch: `main` (serves staging)
2222
- Preview branches: PR branches (serve PR previews)
2323
- Deploys: Git main + all PRs
24-
- Custom domain: `preview.cambeerfestival.app`
24+
- Custom domain: `staging.cambeerfestival.app`
2525

2626
### Deployment Architecture
2727

2828
| Git Event | CF Project | CF Branch | URL | Purpose |
2929
|-----------|------------|-----------|-----|---------|
3030
| Version tag | `cambeerfestival` | `release` | `cambeerfestival.app` | Production |
31-
| Push to `main` | `cambeerfestival-preview` | `main` | `preview.cambeerfestival.app` | Staging |
32-
| Pull Request | `cambeerfestival-preview` | `<branch>` | `<branch>.cambeerfestival-preview.pages.dev` | PR previews |
31+
| Push to `main` | `cambeerfestival-staging` | `main` | `staging.cambeerfestival.app` | Staging |
32+
| Pull Request | `cambeerfestival-staging` | `<branch>` | `<branch>.cambeerfestival-staging.pages.dev` | PR previews |
3333
| Push to `main` | GitHub Pages | N/A | `richardthe3rd.github.io/...` | Development |
3434

3535
## Prerequisites
@@ -44,13 +44,13 @@ The app uses **two separate Cloudflare Pages projects** for clean separation bet
4444

4545
You need **two separate Cloudflare Pages projects**:
4646
- `cambeerfestival` (production)
47-
- `cambeerfestival-preview` (staging/previews)
47+
- `cambeerfestival-staging` (staging/previews)
4848

4949
**Option A: Let GitHub Actions Create the Projects (Easiest)**
5050

5151
Both projects will be automatically created on their first deployment. You can skip this step and jump to step 2 (Get Account ID) and step 3 (Create API Token).
5252

53-
- First push to `main` will create `cambeerfestival-preview`
53+
- First push to `main` will create `cambeerfestival-staging`
5454
- First git tag will create `cambeerfestival`
5555

5656
**Option B: Create Projects Manually**
@@ -64,12 +64,12 @@ If you prefer to create the projects manually first:
6464
4. Set **Project name**: `cambeerfestival`
6565
5. Disable automatic deployments (GitHub Actions will handle deployments)
6666

67-
**For Preview Project:**
67+
**For Staging Project:**
6868
1. In **Workers & Pages**, click **Create application****Pages**
69-
2. Set **Project name**: `cambeerfestival-preview`
69+
2. Set **Project name**: `cambeerfestival-staging`
7070
3. Disable automatic deployments
7171

72-
**Important**: Project names must match the workflow configuration (`cambeerfestival` and `cambeerfestival-preview`).
72+
**Important**: Project names must match the workflow configuration (`cambeerfestival` and `cambeerfestival-staging`).
7373

7474
### 2. Get Cloudflare Account ID
7575

@@ -131,19 +131,19 @@ You need to configure **one custom domain per project**:
131131
8. Click **Continue**
132132
9. Cloudflare will automatically configure the DNS records
133133

134-
#### 4b. Preview/Staging Project Domain
134+
#### 4b. Staging Project Domain
135135

136136
1. In Cloudflare Dashboard, go to **Workers & Pages****Pages**
137-
2. Create or select the **`cambeerfestival-preview`** project
137+
2. Create or select the **`cambeerfestival-staging`** project
138138
3. Go to **Settings****Builds & deployments**
139139
4. Set **Production branch** to: `main`
140140
5. Go to **Custom domains** tab
141141
6. Click **Set up a custom domain**
142-
7. Enter: `preview.cambeerfestival.app`
142+
7. Enter: `staging.cambeerfestival.app`
143143
8. Click **Continue**
144144
9. Cloudflare will automatically configure the DNS records
145145

146-
**Note**: The `cambeerfestival-preview` project will be automatically created by GitHub Actions on the first deployment if it doesn't exist.
146+
**Note**: The `cambeerfestival-staging` project will be automatically created by GitHub Actions on the first deployment if it doesn't exist.
147147

148148
#### 4c. Optional: WWW Redirect
149149

@@ -152,14 +152,14 @@ If you want `www.cambeerfestival.app` to redirect to the apex domain:
152152

153153
**DNS Records Created** (automatic):
154154
- `CNAME cambeerfestival.app``cambeerfestival.pages.dev`
155-
- `CNAME preview.cambeerfestival.app``cambeerfestival-preview.pages.dev`
155+
- `CNAME staging.cambeerfestival.app``cambeerfestival-staging.pages.dev`
156156
- `CNAME www.cambeerfestival.app``cambeerfestival.pages.dev` (optional)
157157

158158
### 5. Update Cloudflare Worker
159159

160160
The Cloudflare Worker for API proxy has already been updated to allow both custom domains in CORS origins:
161161
- `https://cambeerfestival.app` (production)
162-
- `https://preview.cambeerfestival.app` (staging)
162+
- `https://staging.cambeerfestival.app` (staging)
163163

164164
When you deploy worker changes:
165165

@@ -456,11 +456,11 @@ Both should remain in free tier unless app sees very high traffic.
456456

457457
**Cloudflare Setup:**
458458
- [ ] Cloudflare Pages project `cambeerfestival` created (production)
459-
- [ ] Cloudflare Pages project `cambeerfestival-preview` created (staging/previews)
459+
- [ ] Cloudflare Pages project `cambeerfestival-staging` created (staging/previews)
460460
- [ ] Production project `cambeerfestival` → Production branch set to `release`
461-
- [ ] Preview project `cambeerfestival-preview` → Production branch set to `main`
461+
- [ ] Staging project `cambeerfestival-staging` → Production branch set to `main`
462462
- [ ] Custom domain `cambeerfestival.app` configured on `cambeerfestival` project
463-
- [ ] Custom domain `preview.cambeerfestival.app` configured on `cambeerfestival-preview` project
463+
- [ ] Custom domain `staging.cambeerfestival.app` configured on `cambeerfestival-staging` project
464464
- [ ] DNS records configured (automatic via Cloudflare)
465465
- [ ] Cloudflare Account ID obtained
466466
- [ ] Cloudflare API Token updated with **both** Workers Scripts + Pages permissions
@@ -473,6 +473,6 @@ Both should remain in free tier unless app sees very high traffic.
473473

474474
**Verification:**
475475
- [ ] Cloudflare Worker updated with both custom domains in CORS origins
476-
- [ ] Push to `main` triggers successful deployment to `https://preview.cambeerfestival.app`
476+
- [ ] Push to `main` triggers successful deployment to `https://staging.cambeerfestival.app`
477477
- [ ] Create tag triggers production deployment to `https://cambeerfestival.app`
478478
- [ ] API calls work without CORS errors on all environments

0 commit comments

Comments
 (0)