How to run serverless applications augmented by Wasm
SlingShot is a Wasm runner to run or serve Extism Wasm plug-ins.
Run a wasm plug-in:
./slingshot run --wasm=./hello.wasm --handler=hello --input="Bob 🤓"
Serve a wasm plug-in as a function:
./slingshot listen --wasm=./hello.wasm --handler=handle --http-port=7070
Trigger a wasm plug-in with Redis messages:
./slingshot redis subscribe --wasm=./hello.wasm --handler=message \
--uri=${REDIS_URI} \
--client-id=007 \
--channel=news
Trigger a wasm plug-in with NATS messages (✋ experimental 🚧 WIP):
./slingshot nats subscribe --wasm=./hello.wasm --handler=message \
--url=${NATS_SERVER_URL} \
--connection-id=007 \
--subject=news
Execute a remote wasm file:
./slingshot run \
--wasm-url="http://0.0.0.0:9000/print.wasm" \
--wasm=./print.wasm \
--handler=callHandler \
--input="🤓 I'm a geek"
Run Slingshot with Docker (multi arch image 🐳):
HTTP_PORT=8080
docker run \
-p ${HTTP_PORT}:${HTTP_PORT} \
-v $(pwd)/hello-service:/app --rm botsgarden/slingshot:0.0.5 \
/slingshot start \
--wasm=./app/hello.wasm \
--handler=callHandler \
--http-port=${HTTP_PORT}
Slingshot is developed in Go with Wazero1 as the Wasm runtime and Extism2, which offers a Wazero-based Go SDK and a Wasm plugin system.
- Download the latest release of SlingShot: https://github.com/bots-garden/slingshot/releases for your machine and OS.
- Rename it to
slingshot
- Check by typing:
./slingshot version