{"id":18993134,"url":"https://github.com/redbadger/rpi-wasmcloud-demo","last_synced_at":"2026-04-05T17:39:14.599Z","repository":{"id":39652121,"uuid":"316021941","full_name":"redbadger/rpi-wasmcloud-demo","owner":"redbadger","description":"Demo running wasmcloud lattice on MacOS and 2x Raspberry Pi 4B","archived":false,"fork":false,"pushed_at":"2022-06-08T12:14:04.000Z","size":11950,"stargazers_count":24,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-22T11:54:30.213Z","etag":null,"topics":["oled-ssd1306","raspberry-pi","raspberry-pi-4b","wasmcloud","wasmcloud-lattice"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redbadger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-25T18:24:12.000Z","updated_at":"2024-12-05T13:11:36.000Z","dependencies_parsed_at":"2022-09-20T08:02:43.789Z","dependency_job_id":null,"html_url":"https://github.com/redbadger/rpi-wasmcloud-demo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/redbadger/rpi-wasmcloud-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Frpi-wasmcloud-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Frpi-wasmcloud-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Frpi-wasmcloud-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Frpi-wasmcloud-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redbadger","download_url":"https://codeload.github.com/redbadger/rpi-wasmcloud-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Frpi-wasmcloud-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280878347,"owners_count":26406641,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["oled-ssd1306","raspberry-pi","raspberry-pi-4b","wasmcloud","wasmcloud-lattice"],"created_at":"2024-11-08T17:19:56.744Z","updated_at":"2025-10-24T22:37:06.984Z","avatar_url":"https://github.com/redbadger.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi wasmcloud Demo\n\nThis is a demo of a wasmCloud [lattice](https://www.wasmcloud.dev/reference/lattice) running across an Apple MacBook Pro and 2 x Raspberry Pi 4B.\n\n\u003e _The lattice is a self-forming, self-healing mesh network that provides a unified, flattened topology across any number of disparate environments, clouds, browsers, or even hardware._\n\nIn this example, the lattice is made of three [wasmcloud](https://wasmcloud.dev/) nodes, one on the Mac and one on each Pi. However it would work just as well with one Pi, simply collapse `pi_01` and `pi_02` together as you go.\n\nThe Mac node hosts the wasmcloud [HTTP Server Capability](https://github.com/wasmCloud/capability-providers) that forwards incoming requests to our sandboxed [Wasm](https://webassembly.org/) actor, which can run on any node, but in this demo runs on `pi_02`.\n\nWasmcloud has a built-in [Logging Capability](https://github.com/wasmCloud/capability-providers), which the actor uses to log to `stdout`.\n\nThe Wasm actor contains our \"business\" logic. It is signed and only given permissions to talk with the HTTP Server capability, the Logging capability, the NumberGen capability (for generating a uuid to identify the actor instance) and our OLED capability. This OLED capability is hosted by the wasmCloud host running on `pi_01`, where it natively controls an OLED display.\n\n![wasmcloud lattice across Mac and Pi](./docs/wasmcloud-lattice.svg)\n\n## Setup\n\n1. make sure I2C is enabled on `pi-01` (the Pi with the Oled display attached).\n\n    ```bash\n    sudo raspi-config\n    ```\n\n2. install Rust on each Pi\n\n    ```bash\n    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n    ```\n\n3. install Elixir on each Pi\n\n    ```bash\n    echo \"deb https://packages.erlang-solutions.com/debian buster contrib\" \\\n    | sudo tee /etc/apt/sources.list.d/erlang-solutions.list\n\n    wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc \\\n    \u0026\u0026 sudo apt-key add erlang_solutions.asc \\\n    \u0026\u0026 rm erlang_solutions.asc\n\n    sudo apt update\n    sudo apt install erlang-parsetools erlang-dev elixir\n    ```\n\n4. clone the `wasmcloud-otp` repo, then build `host_core` on each Pi\n\n    ```bash\n    git clone git@github.com:wasmCloud/wasmcloud-otp.git\n    cd wasmcloud-otp\n    git checkout v0.52.2\n    cd host_core\n    make build\n    ```\n\n5. install the OLED display with SSD1306 display driver, on `pi-01`\n\n    1. [MakerHawk OLED Display Module, SSD1306, 128x64](https://smile.amazon.co.uk/gp/product/B0777HHQDT)\n    2. Header pins need soldering onto the OLED board\n    3. Jumper leads to these pins on the Pi:\n        1. `VCC` - pin 1\n        2. `GND` - pin 6\n        3. `SCL` - pin 5\n        4. `SDA` - pin 3\n\n6. find the IP address of your Mac (this may list several, in which case choose one on the interface to the subnet containing your Raspberry Pi devices)\n\n    ```sh\n    ./automation/macos.mjs --ip\n    ```\n\n    and add the Mac's IP address and hostname to `/etc/hosts` on each Pi, so that you can use the OCI registry hosted on the mac.\n\n7. run NATS server, wasmcloud, redis, and a local OCI registry, on the Mac\n\n    ```sh\n    ./automation/macos.mjs --up\n    ```\n\n8. run a wasmCloud host on each Pi:\n\n    ```bash\n    git clone git@github.com:redbadger/rpi-wasmcloud-demo.git\n    cd rpi-wasmcloud-demo\n\n    ./automation/rpi.mjs --up\n    ```\n\n9. open the washboard in a browser on the mac (\u003chttp://localhost:4000\u003e) for starting providers, actors and defining links.\n\n10. you may want to install these extensions into vscode (on the Mac and the Pi that you use to build the provider)\n\n    1. [Remote SSH](https://code.visualstudio.com/docs/remote/ssh) - useful for writing code directly on a Pi.\n    2. [Rust Analyzer](https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer) - essential :-)\n\n11. install `wash` on the Mac:\n\n    ```sh\n    # using homebrew ...\n    brew tap wasmcloud/wasmcloud\n    brew install wash\n\n    # ... or with cargo\n    cargo install wash-cli\n    ```\n\n12. install `wash` on the Pi that is used to build the provider:\n\n    ```sh\n    cargo install wash-cli\n    ```\n\n## Build\n\nBuild the provider and the actor, and push them to an OCI registry.\n\n### `provider`\n\n```sh\n# on a Raspberry Pi, e.g. via ssh, or vscode remote\n\n# install node\ncurl -fsSL https://fnm.vercel.app/install | bash\nsource /home/pi/.bashrc\n\nfnm install 16\n\n# install zx\nnpm i --global zx\n\n# install dirsh\ncargo install dirsh\n\n# build provider\n./provider/make.mjs --build --push\n\n# push to registry on mac (ensure there is an entry in /etc/hosts for `registry`, pointing at Mac)\nmake push\n```\n\n### `actor`\n\n```sh\n# on the MacBook\n./actor/make.mjs --build --push\n```\n\n## Run\n\n```sh\n./automation/macos.mjs --start\n```\n\n## Test\n\n```sh\n# to test\ncurl -d 'Hello from wasmcloud!' http://127.0.0.1:8080\ncurl -X DELETE http://127.0.0.1:8080\n```\n\n![Photo of setup](docs/wasmcloud.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbadger%2Frpi-wasmcloud-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredbadger%2Frpi-wasmcloud-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbadger%2Frpi-wasmcloud-demo/lists"}