When I published the 2nd edition of Raspberry Pi Full Stack and its first update in 2018, the current version of the operating system was Raspbian Buster. Python was at version 3.8.1, and the Raspberry Pi 4 was relatively new.
It is now the middle of 2022, and my Full Stack app has been working for many years without missing a beat. I created the first iteration on an original Raspberry Pi Model B, and the second iteration on a Raspberry Pi 3. Then, in 2018, I updated the course so that the application would work on a Raspberry Pi 4.
Even though the application is working reliably, I decided that it is time for an update.
In this update, the focus was in the software side of the application. I show you how to update the various software components in a disciplined way and with a minimum amount of effort. My goal is to update the software modules that the application needs, while maintaining all functionality and avoiding changes to the application itself.
On the flip side, the hardware remains he same. I am running or have tested the Full Stack application on an original Raspberry Pi Model B, a Raspberry Pi Zero, Raspberry Pi 4, and Raspberry Pi 3.
The operating system is a major component of our application. When I published this course, the latest version of the Raspberry Pi operating system was Buster, version 10.1. Today, we have a 64-bit version of Raspberry Pi OS Bullseye, version 11.
Upgrading from Raspberry Pi OS version 10 to version 11 is a major upgrade.
Doing this kind of upgrade in place requires the replacement of millions of files and changes and configuration. Much of the process of an operating system upgrade is automated, but getting the application that is running well on the old OS to continue to function under the new OS often requires a lot of work that is difficult to standardise and document so that you can follow and learn from.
One of my objectives is to do a disciplined and minimal-effort upgrade, so I opted to upgrade the operating system to the latest available version of Buster, which is version 10.13.
If, at a later point, I decide to use Bullseye for the Full Stack app, I will start with a fresh copy of the operating system on a new SD card, and build up the application from there.
This is something that I have actually done, but I only recommend if you are starting from scratch. I’ll come back to this point later in this briefing.
Luckily, the Raspberry Pi OS is built on Debian Linux, which uses the APT package manager. The Full Stack application depends on the Nginx web server and the SQLite3 database server, and those are easily upgradable with APT.
I am also using APT to upgrade the Raspberry Pi OS to version 10.13.
The Full Stack application is written in Python, and uses the Python 3 interpreter.
After extensive testing, I found that the newest version of Python that does not break features is Python 3.8.13. When I first published this course, I use Python 3.8.1.
Unfortunately, versions of Python that are 3.9 or newer break the Python wrapper for the RF24 transceiver module. As I wanted to keep all of the functionality of the application, I opted to upgrade to Python 3.8.13 and not the currently available version 3.10.5.
I will come back to this if I find a way to successfully compile the RF24 Python wrapper with Python 3.10 or newer.
Once I had found the latest compatible version of Python 3, I upgraded all other Python modules and tested that they worked as expected. With the exception of the Adafruit DHT22 module, it is easy to update the Python modules. The Adafruit DHT22 module requires a hack if you are using a Raspberry Pi 4. More about this later.
Finally, the Full Stack application interfaces with several Cloud applications, such as IFTTT, Google Charts and Plotly.
After updating the individual software components of the application, I restored and tested the Cloud functionality.
I’m pleased to say that all Cloud applications have made no breaking changes to their public APIs, so everything worked as expected.
To help with the update process, I have created an update version tracker on Google Sheets.
You can find this tracker by typing the short URL you see here in your browser. Make a copy of the sheet so that you can edit it.
I used this tracker as I was updating my own Full Stack application, and captured the entire process in a new series of lecture videos. It contains before and after versions for the various components, information URLs and test and install commands for each one.
I have recorded a series of new lectures to help you update your Full Stack application.
You can find these lectures in a new sections at the end of the course, titled “Full Stack application update”.
Have you already completed the course?
If you have already completed this course and you have a working Full Stack application, then you can consider updating it by following the instructions in the new update lectures.
It is very likely that your starting point will be different to mine. For example, you may be starting from Raspberry Pi OS 10.4 and Python 3.8.5.
This is Ok.
Be sure to start by taking a full backup of your SD card so that you can always start again if something goes wrong. I show you how to make and restore backups in the first part of the course.
Once you have your backup, begin the update process as I am showing in the new lectures.
Are you new to this course?
If you are starting this course now, you obviously don’t have a Full Stack application to update.
As you are starting from scratch, you will be getting the latest versions of the various software components by default, unless you specifically restrict the component version using the apt and pip package managers.
Please keep the information in this slide in mind as you go through the course. At the time I am recording this briefing, I have not yet added reminders about these points in the original course lectures, so please try to remember.
As far as the operating system is concerned, it is ok to use the latest available version. I have tested with the 32-bit version of Raspberry Pi 11, Bullseye, and the application worked well.
It is also OK to use the latest available versions of Nginx and SQLite3. The APIs for these components have not changed.
Be careful with the Python interpreter. If you want to use the RF24 transceiver, the latest Python you can use is Python 3.8.13. Watch the two new lectures at the end of the course titled “Update system Python to 3.8.13” and “Update Python Virtual Environment to 3.8.13” for information on how to do this.
For most other Python modules, it is ok to use their latest versions, except for these exceptions:
- The Adafruit DHT22 module is fixed to version 1.4.1.
- The Plotly module is fixed to version 3.10.
- The RF24 Python wrapper and module is fixed to version 1.4.3.
- The RF24 Network Python wrapper and module is fixed to version 1.0.17.
In the update version tracker, you will find command examples that show you how to restrict components to a specific version.
If you are using a Raspberry Pi 4, the Adafruit DHT22 library will require you to do a simple hack in one of the module files. The hack is required because this library was archived before the Raspberry Pi 4 came out, and it was not updated to be able to recognise the new hardware. You can learn how to get this library to work with the Raspberry Pi 4 at the beginning of the lecture titled “Tweak the application to work with the updated components” in the last section of the course.
I hope you will enjoy the updated Raspberry Pi Full Stack!