OTA update of my binary

Is there a way to push OTA (Over the air) update to my binary app that had been built with Go? How?

I’m thinking about below logic, but not sure if it can be done, specially point 5,6,7 as the app will be already shut down?!

// 1. Check current binary version
// 2. Read latest version from repository
// 3. Download the new version (if any)
// 4. Shut done current instant of the app
// 5. Delete the current app binary from the device
// 6. Move the newly downloaded version to the original path of the app
// 7. Launch an instant of the new version

So, do you make any embedded software? because that are many tool to make deployment into servers

or do you need create a OTA feature manually ?

Yes

I got it, so, I don’t know any project in Go that implements this, I know only the OTA on project embedded, like Espressif, FreeRTOS and IOT Core, and so on, this on the client and server side, now if you need create this, I thing on the server side is more common, but now on the client side depends the device like ESP32 and how do you need to send the bytes OTA(over the air), bluetooth, mqtt and so on

I’ve implemented this before, but it was only for a single operating system (CentOS) and an always-running service. I accomplished it by doing the following:

  • Spin up a goroutine in App that checks for new version at predefined interval (will vary based on your needs).
  • If new version exists, grab the new binaries and static content (I have something building binaries; if you don’t, you could grab source and build a new binary. Obviously if you want to build a binary, you’re adding a dependency to go being installed on the target machine).
  • At this point, exec.Command an update script that:
    • Runs database updates (not sure if you have a data layer, but most apps do).
    • Makes sure new app binary has +x.
    • Copies binary over the top of currently running binary (CentOS is fine with this).
    • Runs systemctl restart $myService to restart service and use new binary.

Bottom line: an easy way to accomplish this is to ship your app with an updater. It could be a script, it could be its’ own binary. Depending on the type of app (is it a service that’s always running? A GUI app that a user launches? Etc.) you’re building, you’ll want the updater to work differently.

1 Like

Thanks alot, Ill give it a try.

1 Like

How? I’d a look at the link you shared but couldn’t find it.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/ota.html
https://docs.aws.amazon.com/freertos/latest/userguide/freertos-ota-dev.html

But this links don’t have anything about with Go,

The MinIO distributed file system project has binary upgrade functionality and is written in Go.