Skip to content

Updater Configuration

On this page you will find an overview of how to configure supported updater services and frameworks to work with CrabNebula Cloud. This will allow you to automatically update your application as soon as you publish a new release on Cloud without having to manually handle the update process.

Right now we support the following options:

Tauri

Before you can adjust your tauri.conf.json file to configure the update endpoint, you need to generate a cryptographic key pair for your application which will be used to check if the update is valid or might have been tampered with. The public key will be used to verify the update (needs to be put in the tauri.conf.json file) and the private key (has to be kept secret!) will be used to sign the new release when you publish it.

Run the following command to generate a key pair for your application:

Terminal window
cargo tauri signer generate -w ~/.tauri/myapp.key

You should now see the two keyfiles ~/.tauri/myapp.key and ~/.tauri/myapp.key.pub.

Now you need to add the following configuration to your tauri.conf.json file:

"tauri": {
"updater": {
"active": true,
"endpoints": [
"https://cdn.crabnebula.app/update/ORG_NAME/APP_NAME/{{target}}-{{arch}}/{{current_version}}"
],
"dialog": true,
"pubkey": "PUBKEY"
},
},

Make sure to replace ORG_NAME with your organizations name on Cloud, APP_NAME with the apps name on Cloud and PUBKEY with the public key from ~/.tauri/myapp.key.pub.

Cargo Packager

Packager includes a built-in updater which can be configured to automatically update your application as soon as you publish a new release on Cloud.

Start off by adding the cargo-packager-updater dependency to your project:

Terminal window
cargo add cargo-packager-updater

Afterwards you need to generate a cryptographic key pair which will be used to verify the integrity of the update. New updates will be signed with the private key and the public key will be used to confirm the integrity of the update.

Terminal window
cargo packager signer generate

Save the private key in a secure location as it will be used to sign the new release when you publish it. For the configuration of the updater code you will only need the public key.

In your Rust project navigate to the specific file where you want to add the updater code and add the following imports:

use cargo_packager_updater::{semver::Version, url::Url};

Now add the following code:

let config = cargo_packager_updater::Config {
endpoints: vec![Url::parse("https://cdn.crabnebula.app/update/YOUR_ORG_SLUG/YOUR_APP_SLUG/{{target}}-{{arch}}/{{current_version}}").expect("Failed to parse URL")], // REPLACE: YOUR_ORG_SLUG and YOUR_APP_SLUG of the app in CN Cloud
pubkey: String::from("YOUR_PUBLIC_KEY"), // REPLACE: YOUR_PUBLIC_KEY generated by the signer
..Default::default()
};
let current_version =
Version::parse(env!("CARGO_PKG_VERSION")).expect("Failed to parse version");
println!("Current version: {}", current_version);
if let Some(update) = cargo_packager_updater::check_update(current_version.clone(), config)
.expect("Failed to check for update")
{
update
.download_and_install()
.expect("Failed to download and install update");
println!("Update installed")
} else {
println!("No update available")
}

Make sure to replace YOUR_ORG_SLUG and YOUR_APP_SLUG with the slug of your organization and app on Cloud. Also replace YOUR_PUBLIC_KEY with the public key generated by the signer.

Now as soon as that code is run, the updater will check for updates and if a new update is available, it will be downloaded and installed automatically.