viceroy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Viceroy — 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服务。

Common Gotchas

常见注意事项

  • Dictionaries and ConfigStores are both supported but configured differently in
    fastly.toml
    . Dictionaries go under
    [local_server.dictionaries]
    as inline key-value maps or JSON files. ConfigStores go under
    [local_server.config_stores]
    .
  • fastly.toml
    must have a
    [local_server]
    section.
    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.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,但在
    fastly.toml
    中的配置方式不同。Dictionaries需配置在
    [local_server.dictionaries]
    下,可使用内联键值对或JSON文件;ConfigStores则配置在
    [local_server.config_stores]
    下。
  • fastly.toml
    必须包含
    [local_server]
    配置段
    。如果没有该段,Viceroy将无法识别你的后端、存储或其他本地覆盖配置。应用调用的每个后端都必须在
    [local_server.backends]
    下列出。
  • 默认端口为7676,而非5000(Fastlike的默认端口)。请通过
    http://127.0.0.1:7676
    访问你的应用。
  • 开发时后端应指向本地服务器。避免代理到远程生产源站,以防意外泄露请求数据。

Quick Start

快速开始

bash
undefined
bash
undefined

Install 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
undefined
fastly compute serve
undefined

References

参考资料

TopicFileUse when...
Servefastly-compute-serve.mdStarting local dev server, profiling, advanced server options
Configfastly-compute-config.mdConfiguring fastly.toml backends, stores, geolocation, device detection, ACLs
Testfastly-compute-test.mdRunning Rust unit tests with cargo-nextest, writing tests for Compute services
Adaptfastly-compute-adapt.mdConverting 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、自定义构建流水线