Phoenix UI based firmware updates?

We have nerves deployed on some Pi4CM boxes that are used in various remote locations, with no easy way to get internet to them. We sometimes need to do fw updates, currently this entails getting an overlay network setup to the device so we can access it remotely, and then uploading the new fw using ./upgrade.sh

This is however a real pain, and sometimes not possible.

Has anyone ever managed to allow firmware upgrades using a web UI, the devices are running Phoenix also, so already have a WebUI in place? The network are completely closed and air-gapped (apart from when we need to do updates), so whilst security isn’t a non-concern, it’s also not a problem for us that somebody could upload an unknown firmware.

I did see that there used to be a nerves_firmware_http package, but it doesn’t look like it’s been updated in a very long time, with some outdated dependencies e.t.c

Anyone got any pointers/suggestion, or is this just a really silly idea, and should we be taking a different approach?

Thanks!

1 Like

@ream88 maybe you?

1 Like

That’s what https://www.nerves-hub.org/ is all about.

1 Like

@gazzer82 I can indeed help, I could you show you the code I wrote in a screen sharing session as it is still closed source.

Thx @hubertlepicki for the ping

1 Like

If you can use an internet connection, NervesHub/NervesCloud is probably the way to go.

If not but you already have a Phoenix UI on your devices, I think you can use the fwup library to apply an update on the local device. Just upload the firmware file to disk and call Fwup.apply/4 to run the upgrade. Or I think it supports streaming the update as well. This is how NervesHub does it

2 Likes

If this is too spontaneous, this is essentially what we did at tagbase.io: x.com

I use a custom Phoenix.LiveView.UploadWriter to initiate a Fwup.Stream process on the device and then transfer the firmware using distributed Erlang.

3 Likes

True, it can be easily used, even self-hosted if you don’t get into the current beta.

The even nicer thing is that you can use the new feature shared_secrets that doesn’t require working with client-side ssl certificates, you basically whack the nerveshub_web behind a reverse proxy and you are good to go.

Whoah, so many helpful replies!

Hosting Nerves Hub isn’t an options as we don’t have anywhere to run it, and it’s just too heavy for this.

Looks like calling fwup from the live view via the upload handler might be the winner. I’ll digest the information provided and see if I can get something working, might have to pop back here for some pointers if it hey stuck.

Thanks Everyone!

1 Like

Hey, if you, or anyone else in this thread, would like an invite and demo of NervesCloud, please send me a DM.

We have some early customers using this in production, along with hobby users.

We are working on some pricing options which scale for teams, as well as supporting hobby projects for free.