Pi-Appliance is a template for building appliances in Python on the RaspberryPi. We are focused on appliances which connect to various AWS services, so we assume an AWS environment configuration.
It includes:
- a configuration manager ("builder") to configure and package the appliance code for your Pi
- an installer ("installer") which bootstraps the appliance
- a web UI for the appliance
- a minimal framework for building and running your appliance code
- If you downloaded it, extract the file to wherever you want to work with it.
- If you cloned it, delete the
.gitdirectory in your clone.
- Modify the
pyproject.tomlconfiguration file:
[tool.poetry]
name = "{{Put Your Project Name Here}}"
version = "0.1.0"
description = "{{Put Your Project Description Here}}"
authors = [{{Put Your Name/email Here}}]
- Install Poetry is you haven't already.
- Run
poetry installto create and populate the Virtual Environment for the project. - Write your code. See Write Your Appliance Code, below. Code, test, repeat.
- Use the Builder (see below) to configure the appliance and write that configuration to your Pi's SD Card.
- Boot the Pi, run
initial-setup, rejoice in the magic.
All appliance code goes in the appliance folder, in appliance.py and any
other code files you deem necessary. appliance.py contains a skeleton you can
use to start your work. See the appliance README for
futher details.
By default, pytest and pylama are installed as dev dependencies; feel free
to make use of them, or don't.
The builder module configures the features and requirements of your appliance.
Run it as:
$ poetry run python -m builderRead more in the builder module docs.
After you've used the builder to deploy the bootstrap files to the SD card:
- Unmount the SD card
- Install it into the Pi, and boot the Pi
- (Use
ping raspberrypi.localto see when it comes on-line) - SSH into the Pi using your favorite tool; password defaults to
raspberry- Putty on Windows
- Command line:
ssh pi@raspberrypi.local - If you're working on your n-th pi, the "raspberrypi.local" host is probably already in your known_hosts file; remove it as needed.
- Run
bash /boot/initial-setup.sh {new-hostname} {new-password}- Use a new-hostname which is NOT already on your network
- Make sure to note (or use an established pattern for) the new-password
- Take another coffee break while ↑ completes
- This will clone the repository your appliance code is in. Make sure it's pushed to the remote!
- Unless there are errors - watch the screen - the Pi will reboot and start running your appliance code
Every time the appliance starts up, either due to reboot, or by operation of the WebUI, the appliance will pull all code updates from the repository's default branch (whatever you define that as). To update your appliance code, just push it to the default branch and reload/reboot the appliance.