Latest Auto-Update Approach?

59 views
Skip to first unread message

be...@benjismith.net

unread,
Aug 10, 2021, 2:32:41 PM8/10/21
to nw.js
Hi, I've been using NWJS in production for 6+ years, and I love it. So, first of all, thanks for everything!

One of the next projects on my plate is a nice auto-update mechanism for my project, and I'm trying to find the best approach to that problem, in 2021, with modern Windows and MacOS distribution requirements. (Linux would be a nice bonus too, but not essential in my case.)

I currently build a DMG installer for MacOS and an InnoSetup installer on Windows. The installers are code-signed on both platforms, and on MacOS, the installer is also notarized with Apple. Whenever we release a new version of our app, the existing app prompts the user to download a new installer, and they have to go through the whole installation process from scratch.

Ideally, I'd like the option of distributing an update that includes only the application data (javascript, CSS, and image assets, without the NWJS binaries). And I'd like the option to apply that update silently in the background, with minimal user interaction, like I see in VSCode or Slack, or other Electron apps... Does anyone know how to accomplish that?

The NWJS docs point to several projects for handling auto-update, but most of them are 5+ years old, and none of them mention anything about building, installing, code-signing, notarizing, etc...

Does anyone have an approach that they're happy with, and willing to share the details?

Benji

russell....@gmail.com

unread,
Aug 11, 2021, 1:11:47 PM8/11/21
to nw.js
I've not been been super happy but this is the method I tried below. Our customers don't like updates in the first place so eventually we just settled on no updates and once a year they can reinstall. It puts a lot of pressure on us to all bug fixes and features in that once a year version.

On MacOS we tried Sparkle: https://sparkle-project.org/  
   Bootstrap calls the sparkle update procedure on startup, then launches nwjs
On Windows we went more custom: 
   We have a NWJS bootstrap that checks for updates. The app was installed with a MSI then when there is an update the bootstrap does:
      downloads a MSP to temp
       copies a update executable to temp
       Runs the update executable which sleeps for a little bit before really starting
       bootstrapper quits.
       The update executable runs msiexec on the msp and then relaunches the app.
   Creating a working MSP proved to be a big pain in the butt. So many restrictions on MSPs but was the only way I saw to updated systemwide without needing admin.
On Linux: Didn't try anything here.

Good luck!

Saroshi Kir

unread,
Aug 25, 2021, 3:20:24 PM8/25/21
to nw.js
I just tell my user's to download the latest version. 

Ali Tan Ucer

unread,
Oct 17, 2021, 1:57:27 AM10/17/21
to nw.js
Looking for the same thing. Let me know if you found anything so far.
Thank you.

Benji Smith

unread,
Oct 17, 2021, 2:22:40 PM10/17/21
to Ali Tan Ucer, nw.js
I think the only truly workable approach for my situation is: start migrating our app to Electron.

Which is a shame, because the app has a lot of assumptions based on the NWJS architecture (which I really like!), and it'll take a lot of work to migrate. But the installer/updater situation is so bad with NWJS, it's not worth it anymore...

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nwjs-general/d44af080-18d7-4b68-8de4-6382708f6c05n%40googlegroups.com.

Ali Tan Ucer

unread,
Oct 17, 2021, 7:09:19 PM10/17/21
to nw.js
I agree with you. I think NWJS has a lot of advantages over Electron and it is a nightmare to migrate.
I am still not losing hope in this. I am working on a CMS application and i think i am on to something useable.
The current auto-updaters are buggy, but that doesn't mean that we can not rewrite them.
i will share when i have a working copy.

_A 

russell....@gmail.com

unread,
Oct 25, 2021, 6:06:33 PM10/25/21
to nw.js
It looks like the electron updater uses squirrel https://github.com/Squirrel

On windows it looks like squirrel downloads the new version into the users app data and updates the shortcut to run the new version. This has never been an acceptable approach for me, where our application is used in multi-user systems (schools, libraries, etc), not only single user systems.

Doing a proper update is very hard. You can do this with a bootstrap program and wixtools to make MSI and MSPs. You can get away with updating without admin if you install using a MSI (admin required here), then update using MSPs (admin not required unless certain policies are enabled).  MSPs are pretty fragile though, a lot of conditions will make the update error and only partially complete.

For mac in the past I had used Sparkle to do updates. It has been a while and I don't know if the approach works still with all the extra security apple has been putting in. It probably requires admin now. But I had a bootstrap program call the sparkle update libraries before launching nwjs. https://sparkle-project.org/

If you do not care if it prompts for admin to do updates and downloads the entire full installer instead of diff updates, updates are a lot easier.

All that being said I've not seen a good update system that is satisfactory to me (including electrons). It keeps getting harder and harder with the different companies pushing you to use their stores instead. I wish you luck in getting something you like.
Reply all
Reply to author
Forward
0 new messages