Puppet module for configuring and managing Raspberry Pis running OctoPrint and related software.
Lorem ipsum.
OctoPi is a wonderful project that makes it super easy to get up and running with OctoPrint on a Raspberry Pi. However, for an organization with half a dozen or more Pis running 3d Printers, and a whole bunch more Pis doing other things, it has a few significant disadvantages:
- The pace of releases has been pretty slow recently; there were OctoPi releases in January 2021 and February 2023.
- There's no official upgrade process other than "back everything up, re-image, restore everything".
- We're already managing a bunch of Pis for other purposes, and from a maintenance and update standpoint, it's easiest to just have them all running the same image.
- Raspberry Pi cameras are currently not supported, as we're going to be using more robust USB webcams
- If we want raspicam enabled we need to enable that in
config.txt
like how it's done in OctoPi
- If we want raspicam enabled we need to enable that in
- OctoPi 1.0.0 includes FFMPEG HLS streaming but doesn't use it by default. As such, we don't even include it.
First, obtain a Raspberry Pi 3B or newer and a MicroSD card of 32GB or larger (preferably 64GB or 128GB).
Note that the following instructions assume you're working on a Linux (or maybe Mac?) computer. Please consult a knowledgeable source if you're using Windows.
- Download the latest Raspberry Pi OS 64-bit Lite image. At the moment this is the May 3rd, 2023 image with kernel 6.1 and Debian 11, which has a filename of
2023-05-03-raspios-bullseye-arm64-lite.img.xz
(note the following instructions will all assume this filename) - Extract that image with
xz -d 2023-05-03-raspios-bullseye-arm64-lite.img.xz
- Put a SD card in a USB adapter and plug in to your computer. Write the image to it, replacing
/dev/sdX
with the path to the SD card block device:dd bs=4M if=2023-05-03-raspios-bullseye-arm64-lite.img of=/dev/sdX conv=fsync status=progress
- Mount the first (boot) partition from the SD card (e.g.
mount /dev/sdX1 /mnt/temp
) andcd
to where it's mountedtouch ssh
to enable SSH at boot- Since Raspberry Pi OS no longer has a default user, configure the initial user account for the pi. The (random) password should be on a label on the Pi being used (along with its MAC address). Encrypt that password (replacing
PasswordFromLabelOnPi
with the password from the label) withecho 'PasswordFromLabelOnPi' | openssl passwd -6 -stdin
and write the username (pi
) and output from that command to a file atuserconf
in the formatpi:<encrypted-password>
where<encrypted-password>
is the openssl output. - Unmount the partition (
sync; sync; umount /mnt/temp
)
- On your local computer, create a
wpa_supplicant.conf
file with content for the DM network:ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US network={ ssid="DecaturMakers" psk="<Our Network Key>" key_mgmt=WPA-PSK }
- Mount the second (root) partition from the SD card (e.g.
mount /dev/sdX2 /mnt/temp
) andcd
to where it's mountedcat <path to>/wpa_supplicant.conf > etc/wpa_supplicant/wpa_supplicant.conf
echo octotest > etc/hostname
sed -i "/127.0.1.1/s/raspberrypi/octotest/" etc/hosts
- Unmount the partition (
sync; sync; umount /mnt/temp
)
- Unplug the SD card from your computer and plug it in to the Pi.
- If this is a new Pi and you don't know its MAC address, plug the Pi's wired Ethernet port into your laptop, power up the pi, and fire up Wireshark. When the Pi starts sending DHCPDISCOVER messages, get its MAC address.
- If this Pi isn't already set up in the UniFi network controller, set up a fixed IP lease for its MAC address.
- Wait for the Pi to settle a bit, and then unplug power and then Ethernet. Once the UniFi changes propagate out to the router, plug the Pi in for real.
ssh pi@<IP Address of Pi>
using the password on the label in the enclosure. Assuming you properly set up the files on the boot partition, when the Pi finishes booting up it will be running SSH for remote login and have the default (pi) user configured.- Perform a full system update:
sudo apt update && sudo apt upgrade && sudo reboot
; once the reboot is done, log back in via SSH. sudo raspi-config
- System Options -> Hostname (set to
sidedoorpi
) - System Options -> Network at Boot -> wait for network at boot
- Localisation Options -> Locale (unselect
en_GB.UTF-8 UTF-8
and selecten_US.UTF-8 UTF-8
; set the default locale toen_US.UTF-8
) - Localisation Options -> Timezone (select America -> New York)
- System Options -> Wireless LAN -> select "US" for country then cancel when asked for the SSID.
- System Options -> Boot / Auto Login -> Console
- Finish, Reboot
- System Options -> Hostname (set to
sudo apt install puppet git r10k
sudo su -
ssh-keygen
- just hit Enter for every prompt (no passphrase)cat /root/.ssh/id_rsa.pub
- Add the output of that (the content of
/root/.ssh/id_rsa.pub
) as a deploy key on this repository echo -e "Host github.com\n StrictHostKeyChecking no\n UserKnownHostsFile /dev/null\n" >> ~/.ssh/config && chmod 0600 ~/.ssh/config
cd /root && git clone git@github.com:DecaturMakers/dm-puppet.git && cd dm-puppet
./bin/run_r10k_puppet.sh
- At this point you should probably
reboot
just to make sure all changes will be active.
- Enjoy!