Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #49

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# WASI Rust Sample
# Sample: `wasi:http` in Rust

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/yoshuawuyts/rust-wasi-hello)

An example project showing how to build an HTTP server for WASI 0.2 built in
Rust.
An example project showing how to build a spec-compliant
[`wasi:http/proxy`][wasi-http] server for WASI 0.2 written in Rust. This sample
includes several [routes](#routes) that showcase different behavior. This sample
can be run by any spec-compliant `wasi:http/proxy` server.

Each release of this sample is packaged up as a [Wasm OCI image][wasm-oci-image]
and published to the [GitHub Packages Registry][gh-pkg]. See the ["Deploying
published artifacts"][using-arifacts] section for more on how to fetch and run
the published artifacts.

## Routes

Expand Down Expand Up @@ -38,7 +45,7 @@ The HTTP server uses the `wasi:http/proxy` world. You can run it locally in a
$ cargo component serve
```

## Working with deployment artifacts
## Deploying published artifacts

This project automatically published compiled Wasm Components as OCI to GitHub
Artifacts. You can pull the artifact with any OCI-compliant tooling and run it
Expand All @@ -47,8 +54,8 @@ latest published version from GitHub releases and run it in a local `wasmtime`
instance you can run the following command:

```bash
$ wkg pull ghcr.io/yoshuawuyts/rust-wasi-hello:latest
$ wasmtime serve rust-wasi-hello.wasm
$ wkg pull ghcr.io/bytecodealliance/sample-wasi-http-rust/sample-wasi-http-rust:latest
$ wasmtime serve sample-wasi-http-rust.wasm
```

For production workloads however, you may want to use other runtimes or
Expand All @@ -66,3 +73,7 @@ on the pull + serve pattern we've shown here.
Apache-2.0 with LLVM Exception

[cargo-component]: https://github.com/bytecodealliance/cargo-component
[wasm-oci-image]: https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact/
[gh-pkg]: https://github.com/bytecodealliance/sample-wasi-http-rust/pkgs/container/sample-wasi-http-rust%2Fsample-wasi-http-rust
[using-arifacts]: #working-with-deployment-artifacts
[wasi-http]: https://github.com/WebAssembly/wasi-http