Disable supervisor at startup

We’ve got a strange use case.

We’d like to deliver a preloaded multi-container image with an app in one container and NodeRED in the second container.

The device should not connect to balena on the first boot. Our app connects to our server where the user can enable connecting to balena.

That way, if they choose not manage the device with balena (which costs money), they can still use NodeRED to “do stuff”.

Is there a way to prevent the supervisor from connecting at startup?
Can Supervisor API be used to start the connection?

@patrick just to clarify, you’re using balenaCloud to generate and download the OS image which you’re then preloading with the application? Have you investigated the use of openBalena? This would allow you to manage the devices yourself but still have them connect to balenaCloud later on if your user wanted.

Thanks Chris. Great idea. But then we would need to make the build locally, right?
I think we would miss using balenaCloud to create the builds.

(BTW: We haven’t actually been through the process of creating a preloaded an image yet , so I may be misunderstanding something about the process.)

Hi @patrick, This is actually something @agherzan is working on, which will allow preloading on an unmanager balenaOS image. So in that workflow, you would be able to download your OS from balena.io/os, then run balena preload --source /path/to/project. Then when you boot up your containers would be brought up by the supervisor and run, still having access to supervisor APIs like reboot etc.

Then we will add a supervisor endpoint called /join which your container could hit with some configuration and your device would then join a balenaCloud or openBalena backend if you want.

This work is still ongoing and hopefully the workflow will fully ready to use early next year.

1 Like

Sounds perfect. Last question :slight_smile:

Is there any way to still use the balena build servers in this workflow?
Something like:

  1. push repo
  2. wait for unicorn
  3. download build
  4. balena preload --source downloads/path/to/project

Answer: Turns out the balena-cli has a command to start the build locally.
From the directory of the app:
balena deploy myApp --logs --source . --emulated

@shaunmulligan @agherzan Any updates on this?

I see three pieces of the puzzle:

  1. Obtaining an unmanaged balena OS.
    Can the production versions be used? I don’t see anything labeled as unmanaged on the OS downloads page.

BalenaOS also comes in a Standalone or “Unmanaged” variant. This variant is exactly the same as the -dev variant but does not have the balena supervisor agent and has the balena VPN service disabled, so it will never connect to the balena management system.

  1. Preload the unmanaged OS.
    Can this be done without logging in? We’d like to avoid having to maintain an openbalena service just for preloads. Using --source still requires a login.

Logging into balena-cloud.com with the CLI on Ubuntu Linux and running:
balena preload '/balena.img' --source '/path/to/project'
hangs at /Creating preload container

  1. The supervisor endpoint /join.
    Looks like it is in the CLI but not the API. Any idea when this will be available?

Support helped me understand a few things.

  1. Unmanaged images are available here:
    https://www.balena.io/os/
    Managed images are when you download an image from balena-cloud with the “add a new device” button.
  2. You can push an app to balena-cloud and preload it to an unmanaged image with the cli (linux only).
    balena preload PathToImage --app NameOfTheBalenaApp --splash-image PathToSplashImage