I have an application that runs on a RPi 3. This application can update itself by checking for a new version on a web server. If there's a new version, it downloads it from the server, runs a contained installation script, then reboots and the user is good to go.
My problem is that as the application evolves, there are many more linux and python packages and configuration changes that are required, and managing all the different versions is extremely difficult. Not to mention, larger upgrades take a long time and if the user shuts down or otherwise interferes during the upgrade, it could break the application.
I'm trying to figure out a better way of doing things here. I know one way would be to have images that are installed. In other words, I have an image I create, they use that exact image and then there's no chance of anything breaking. But is it possible to download and install a new RPi image remotely, or is this something that can only be done with a device (usb, sd)? If this isn't possible, is there some other better practice for something like this?