Module Integration Guides
...
Integrate Over The Air Updates
App Update with rollback
9 min
this section talks about how to do an app update and roll back to the previous working version of the app if the update fails we have provided an example on our https //github com/bytebeamio/uplink/tree/main/examples/rpi/updates/app update rollback page there are four files in the example hello app prints "hello from bytebeam" every 3 seconds app update rollback sh this script replaces the old application with the new application if the new application doesn't work, this script replaces it with the working version of the application updater this is a wrapper script for app update rollback sh script make firmware update sh it creates the update tar file it is expected that there is a working version of the application on the remote device and is expected to be run by systemd to create an update file, with the custom application, follow these steps step1 prepare update tar firstly on your linux system, we need to create an update tar file for raspberry pi for that, download all the files mentioned above from github next, we need to change the permissions for all these files using chmod command chmod a+x hello app chmod a+x app update sh chmod a+x update sh chmod a+x make firmware update sh next run make firmware update sh to create a tar gz file /make firmware update sh step 2 upload update tar next, we need to upload the tar to https //cloud bytebeam io/ for that go to the device management panel and navigate to the firmware versions tab then click on upload new firmware under the firmware version tab, you will find an option to create a firmware version number and upload your updated tar file enter the new firmware version number and click on choose file to upload tar file then click on create step 3 set the application path in step 1 we have already assumed that you want to update the hello app that exists on your remote device and we created an update tar accordingly on the remote device, the app is expected to be in /usr/local/bin location if it's not there then create a new hello app in /usr/local/bin hello app #!/bin/bash while \[ 1 ] do sleep 3 echo "hi from bytebeam" done if the application location and app name are different, set the path in app update sh script in step 1 app update rollback sh app name=hello app app bin path=/usr/local/bin step 4 create systemctl service to debug update changes to debug your changes after the app update, let's create a service that runs hello app so, c reate this service named \<app name> service and place it in /etc/systemd/system hello app service \[unit] description=simple application service after=network target auditd service \[service] execstart=/usr/bin/bash /usr/local/bin/hello app killmode=process restart=on failure type=simple \[install] wantedby=multi user target reload systemctl daemon and start the service sudo systemctl daemon reload sudo systemctl enable app service sudo systemctl start app step 5 trigger the "update firmware" action from bytebeam cloud now let's proceed with our ota update for that, go to device management panel and select the device next, click on the update firmware in the next prompt choose the firmware version and click on next
