File tree Expand file tree Collapse file tree 7 files changed +3439
-7
lines changed
Expand file tree Collapse file tree 7 files changed +3439
-7
lines changed Original file line number Diff line number Diff line change 1+ # ` hello-world-wasmcloud `
2+
3+ - ` wadm.yaml ` : includes the ` Application ` CR to deploy a wasmCloud app to K8s.
4+ - ` wasmcloud-host.yaml ` : incldues the ` WasmCloudHostConfig ` CR to dpeloy a wasmCloud host to K8s.
5+
6+ > Note: Usage of both files assumes you've installed the wasmcloud-operator onto your cluster.
7+
8+ Once deployed, port forward the wasmcloud-host deployment and curl the app.
Original file line number Diff line number Diff line change 1+ apiVersion : core.oam.dev/v1beta1
2+ kind : Application
3+ metadata :
4+ name : rust-hello-world
5+ annotations :
6+ description : ' HTTP hello world demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)'
7+ spec :
8+ components :
9+ - name : http-component
10+ type : component
11+ properties :
12+ image : ghcr.io/danbugs/serverside-wasm-book-code/hello-world-wasmcloud:v1
13+ traits :
14+ - type : spreadscaler
15+ properties :
16+ instances : 10
17+ - type : link
18+ properties :
19+ namespace : wasi
20+ package : keyvalue
21+ interfaces : [store, atomics]
22+ target :
23+ name : kvnats
24+ config :
25+ - name : wasi-keyvalue-config
26+ properties :
27+ bucket : default
28+ enable_bucket_auto_create : ' true'
29+
30+ - name : httpserver
31+ type : capability
32+ properties :
33+ image : ghcr.io/wasmcloud/http-server:0.23.2
34+ traits :
35+ - type : link
36+ properties :
37+ target : http-component
38+ namespace : wasi
39+ package : http
40+ interfaces : [incoming-handler]
41+ source_config :
42+ - name : default-http
43+ properties :
44+ address : 0.0.0.0:8080
45+
46+ - name : kvnats
47+ type : capability
48+ properties :
49+ image : ghcr.io/wasmcloud/keyvalue-nats:0.3.1
Original file line number Diff line number Diff line change 1+ apiVersion : k8s.wasmcloud.dev/v1alpha1
2+ kind : WasmCloudHostConfig
3+ metadata :
4+ name : wasmcloud-host
5+ spec :
6+ lattice : default
7+ version : " 1.4.1"
8+ hostReplicas : 2
Original file line number Diff line number Diff line change 1+ # ` hello-world-spin `
2+
3+ - Pre-reqs:
4+ - K8s cluster w/ the container-spin-shim installed on every node.
5+ - cert-manager installed onto the cluster.
6+ - Spin's RuntimeClass applied.
7+ - Spin's CRDs applied.
8+ - Spin's operator installed.
9+ - Spin's executor created.
10+
11+ - Then, assuming you have ` spin ` installed, run:
12+ ``` shell
13+ spin build
14+ spin registry push ghcr.io/< your GH username> /serverside-wasm-book-code/scaling-spin:latest
15+ spin kube scaffold --from ghcr.io/< your GH username> /serverside-wasm-book-code/scaling-spin:latest --autoscaler hpa --cpu-limit 100m --memory-limit 128Mi --cpu-request 50m --memory-request 64Mi --replicas 1 --max-replicas 10 | kubectl create -f –
16+ ```
17+
18+ - Then, you can test it with:
19+ ``` shell
20+ # assuming an ingress controller was applied
21+ oha -c 40 -z 3m -t 5s http://localhost:8081/load
22+ ```
Original file line number Diff line number Diff line change 11{
2- "version" : 1 ,
3- "project" : {
4- "worlds" : [
5- " spin-http"
6- ]
7- },
8- "packages" : {}
2+ "version" : 1 ,
3+ "project" : {
4+ "worlds" : [
5+ " spin-http"
6+ ]
7+ },
8+ "packages" : {
9+ "@fermyon/spin-sdk" : {
10+ "witPath" : " ../../bin/wit" ,
11+ "world" : " spin-imports"
12+ }
13+ }
914}
You can’t perform that action at this time.
0 commit comments