Moving from balenaCloud to openBalena

Hello there,
I am trying to move several devices from balenaCloud to an openBalena instance that I have running. The devices are deployed and provisioned with balenaCloud currently, balenaOS version 2.43.0+rev1, production OS variant.

openBalena instance is up and running, DNS is setup and I can access it and deploy devices that were provisioned directly with openBalena, however I have some issues regarding moving existing devices provsioned with balenaCloud. I’m aware that there’s a balena join command in the CLI, but if I understood the documentation correctly, that can only be used on local devices, not those that are remote.

There seems to be a way of doing this by SSHing to the devices, however as far as I know you can’t SSH to production versions of the OS.

Which steps should I take to be able to gracefully migrate devices from balenaCloud to openBalena or am I better off with reprovisioning the devices with openBalena, starting the whole process from the beginning?

Hi @fruloops,

It is possible to SSH into production versions of the OS, by adding your own keys public identity to the /mnt/boot/config.json configuration file, specifically in an os object within it:

{"os": {"sshKeys": ["key1", "key2"]}}

This will then require a reboot, but you should be able to then SSH with your own keys as well as via balena Dashboard/balena-cli.

There’s an older thread on using leave/join to move from balenaCloud to openBalen here: Is possible to move from Balena Cloud to Open Balena? where another customer wished to do the same thing.

I’d stress though, that this process, especially the modification of the config.json carries some risk so if potential loss of a remote device isn’t acceptable, then reprovisioning them against the openBalena instance might be a better way to go.

Best regards,

Heds

It is possible to SSH into production versions of the OS, by adding your own keys public identity to the /mnt/boot/config.json configuration file, specifically in an os object within it:

{"os": {"sshKeys": ["key1", "key2"]}}

This will then require a reboot, but you should be able to then SSH with your own keys as well as via balena Dashboard/balena-cli.

I’ve managed to do that, so the SSH works great. However, on the matter of leave/join, I’ve decided to just reprovission with openBalena.
Thanks for your help with the matter with the SSH.

Maybe will be helpful for some body!

Migration HOWTO:

  1. Register device in openBalena project
  2. Generate configuration file for this device in openBalena
  3. Exec this in device:
os-config join 'GENERATED_CONFIG_STRING' \
&& sleep 5 \
&& balena stop $(balena ps -a -q) \
&& sleep 5 \
&& balena rm $(balena ps -a -q) --force \
&& sleep 5 \
&& systemctl start resin-supervisor &