Skip to content

As developer I want to be able to deploy mocktioneer on Cloudflare #22

@aram356

Description

@aram356

Deploy Cloudflare Worker for Mocktioneer

Summary

Set up Cloudflare Workers deployment for Mocktioneer using the EdgeZero framework, enabling edge-based mock auction responses for Prebid.js testing.


Description

This ticket covers setting up and deploying the application to Cloudflare Workers via EdgeZero. It involves creating a Cloudflare account, understanding the EdgeZero framework, and configuring the deployment pipeline.

EdgeZero is a production-ready toolkit for portable edge HTTP workloads that enables writing code once and deploying across multiple platforms including Cloudflare Workers, Fastly Compute, and native Axum servers.


Prerequisites

  • Rust and Cargo installed locally
  • Git access to the Mocktioneer repository
  • Basic understanding of Rust and serverless concepts

Acceptance Criteria

1. Cloudflare Account Setup

  • Create a Cloudflare account at https://dash.cloudflare.com/sign-up
  • Verify email and complete account setup
  • Navigate to Workers & Pages section
  • Note your Account ID (found in the right sidebar of Workers dashboard)
  • Generate an API Token with "Edit Cloudflare Workers" permissions:
    • Go to My ProfileAPI TokensCreate Token
    • Use the "Edit Cloudflare Workers" template
    • Store the token securely (you'll need it for CI/CD)

2. EdgeZero CLI Setup

  • Clone the EdgeZero repository: git clone https://github.com/stackpop/edgezero
  • Install EdgeZero CLI via Cargo: cargo install --path crates/edgezero-cli
  • Verify installation: edgezero --help

3. Understand EdgeZero Framework

EdgeZero is a production-ready toolkit for portable edge HTTP workloads. Key concepts to learn:

  • Request Handling: How incoming requests are routed and processed
  • Response Generation: Creating mock bid responses at the edge
  • Environment Variables: Managing secrets and configuration
  • Middleware Pattern: How request/response pipelines work
  • Multi-platform deployment: Understanding wasm32-unknown-unknown target for Cloudflare

Resources to review:

4. Project Configuration

  • Review the EdgeZero configuration file (edgezero.toml)
  • Configure environment variables and bindings for Cloudflare Workers target

5. Local Development

  • Run the worker locally: edgezero dev
  • Test endpoints respond correctly: curl http://127.0.0.1:8787/
  • Verify mock bid responses are generated properly

6. Deploy via EdgeZero

  • Build for Cloudflare Workers target (wasm32-unknown-unknown)
  • Deploy to Cloudflare Workers
  • Verify the deployment URL works

7. CI/CD Integration (Optional)

  • Add CLOUDFLARE_API_TOKEN to GitHub repository secrets
  • Add CLOUDFLARE_ACCOUNT_ID to GitHub repository secrets
  • Configure GitHub Actions workflow for automatic EdgeZero deployments

Technical Notes

EdgeZero Supported Platforms

Platform Target Status
Fastly Compute wasm32-wasip1 Stable
Cloudflare Workers wasm32-unknown-unknown Stable
Axum (Native) Host Stable

EdgeZero Key Files

  • Configuration: edgezero.toml
  • Entry point: Application source files
  • Router configuration: Request routing logic

Common EdgeZero Commands

Command Description
edgezero new my-app Create a new EdgeZero project
edgezero dev Start local development server

Troubleshooting


Definition of Done

  • Cloudflare account created and configured
  • EdgeZero CLI installed and working
  • Local development environment working
  • Worker successfully deployed via EdgeZero to Cloudflare
  • Deployment URL returns expected mock responses
  • Documentation updated with deployment notes (if applicable)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions