viceroy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseViceroy — Local Fastly Compute Runtime
Viceroy — 本地Fastly Compute运行时
Viceroy is Fastly's official local testing environment for Compute applications. It emulates the Fastly Compute platform, allowing you to develop and test WASM services locally.
Viceroy documentation: https://github.com/fastly/Viceroy
Viceroy是Fastly官方的Compute应用本地测试环境。它可以模拟Fastly Compute平台,让你能够在本地开发和测试WASM服务。
Viceroy文档:https://github.com/fastly/Viceroy
Common Gotchas
常见注意事项
- Dictionaries and ConfigStores are both supported but configured differently in . Dictionaries go under
fastly.tomlas inline key-value maps or JSON files. ConfigStores go under[local_server.dictionaries].[local_server.config_stores] - must have a
fastly.tomlsection. Without it, Viceroy won't know about your backends, stores, or other local overrides. Every backend your app calls must be listed under[local_server].[local_server.backends] - Default port is 7676, not 5000 (which is Fastlike's default). Access your app at .
http://127.0.0.1:7676 - Backends should point to local servers when developing locally. Avoid proxying to remote production origins to prevent accidentally leaking request data.
- 同时支持Dictionaries和ConfigStores,但在中的配置方式不同。Dictionaries需配置在
fastly.toml下,可使用内联键值对或JSON文件;ConfigStores则配置在[local_server.dictionaries]下。[local_server.config_stores] - 必须包含
fastly.toml配置段。如果没有该段,Viceroy将无法识别你的后端、存储或其他本地覆盖配置。应用调用的每个后端都必须在[local_server]下列出。[local_server.backends] - 默认端口为7676,而非5000(Fastlike的默认端口)。请通过访问你的应用。
http://127.0.0.1:7676 - 开发时后端应指向本地服务器。避免代理到远程生产源站,以防意外泄露请求数据。
Quick Start
快速开始
bash
undefinedbash
undefinedInstall Viceroy
Install Viceroy
cargo install --locked viceroy
cargo install --locked viceroy
Build your Compute app
Build your Compute app
fastly compute build
fastly compute build
Start local server (default: 127.0.0.1:7676)
Start local server (default: 127.0.0.1:7676)
viceroy -C fastly.toml bin/main.wasm
viceroy -C fastly.toml bin/main.wasm
Or use the Fastly CLI wrapper
Or use the Fastly CLI wrapper
fastly compute serve
undefinedfastly compute serve
undefinedReferences
参考资料
| Topic | File | Use when... |
|---|---|---|
| Serve | fastly-compute-serve.md | Starting local dev server, profiling, advanced server options |
| Config | fastly-compute-config.md | Configuring fastly.toml backends, stores, geolocation, device detection, ACLs |
| Test | fastly-compute-test.md | Running Rust unit tests with cargo-nextest, writing tests for Compute services |
| Adapt | fastly-compute-adapt.md | Converting core WASM modules to Component Model, custom build pipelines |
| 主题 | 文件 | 适用场景 |
|---|---|---|
| 服务启动 | fastly-compute-serve.md | 启动本地开发服务器、性能分析、高级服务器选项配置 |
| 配置 | fastly-compute-config.md | 配置fastly.toml后端、存储、地理位置、设备检测、访问控制列表(ACLs) |
| 测试 | fastly-compute-test.md | 使用cargo-nextest执行Rust单元测试、编写Compute服务测试用例 |
| 适配 | fastly-compute-adapt.md | 将核心WASM模块转换为Component Model、自定义构建流水线 |