Meet Sat [Part 3]: Run Sat on a Pi4
I re-installed my Pi4 this weekend, and I decided to use it for my experiments with Sat and WebAssembly. Today, I wrote a short post about how I installed Sat on my RaspberryPi.
You should read these posts before resuming your reading:
- Meet Sat, the tiny wasm function server
- Meet Sat [Part 2]: Take care of your Runnables with the GitLab Package Registry
Pre-requisites
- I used a Pi4
- I installed Ubuntu Server 64-bit edition on it (follow these steps: https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#2-prepare-the-sd-card)
Softwares to install
Once connected (with SSH) on your Pi, you need to install:
- Git (if not present):
sudo apt-get install git
- Make:
sudo apt-get install make
- Screen (if not present):
sudo apt-get install screen
- Go compiler:
curl -o go1.17.6.linux-armv6l.tar.gz https://dl.google.com/go/go1.17.6.linux-armv64.tar.gz sudo tar -C /usr/local -xzf go1.17.6.linux-armv6l.tar.gz echo "PATH=\$PATH:/usr/local/go/bin" >> ~/.profile echo "GOPATH=\$HOME/go" >> ~/.profile source ~/.profile
Install Sat on the RaspberryPi
On your Pi (always with SSH), run the below commands to clone the Sat repository, and to build Sat:
git clone https://github.com/suborbital/sat.git
cd sat
make sat
sudo cp .bin/sat /usr/local/bin
Start Sat
As explained in the previous post (Meet Sat [Part 2]: Take care of your Runnables with the GitLab Package Registry), I will deploy a wasm Runnable to Sat using the GitLab Package Registry.
To run a Sat process and quit ssh without killing the process, we'll use screen
command:
screen
# Run your process
# Change the GitLab project ID
project_id="33178966"
wasmfile="hello.wasm"
version="0.0.0"
package_name="hello-sat"
SAT_HTTP_PORT=8080 sat https://gitlab.com/api/v4/projects/${project_id}/packages/generic/${package_name}/${version}/${wasmfile}
Then you can exit the screen
session without stopping Sat:
ctrl + a + d
# you can no quit ssh ssh
The following commands are useful when you're using
screen
screen -r # to come back to the process screen -ls # if more than one 'screen' is running
Call the wasm micro-service
You can call the wasm micro-service from anywhere on your network:
curl http://192.168.1.42:8080 -d 'Bob Morane'\n
And it's insanely fast!
btw, I started a new side project: a remote Sat launcher to start Sat processes remotely, it's a
🚧 work in progress, but I hope to be able to write about it soon (its little name is Procyon).
That's it for today.
👋
- If you loved this "post" (or not), don't forget to use the emojis reactions
- Don't hesitate to add comments and/or ask questions
- You can subscribe to the Rss feed