This repo contains the different files and references used during a Youtube live session between Fermyon and SUSE.
The topic was Giving Rancher Desktop A Spin: Wasm on Kubernetes
Youtube replay: https://www.youtube.com/live/EJxpxowmx6Y
(Session occured on the 25th June 2024)
The setup used during the demo was the following:
- Main OS: OpenSUSE Aeon RC2
- Virtual Machine: Windows Server 2025 Standard build 26236
- Remote desktop: MacOS Sonoma
- Rancher Desktop v1.14+
The following applications were installed as dependencies for the demo:
- Rustup
Linux | Windows | MacOS |
---|---|---|
sudo zypper install -y rustup | winget install rustup | brew install rustup |
- Git
Linux | Windows | MacOS |
---|---|---|
sudo zypper install -y git-core | winget install git.git | brew install git |
- [Optional] Visual Studio Code
Linux | Windows | MacOS |
---|---|---|
winget install | brew install visual-studio-code |
- [Optional] Rest client plugin for Visual Studio Code
Click on the Plugins
icon and search for "Rest Client" > Click Install
- Windows
Build tools need to be also installed for building the demos:
winget install Microsoft.VisualStudio.2022.BuildTools
The following configurations were done on Rancher Desktop:
- Select
containerd
inPreferences > Container Engine
- Enable
WebAssembly
inPreferences > Container Engine
- Enable
Install Spin Operator
inPreferences > Kubernetes
The kube
plugin for spin
CLI was installed as follow:
spin plugins update
spin plugins install kube
For the RUST examples, the following libraries were added:
rustup target add wasm32-wasi
This demo showcased the different components available after a fresh install of Rancher Destkop.
Depending on the container runtime selected, docker
or nerdctl
will be the container management CLI available.
kubectl
is available for both container runtimes if Kubernetes
is enabled.
Spin CLI is available and enabled by default and can be used as a standalone with the spin
command.
This demo was based on the SpinKube Quickstart.
After the install and configuration of Rancher Desktop, the demo was the following:
# Install the app
kubectl apply -f https://raw.githubusercontent.com/spinkube/spin-operator/main/config/samples/simple.yaml
# Port forward
kubectl port-forward svc/simple-spinapp 8083:80
# Test it
curl localhost:8083/hello
An alternate way for accessing the app using the default Rancher Desktop ingress was also part of the demo:
# Create a YAML file for the ingress with the following content
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: spinapp
namespace: default
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: simple-spinapp
port:
number: 80
# Apply the Ingress configuration
kubectl apply -f [ingress file]
# Test it
curl localhost/hello
Once the demo showed, the following clean-up tasks were performed:
# Delete the Ingress configuration
kubectl delete -f [ingress file]
# Delete the app
kubectl delete -f https://raw.githubusercontent.com/spinkube/spin-operator/main/config/samples/simple.yaml
This demo was based on the blog Introducing SpinKube.
# Create a new Spin App
spin new -t http-rust --accept-defaults spin-kube-app
cd spin-kube-app
# Build the Spin App
spin build
# Push the Spin App to an OCI registry
export IMAGE_NAME=ttl.sh/spin-app-$(uuidgen):1h
spin registry push $IMAGE_NAME
# Deploy the Spin App to Kubernetes
spin kube scaffold -f $IMAGE_NAME | kubectl apply -f -
Once the demo showed, the following clean-up tasks were performed:
# Delete app
spin kube scaffold -f $IMAGE_NAME | kubectl delete -f -
This demo was based on the Enterprise Architectures and Patterns - caching-rust which available on the Fermyon GitHub repo.
With all the dependencies installed as mentioned above, the demo was the following:
# Build the app
spin build
# Run the app and load the DB data
spin up --runtime-config-file ./local.toml --sqlite @migrations.sql
# Test it with REST Client
# Get items
GET http://127.0.0.1:3000/items
###
# Get only 1 items
GET http://127.0.0.1:3000/items/d660b9b2-0406-46d6-9efe-b40b4cca59fc
###
PUT http://127.0.0.1:3000/items/d660b9b2-0406-46d6-9efe-b40b4cca59fc HTTP/1.1
content-type: application/json
{
"name": "Bananas"
}
# Login into Fermyon Cloud
spin cloud login
# Deploy the app
spin deploy
## Answer yes to create DB and KV
# Test it via the browser with the [app URL]/items
How can we deploy this demo to SpinKube?