Fastly Compute Adapter
The Fastly adapter runs Mocktioneer on Fastly's Compute platform, providing global edge deployment with low latency.
Overview
| Property | Value |
|---|---|
| Crate | mocktioneer-adapter-fastly |
| Target | wasm32-wasip1 |
| Platform | Fastly Compute |
| Use Case | Production edge deployment |
Prerequisites
Fastly CLI
bashbrew install fastly/tap/fastly # Or download from https://developer.fastly.com/tools/cliWASM target
bashrustup target add wasm32-wasip1Fastly account with Compute enabled
Local Development
Push the config first
/openrtb2/auction and /e/dtb/bid are fail-loud — push the typed config to the Fastly config store before serving (static/pixel/sizes work without it):
cp mocktioneer.toml.example mocktioneer.toml
cargo run -p mocktioneer-cli -- config push --adapter fastly --localRun locally using Fastly's Viceroy runtime:
# Using the CLI
edgezero-cli serve --adapter fastly
# or, in-repo (no external install):
cargo run -p mocktioneer-cli -- serve --adapter fastly
# Or directly
fastly compute serve -C crates/mocktioneer-adapter-fastlyThis starts a local server that emulates the Fastly Compute environment.
Building
# Using EdgeZero CLI
edgezero-cli build --adapter fastly
# Or directly
cargo build --release --target wasm32-wasip1 -p mocktioneer-adapter-fastlyThe build produces a WASM binary at:
target/wasm32-wasip1/release/mocktioneer-adapter-fastly.wasmDeployment
First-Time Setup
/openrtb2/auction and /e/dtb/bid read bid_cpm from the remote Fastly config store via the fail-loud AppConfig extractor. Deploying alone is not enough — without the config store created, seeded and linked, those endpoints return 503 config_out_of_date. Run the three steps in this order:
# 1. Create the remote config store and append [setup.config_stores.*] to fastly.toml
cargo run -p mocktioneer-cli -- provision --adapter fastly
# 2. Push the typed config blob into the store just created
cp mocktioneer.toml.example mocktioneer.toml # if you haven't already
cargo run -p mocktioneer-cli -- config push --adapter fastly --yes
# 3. Deploy — creating the service consumes [setup] and links the store to it
cargo run -p mocktioneer-cli -- deploy --adapter fastlyThe deploy will prompt you to:
- Create a new service or select existing
- Configure the domain
- Deploy the WASM bundle
Already-deployed services skip [setup]
Fastly consumes [setup.config_stores.*] only when deploy creates a new service. If fastly.toml already declares a service_id, the store is created in your account but is not linked to the service, so the runtime cannot open it. provision detects this and prints the exact one-shot command to finish the job — look up the store id with fastly config-store list --json, then:
fastly resource-link create --service-id=<SERVICE-ID> --resource-id=<STORE-ID> \
--version=latest --autoclone --name=mocktioneer_configThe link clones the active version, so live traffic is unaffected until you run fastly service-version activate.
Subsequent Deployments
# Using EdgeZero CLI
edgezero-cli deploy --adapter fastly
# Or directly
fastly compute deploy -C crates/mocktioneer-adapter-fastlyUpdating the Config
bid_cpm lives in the config store, not the WASM bundle — after editing mocktioneer.toml, re-push; no redeploy is needed:
cargo run -p mocktioneer-cli -- config diff --adapter fastly # preview
cargo run -p mocktioneer-cli -- config push --adapter fastly --yesDeployment Lifecycle (staging)
mocktioneer-cli also exposes the Fastly staging-lifecycle commands from EdgeZero for a safe deploy → verify → roll-forward-or-back loop:
# Capture the current live version BEFORE deploying (your rollback target)
cargo run -p mocktioneer-cli -- active-version --adapter fastly
# After deploying a staged version, probe its health (retries; non-zero on fail)
cargo run -p mocktioneer-cli -- healthcheck --adapter fastly
# Roll back to a previous version (or deactivate a staged one) if it's unhealthy
cargo run -p mocktioneer-cli -- rollback --adapter fastlyConfiguration
Build Settings
[adapters.fastly.build]
target = "wasm32-wasip1"
profile = "release"
features = ["fastly"]Logging
[adapters.fastly.logging]
endpoint = "mocktioneerlog"
level = "info"
echo_stdout = falseFastly logging requires a configured log endpoint. Create one in the Fastly console:
- Go to your service configuration
- Add a logging endpoint (e.g., S3, BigQuery, or HTTPS)
- Name it to match
endpointin the config
fastly.toml
The crates/mocktioneer-adapter-fastly/fastly.toml contains Fastly-specific configuration:
[local_server]
# Local development settings
[local_server.backends]
# Backend configurations if neededCustom Domains
Add custom domains to your Fastly service:
fastly domain create --service-id <SERVICE_ID> --name mocktioneer.example.comOr configure in the Fastly console under Domains.
Environment Variables
Fastly Compute doesn't support traditional environment variables. Instead, use:
- Config stores for configuration
- Secret stores for sensitive data
- Edge dictionaries for key-value lookups
Monitoring
Logs
View logs in real-time:
fastly log-tail --service-id <SERVICE_ID>Metrics
Monitor in the Fastly dashboard:
- Request rate
- Error rate
- Response time percentiles
- Cache hit ratio (if caching enabled)
Troubleshooting
Build Errors
If you see WASM-related errors:
# Ensure target is installed
rustup target add wasm32-wasip1
# Clean and rebuild
cargo clean
cargo build --release --target wasm32-wasip1 -p mocktioneer-adapter-fastlyLocal Server Issues
# Check Viceroy is working
fastly compute serve --verbose -C crates/mocktioneer-adapter-fastlyDeployment Failures
# Validate the package
fastly compute validate -C crates/mocktioneer-adapter-fastly
# Check service status
fastly service describe --service-id <SERVICE_ID>Performance Considerations
Fastly Compute has some constraints:
| Limit | Value |
|---|---|
| Memory | 128 MB |
| Request timeout | 60 seconds |
| Package size | 100 MB |
Mocktioneer is well within these limits for typical usage.
Next Steps
- Set up logging endpoints in Fastly console
- Configure custom domains
- Review API reference for endpoint testing
- Consider Cloudflare adapter as an alternative