8000 GitHub - credibil-grid/wasmgrid: A PoC runtime for WASI WebAssembly components.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

credibil-grid/wasmgrid

Repository files navigation

Wasm Grid Runtime

An interim runtime for running WASI WebAssembly components.

This wasm runtime is a stop-gap solution until production-grade runtimes such as wasmtime can support components based on the wasi-cloud-core specifications.

Quick Start

Add a .env file in the root of the project with the following values:

# tracing log level, e.g. "wasmgrid=debug,async_nats=info,azure_core=info"
RUST_LOG="wasmgrid=debug" 
HTTP_ADDR="0.0.0.0:8080"
NATS_ADDR="demo.nats.io"
MGO_URI="<MongoDB connection string>"
KV_ADDR="<Azure Key Vault URI>"

# when using Synadia Cloud:
NATS_ADDR="tls://connect.ngs.global"
NATS_JWT="<user JWT>"
NATS_SEED="<user signing seed>"
WITH_CORS="true"

In order for a connection to Azure Key Vault to be made use the Azure CLI to authenticate before running examples:

az login

Messaging Example

examples/pub-sub/README.md. examples/request-reply/README.md.

Http Example

See examples/http/README.md.

Docker

Build and Run

docker build --platform=linux/arm64 -t acrcredibil.azurecr.io/demo/wasmgrid .
docker compose up

Compiling a WASM component

docker run \
	-v ./target/wasm32-wasip2/release/keyvalue.wasm:/app.wasm \
	acrcredibil.azurecr.io/demo/wasmgrid \
	/app/wasmgrid compile /app.wasm

Troubleshooting

MUSL build

To test the MUSL build locally:

# brew install FiloSottile/musl-cross/musl-cross
brew tap messense/macos-cross-toolchains
brew install aarch64-unknown-linux-musl
brew install openssl
cargo build --package wasmgrid --target aarch64-unknown-linux-musl --release

See https://docs.wasmtime.dev/examples-minimal.html/ for more information on optimising embedded wasmtimebuilds.

Debugging bindgen! macro

cargo expand --manifest-path crates/services/Cargo.toml keyvalue::generated > expanded.rs

Nex

cp target/aarch64-unknown-linux-musl/release/wasmgrid ~/Downloads/wasmgrid
cp target/wasm32-wasi/release/http.wasm ~/Downloads/http.wasm

sudo cp /mnt/macos/wasmgrid /home/ubuntu/nex/wasmgrid
sudo cp /mnt/macos/http.wasm /home/ubuntu/nex/http.wasm

About

A PoC runtime for WASI WebAssembly components.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
0