Self update for your Fyne application!

by | Jun 28, 2022 | Cloud, Community | 0 comments

Fynelabs has been working on solving the problem of distributing applications to multiple platforms. Our first contribution to the Fyne ecosystem to help solve this problem is an updated selfupdate module and fyneselfupdate to integrate it visually in your Fyne application.

selfupdate will manage the new version check, download of updates, check their integrity, update the binary and finally restart the application. It is a fork from the now shutdown selfupdate module, but it leaves you the ability to easily setup your own infrastructure.

fyneselfupdate provides graphical elements for selfupdate using the Fyne framework – providing dialogs and automation for interacting with the user during the update process.

Getting started

Let’s start with a quick explanation of how to enable selfupdate for your Fyne application!

For the moment, we only support a very simple security model as part of this release. Future improvement in this area are planned. The security of the download currently relies on the use of an Ed25519 key. First step is to generate that key and for that purpose we can use the selfupdatectl command. So let’s install it:

$ go install

Let’s create the key with the following command:

$ selfupdatectl create-keys

This command will create two files, ed25519.key (the private key) and ed25519.pem (the public key). These files are used to sign and check signature. You shouldn’t check any of those files into your git repository, but keep them in a safe place.

Now let’s integrate selfupdate in a Fyne application. If you want to benefit from default user experience with Fyne dialog, you can directly rely on fyneselfupdate which simplifies life a lot.

How to add in your app

So we will use it! The following code will be all you need to add to your app and get things going:

package main

import (


func selfManage(a fyne.App, w fyne.Window, sourceURL string) {
	// Used `selfupdatectl create-keys` followed by `selfupdatectl print-key`
	publicKey := // FIXME

	httpSource := selfupdate.NewHTTPSource(nil, sourceURL)

	config := fyneselfupdate.NewConfigWithTimeout(a, w, time.Duration(1)*time.Minute,
	        selfupdate.Schedule{FetchOnStart: true, Interval: time.Hour * time.Duration(24)}, // Checking for binary update on start and every 24 hours

	_, err := selfupdate.Manage(config)
	if err != nil {
	        log.Println("Error while setting up update manager: ", err)

The next step now is to fill the publicKey where the FIXME is with the public key created earlier. To simplify life, you can use the print-key subcommand and copy the result of the command on your computer:

$ selfupdatectl print-key
publicKey := ed25519.PublicKey{178, 103, 83, 57, 61, 7, 18, 249, 244, 80, 163, 162, 42, 251, 190, 241, 11, 168, 179, 41, 245, 27, 166, 70, 220, 254, 118, 169, 101, 26, 199, 129} // THIS IS AN EXAMPLE DO NOT USE THIS LINE

Now, in your code where you create your main window, you can call the selfManage function we created above and give it the required parameters. sourceURL is just a string, but it can also understand a few Go template variables: {{.OS}}, {{.Arch}} and {{.Ext}}. This way you can rely on selfupdate to figure out in a cross-platform environment the URL of your executable.

Hosting and upload

Now that you have the code to manage updates, we just need to sign and upload the file to our CDN. We support at the moment an S3 bucket as the destination for the storage of your executable. We started with this method as it is fairly straight forward to setup an AWS S3 serving files with a CDN in front of it (like CloudFront or Cloudflare). Don’t forget that those CDNs cache files and that changes on them won’t necessarily be reflected instantly when you access the file you just uploaded.

If you have the following environment variable set, $AWS_S3_BUCKET and $AWS_S3_REGION, the selfupdatectl s3upload command will sign your executable and upload it to the specified path using your AWS credential and S3 information. As an example:

$ selfupdatectl s3upload nomad-windows-amd64.exe nomad/

Now, you have just deployed your first update and your executable will pick that up automatically. You are now all set! Just be careful with your private key.

If you do not use AWS S3 and want to handle the distribution differently, you can just use selfupdatectl sign to generate the signature file that needs to be served along with the executable.

We have been working on a cross platform builder and delivery platform and thanks to Dentagraphics we were able to significantly speed up the delivery of selfupdate and fyneselfupdate. It was great working with Dentagraphics especially as they understand the benefit of open source and made it possible to share this work with the community. Thanks a lot!

If you need some help with Fyne application update management, don’t hesitate to contact us. We might be able to help!


Leave a Reply

%d bloggers like this: