GithubHelp home page GithubHelp logo

isabella232 / viceroy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fastly/viceroy

0.0 0.0 0.0 634 KB

Viceroy provides local testing for developers working with Compute@Edge.

License: Apache License 2.0

Dockerfile 0.22% Makefile 0.69% Rust 98.29% WebAssembly 0.80%

viceroy's Introduction

Viceroy

Viceroy provides local testing for developers working with Compute@Edge. It allows you to run services written against the Compute@Edge APIs on your local development machine, and allows you to configure testing backends for your service to communicate with.

Viceroy is normally used through the Fastly CLI's fastly compute serve command, where it is fully integrated into Compute@Edge workflows. However, it is also a standalone open source tool with its own CLI and a Rust library that can be embedded into your own testing infrastructure.

Installation

Via the Fastly CLI

As mentioned above, most users of Compute@Edge should do local testing via the Fastly CLI, rather than working with Viceroy directly. Any CLI release of version 0.34 or above supports local testing, and the workflow is documented here.

As a standalone tool from crates.io

To install Viceroy as a standalone tool, you'll need to first install Rust if you haven't already. Then run cargo install viceroy, which will download and build the latest Viceroy release.

Usage as a library

Viceroy can be used as a Rust library. This is useful if you want to run integration tests in the same codebase. We provide a helper method handle_request. Before you build or test your code, we recommend to set the release flag e.g. cargo test --release otherwise, the execution will be very slow. This has to do with the Cranelift compiler, which is extremely slow when compiled in debug mode. Besides that, if you use Github Actions don't forget to setup a build cache for Rust. This will speed up your build times a lot.

Usage as a standalone tool

NOTE: the Viceroy standalone CLI has a somewhat different interface from that of the Fastly CLI. Command-line options below describe the standalone Viceroy interface.

After installation, the viceroy command should be available on your path. The only required argument is the path to a compiled .wasm blob, which can be built by fastly compute build. The Fastly CLI should put the blob at bin/main.wasm. To test the service, you can run:

viceroy bin/main.wasm

This will start a local server (by default at: http://127.0.0.1:7878), which can be used to make requests to your Compute@Edge service locally. You can make requests by using curl, or you can send a simple GET request by visiting the URL in your web browser.

Working with Viceroy's source

Note that this repository uses Git submodules, so you will need to run

git submodule update --recursive --init

to pull down or update submodules.

Documentation

Since the Fastly CLI uses Viceroy under the hood, the two share documentation for everything other than CLI differences. You can find general documentation for local testing here, and documentation about configuring local testing here. Documentation for Viceroy's CLI can be found via --help.

Colophon

Viceroy

The viceroy is a butterfly whose color and pattern mimics that of the monarch butterfly but is smaller in size.

viceroy's People

Contributors

aturon avatar jakechampion avatar acw avatar mgattozzi avatar fgsch avatar acfoltzer avatar integralist avatar pchickey avatar jedisct1 avatar kination avatar starptech avatar gsquire avatar phamann avatar tschneidereit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.