|
5 | 5 | An example project showing how to build an HTTP server for WASI 0.2 built in
|
6 | 6 | Rust.
|
7 | 7 |
|
| 8 | +## Installation |
| 9 | + |
| 10 | +The easiest way to try this project is by opening it in a GitHub Codespace. This |
| 11 | +will create a VS Code instance with all dependencies installed. If instead you |
| 12 | +would prefer to run this locally, you can run the following commands: |
| 13 | + |
| 14 | +```bash |
| 15 | +$ curl https://wasmtime.dev/install.sh -sSf | bash # install wasm runtime |
| 16 | +$ cargo install cargo-component # install build tooling |
| 17 | +$ cargo install wkg # install wasm OCI tooling |
| 18 | +``` |
| 19 | + |
| 20 | +## Local Development |
| 21 | + |
| 22 | +The HTTP server uses the `wasi:http/proxy` world. You can run it locally in a |
| 23 | +`wasmtime` instance by using the following [cargo-component] command: |
| 24 | + |
| 25 | +```rust |
| 26 | +$ cargo component run |
| 27 | +``` |
| 28 | + |
| 29 | +## Working with deployment artifacts |
| 30 | + |
| 31 | +This project automatically published compiled Wasm Components as OCI to GitHub |
| 32 | +Artifacts. You can pull the artifact with any OCI-compliant tooling and run it |
| 33 | +in any Wasm runtime that supports the `wasi:http/proxy` world. To fetch the |
| 34 | +latest published version from GitHub releases and run it in a local `wasmtime` |
| 35 | +instance you can run the following command: |
| 36 | + |
| 37 | +```bash |
| 38 | +$ wkg pull ghcr.io/yoshuawuyts/rust-wasi-hello:latest |
| 39 | +$ wasmtime serve rust-wasi-hello.wasm |
| 40 | +``` |
| 41 | + |
| 42 | +For production workloads however, you may want to use other runtimes or |
| 43 | +integrations which provide their own OCI integrations. Deployment will vary |
| 44 | +depending on you providers, though at their core they will tend to be variations |
| 45 | +on the pull + serve pattern we've shown here. |
| 46 | + |
8 | 47 | ## Roadmap
|
9 | 48 |
|
10 | 49 | - [x] Get a base version compiling
|
|
16 | 55 | - [ ] Automatically publish a package on GitHub Release
|
17 | 56 | - [ ] Add a load-testing example
|
18 | 57 | - [ ] Upstream and integrate `scripts/` into their respective packages
|
| 58 | +- [ ] Add deploy remote artifact |
| 59 | +- [ ] Show wkg pull and run locally |
19 | 60 |
|
20 | 61 | ## License
|
21 | 62 |
|
22 | 63 | MIT OR Apache-2.0
|
| 64 | + |
| 65 | +[cargo-component]: https://github.com/bytecodealliance/cargo-component |
0 commit comments