GithubHelp home page GithubHelp logo

isabella232 / fastly-edge-compute-poc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from condenast/fastly-edge-compute-poc

0.0 0.0 0.0 29 KB

An experiment in developing, building, testing, deploying and automation for Fastly Compute@Edge services.

Dockerfile 39.81% Rust 60.19%

fastly-edge-compute-poc's Introduction

CondeNast Fastly Compute@Edge Proof of Concept

An experiment in developing, building, testing, deploying and automation for Fastly Compute@Edge services.

The live version of this service is available at https://condenast-poc.edgecompute.app/

What is this?

Fastly Compute@Edge uses the Lucet runtime to let us run our own code in each of Fastly's points of presence around the world. This means that code can run much closer to our consumers and deliver faster responses. To do this we need to write code in a language that can be compiled to WebAssembly, like Rust. This project is an experiment to understand the process and practices required to develop, build, test, and deploy code in this environment.

How does this work?

When you install the Rust toolchain (or when compiling Rust code) you can specify which compilation target you want to use. By default, when you compile using tools such as cargo or rustc which are part of the default Rust toolchain, Rust compiles for x86 systems. The Fastly CLI tool, on the other hand, compiles for WASM + WASI systems by default.

Fastly is not doing anything special or magic. You can check this by running cargo build --target wasm32-wasi which, assuming you have done the prerequisite steps for compiling WebAssembly on your computer, will produce a .wasm file in the target directory which is identical to the output produced from running fastly compute build.

Developing

Follow the https://developer.fastly.com/learning/compute/ guide to start working on the code.

Note: If you're using Visual Studio Code and Docker you can use the provided dev container to avoid installing dependencies locally. Use the Remote-Containers: Open Workspace in Container command.

Test

This will compile our Rust code to an x86_64 target which means it can run natively on your computer, allowing us to test our code locally and in CI.

cargo test --all

Build

This will compile all the Rust code (including the Fastly crates) to a WebAssembly target so it can run in the Fastly Compute@Edge environment.

fastly compute build
fastly compute validate -p pkg/fastly-edge-compute-poc.tar.gz

Deploy

Deployment is managed by the continuous integration pipeline. All changes that are merged to the default branch are built, tested and then await a manual "hold" step before being deployed. This is done with the Fastly CLI tool.

fastly compute deploy --token ${FASTLY_API_TOKEN} --service-id ${FASTLY_SERVICE_ID}

See the pipeline in CircleCI (requires authentication)

fastly-edge-compute-poc's People

Contributors

zapthedingbat 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.