There are a few ways to set up the development environment in order to follow this workshop:
If working on your machine (i.e. not using GitHub Codespaces), first clone the repository locally:
$ git clone https://github.com/fermyon/workshops && cd workshops/magic-8-ball
First, you have to configure Spin by following the instructions for your operating system from the Spin documentation.
For Linux (including WSL2) and macOS, you have the option to use HomeBrew
brew tap fermyon/tap
brew install fermyon/tap/spin
For Windows (not WSL2), see here:
Alternatively, you can manually install from a GitHub release, or you can build Spin from source.
At this point, you should be able to run Spin commands:
spin --version
If you installed Spin using the install script, it also installs the plugins and templates needed for this workshop. If you used another method to install Spin, install the templates and plugins necessary for the workshop like so:
You may also find the following templates helpful for extending beyond the workshop.
spin templates install --git https://github.com/fermyon/spin-kv-explorer --update
spin templates install --git https://github.com/radu-matei/spin-nextjs --update
Depending on the programming languages you want to use, you will need to configure their toolchains. For example:
- Rust (including the Wasm/WASI target:
rustup target install wasm32-wasi
) - Node.js and NPM
- Go and TinyGo
This repository contains the necessary files to open the project and develop inside a container, using Visual Studio Code Dev Containers.
Note: Spin currently cannot run using QEMU. For macOS on Apple Silicon, you have to configure Docker Desktop to Use Rosetta for x86/amd64 emulation on Apple Silicon. You can enable this under Settings -> Features in development in Docker Desktop.
After following the VS Code documentation, you can open the directory in a container:
You can complete this workshop using only your browser using GitHub Codespaces. To achieve this, navigate to the GitHub repository for this workshop, https://github.com/fermyon/workshops, then click on the "Clone, open, or download button", then select "Codespaces", click "Create codespace on main`, then follow the instructions:
A: Make sure you have configured your Rust toolchain, and have added the wasm32-wasi
target using rustup target add wasm32-wasi
.
A: Make sure you have configured Node.js and npm
, and that you have executed npm install
in the directory with your component's package.json
file that contains the dependencies.
In this section you learned how to:
- Install the latest Spin CLI version (canary)
- Install the latest Spin templates
- Install the latest Spin plugins (canary for JS)
- Proceed to 01 - Getting started with Spin