{"id":15779758,"url":"https://github.com/rgl/spin-http-rust-example","last_synced_at":"2026-04-16T13:32:20.499Z","repository":{"id":221110301,"uuid":"753477326","full_name":"rgl/spin-http-rust-example","owner":"rgl","description":"Example Spin HTTP Application written in Rust","archived":false,"fork":false,"pushed_at":"2024-05-12T15:17:10.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-31T11:06:13.847Z","etag":null,"topics":["rust","spin","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-06T07:45:28.000Z","updated_at":"2024-05-12T15:17:01.000Z","dependencies_parsed_at":"2024-02-06T08:43:54.718Z","dependency_job_id":"cb03ee1a-61b1-4c06-8702-4b775379d03e","html_url":"https://github.com/rgl/spin-http-rust-example","commit_stats":null,"previous_names":["rgl/spin-http-rust-example"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-rust-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-rust-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-rust-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-rust-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/spin-http-rust-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246492285,"owners_count":20786339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","spin","wasm","webassembly"],"created_at":"2024-10-04T18:21:23.995Z","updated_at":"2026-04-16T13:32:20.457Z","avatar_url":"https://github.com/rgl.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\n[![Build status](https://github.com/rgl/spin-http-rust-example/workflows/build/badge.svg)](https://github.com/rgl/spin-http-rust-example/actions?query=workflow%3Abuild)\n\nExample Spin HTTP Application written in Rust.\n\n# Usage\n\nInstall [Rust](https://github.com/rust-lang/rust), the [wasm32-wasi target](https://bytecodealliance.github.io/cargo-wasi/steps.html) and [Spin](https://github.com/fermyon/spin).\n\nStart the application:\n\n```bash\nspin up --build\n```\n\nAccess the HTTP endpoint:\n\n```bash\nxdg-open http://localhost:3000\n```\n\n# Container Image Usage\n\nThere are two ways to run a WebAssembly binary in a container:\n\n1. Ship the `spin` binary and your `.wasm` file in a docker container image.\n2. Ship the `.wasm` file and the `spin.toml` manifest file in a oci image\n   artifact; this can be done in a single step with `spin registry push`.\n   Then use a container runtime or orchestrator that supports running wasm\n   containers. For example, `containerd` and the `containerd-shim-spin-v2`\n   containerd shim.\n\n**NB** The Fermyon Cloud directly uses the `.wasm` file, so there is no need to\nuse a container. Instead use `spin deploy` to deploy the application to the\nFermyon Cloud.\n\n## Kubernetes Usage\n\nSee https://developer.fermyon.com/spin/v2/kubernetes.\n\n## containerd Usage\n\nInstall [containerd](https://github.com/moby/containerd) and the [containerd-shim-spin](https://github.com/deislabs/containerd-wasm-shims/tree/main/containerd-shim-spin).\n\n### containerd crictl Usage\n\nUse `crictl`:\n\n```bash\n# see https://kubernetes.io/docs/concepts/architecture/cri/\n# see https://kubernetes.io/docs/tasks/debug/debug-cluster/crictl/\n# see https://kubernetes.io/docs/reference/tools/map-crictl-dockercli/\n# see https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md\n# see https://github.com/kubernetes-sigs/cri-tools/blob/master/cmd/crictl/sandbox.go\n# see https://github.com/kubernetes-sigs/cri-tools/blob/master/cmd/crictl/container.go\n# see https://github.com/kubernetes/cri-api/blob/kubernetes-1.27.10/pkg/apis/runtime/v1/api.proto\ncrictl pull \\\n  ghcr.io/rgl/spin-http-rust-example:0.3.1\ncrictl images list\ncrictl info | jq .config.containerd.runtimes\ninstall -d -m 700 /var/log/cri\ncat \u003ecri-spin-http-rust-example.pod.yml \u003c\u003c'EOF'\nmetadata:\n  uid: cri-spin-http-rust-example\n  name: cri-spin-http-rust-example\n  namespace: default\nlog_directory: /var/log/cri/cri-spin-http-rust-example\nEOF\ncat \u003ecri-spin-http-rust-example.web.ctr.yml \u003c\u003c'EOF'\nmetadata:\n  name: web\nimage:\n  image: ghcr.io/rgl/spin-http-rust-example:0.3.1\ncommand:\n  - /\nlog_path: web.log\nEOF\npod_id=\"$(crictl runp \\\n  --runtime spin \\\n  cri-spin-http-rust-example.pod.yml)\"\nweb_ctr_id=\"$(crictl create \\\n  $pod_id \\\n  cri-spin-http-rust-example.web.ctr.yml \\\n  cri-spin-http-rust-example.pod.yml)\"\ncrictl start $web_ctr_id\nweb_ctr_ip=\"$(crictl inspectp $pod_id | jq -r .status.network.ip)\"\nwget -qO- \"http://$web_ctr_ip\"\ncrictl ps -a                    # list containers.\ncrictl inspect $web_ctr_id | jq # inspect container.\ncrictl logs $web_ctr_id         # dump container logs.\ncrictl pods                     # list pods.\ncrictl inspectp $pod_id | jq    # inspect pod.\ncrictl stopp $pod_id            # stop pod.\ncrictl rmp $pod_id              # remove pod.\nrm -rf /var/log/cri/cri-spin-http-rust-example\n```\n\n### containerd ctr Usage\n\n**NB** This is not yet working. See https://github.com/deislabs/containerd-wasm-shims/issues/202.\n\nUse `ctr`:\n\n```bash\nctr image pull \\\n  ghcr.io/rgl/spin-http-rust-example:0.3.1\nctr images list\nctr run \\\n  --detach \\\n  --runtime io.containerd.spin.v2 \\\n  --net-host \\\n  ghcr.io/rgl/spin-http-rust-example:0.3.1 \\\n  ctr-spin-http-rust-example\nctr sandboxes list # aka pods.\nctr containers list\nctr container rm ctr-spin-http-rust-example\n```\n\n# References\n\n* [Spin Rust SDK](https://github.com/fermyon/spin/tree/main/sdk/rust)\n* [Spin Rust SDK Examples](https://github.com/fermyon/spin/tree/main/examples)\n* [Spin Rust SDK crate](https://crates.io/crates/spin-sdk)\n* [Building Spin Components in Rust](https://developer.fermyon.com/spin/v2/rust-components)\n* [Done icon](https://icons8.com/icon/uw-X2j32n7Xp/done)\n* [Creating a container image](https://github.com/deislabs/containerd-wasm-shims/blob/main/containerd-shim-spin/quickstart.md#creating-a-container-image)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fspin-http-rust-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fspin-http-rust-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fspin-http-rust-example/lists"}