This repo has tools and instructions to create Raspberry Pi OS images for running IMPSY.
This repo just contains Ansible playbooks for setting up a fresh image running on a Raspberry Pi.
Ideally the setup could be done on an emulated Raspberry Pi in a Docker container (e.g., using pi-ci), but that's a bit hard so far. For now we have instructions for a physical Raspberry Pi.
The releases contain images that can be used to get an IMPSY system up and running quickly. The iamge should be compatible with Raspberry Pis 3, 4, 5 and Zero 2 W.
You can flash the custom image to an SD card using Raspberry Pi Imager
You'll need a Raspberry Pi 4 or 5 (suggested, although 3 and Zero 2 W may technically work) and a 16GB SD card (it's better not to use a huge SD card to save time when copying it).
-
Download the Raspberry Pi Imager
-
Under the Operating System drop down, select
Raspberry Pi OS (other)and thenRaspberry Pi OS Lite (64-bit)"A port of Debian Bookworm" (these instructions tested with the 2024-07-04 release). -
Under the storage dropdown select your SD card
-
Click
NEXT. -
In the "Use OS customisation?" window, click
EDIT SETTINGS. -
Set the
GENERALsettings as follows:
- Set hostname
impsypi.local - Set username and password:
- Username:
pi - Password:
raspberry(or your choice of another password, but you will need to remember it)
- Username:
- (you can also set up wireless LAN here if you want, not mandatory)
- Set the
SERVICESsettings as follows:
- Check
Enable SSHand selectUse password authentication
-
Save the settings, click
YESto apply custom settings andNEXTto start writing the SD card. -
Put the SD card into a Raspberry Pi and connect it to a network that you can access. You will need to check that you can connect to the Raspberry Pi at
pi@impsypi.localvia SSH.
Once you've completed these steps, you can continue to install IMPSY and configure the Raspberry Pi.
This part of the guide uses Ansible to install:
- poetry, IMPSY, and it's dependencies on the Raspberry Pi
- setup IMPSY to run at boot
- configure the Raspberry Pi to enable ethernet over USB port, so we can connect to it later without an ethernet cable
Once you have setup the host Raspberry Pi, connect it to a network (easiest to use ethernet, not wifi) and ensure than you can login at pi@impsypi.local via SSH.
You will need to ensure that you have installed ansible and sshpass in order to complete the next step.
- Run the ansible tasks with
ansible-playbook -i ./hosts.yml ./impsy.yml --ask-pass
That's it! That should take a while, go get a coffee.
You should be able to:
- SSH to the pi at
pi@impsypi.local - Test that the systemd services are working:
sudo systemd status impsy-run.servicesudo systemd status impsy-web.service
- View the IMPSY web UI at
http://impsypi.local:4000orhttp://169.254.1.107:4000
Once you have verified that everything is working, time to suck off this image, basically following these instructions.
-
Shutdown the Raspberry Pi (gracefully), take out the SD card and plug it into a computer
-
Save the SD filesystem to a
.imgfile:
-
On MacOS I find out the
/dev/diskXentry withdiskutil list -
Then, unmount the disk:
diskutil unmountDisk /dev/diskX -
Then I extract the image with
time sudo gdd if=/dev/rdiskX of=./impsy.img bs=16M status=progress && sync(N.B.rdiskfor "raw disk").
- Use PiShrink to compress the image from the docker image
monsieurborges/pishrink
docker run --privileged=true --rm --volume $(pwd):/workdir monsieurborges/pishrink pishrink -Zv impsy.img impsy-shrunk.img
The final impsy-shrunk.img.xz file is ready for release.
To install on a Raspberry Pi:
-
download one of the
.img.xzimages from the releases area -
open Raspberry Pi Imager, select
Use customunder Operating System, then flash to your SD card. Selectnofor applying custom settings (unless you want to, but not sure if it works or is useful..) -
put the SD card into a Raspberry Pi and boot it up
N.B.: Experience seems to show that the image works best on the second boot, and that slower Raspberry Pis (3B+, Zero 2 W), will take quite a while to boot up. Remember that the blinking light on Raspberry Pi indicates disk access.
For more information on using IMPSY, see the main repo, or the workshop site