Openbalena CLI optimization

Hi there, curious if there are some tricks to make working with openbalena and the CLI a little easier.

For example, every time I open a new terminal to log in I have to run the export NODE_EXTRA_CA_CERTS='/path/to/ca.crt' command which makes me wonder if there is a way to automate that without screwing up my balenacloud experience from the same machine.

Also, because I can only log into the openbalena instance from within a folder I called openbalena, I find myself moving projects into that folder to build and deploy to openbalena and then move them back out to my actual projects folder when done, which is a little messy. Am I overlooking a trick here too?

What would be really sweet would be to have a global CLI experience that lets you pick and choose which servers to interact with via a command or cli menu. For example from any where you can do balena login openbalena without having to do that from a specific folder.

Maybe I’m not doing it right though…

Hey there, I see some of these pain points and I can make a suggestion. If you’re running Linux you can accomplish this with some aliases in your ~/.profile or ~/.bashrc.

Here’s an example from mine:

devenv-login() {
    export BALENARC_BALENA_URL='my.devenv.local'
    export NODE_EXTRA_CA_CERTS='/path/to/ca.crt'
    balena login

I don’t believe you should have to work within the openbalena folder just to push new apps, as long as your BALENARC_BALENA_URL and NODE_EXTRA_CA_CERTS are set for the correct server you should be able to perform actions from anywhere. If this aspect isn’t working for you we can try to figure out why!

Thanks for the tips! Unfort I’m not on a linux machine though.

@klutchell wild question, but if someone decided the were only going to use openbalena the cli could be customized and built from source theoretically?

hey there,

What operating system are you running this on?

As for working from a specific folder, have you set up a balenarc.yml file in the folder so that the cli picks up those configurations? This is documented here

as for your ques:

if someone decided the were only going to use openbalena the cli could be customized and built from source theoretically

in theory, yes, but that’s not technically recommended. Perhaps we can work together to make the exoerience with the CLI better and it can benefit other users too.

Please help me better understand the constraints and pain points.


1 Like

Thanks for clarifying @rahul-thakoor. I fear I’d be in way over my head if I tried to assist in making changes to the CLI.
I can provide a list of some suggestions though… Let me put together a few ideas and post here.

Here’s one problem I noticed…

In the ui of balena cloud it is possible to create a variable like this:

DD_TAGS: name:joe env:test another:true

Where the value can contain multiple “:” colons.

Whereas this seems to fail when trying to do the same with the CLI.


balena env add TAGS2 'name:joe env:test2' --application appName I was able to run this command successfully. Perhaps you missed the comma?

1 Like

A file has been uploaded using Jellyfish: Jellyfish

Thanks @anujdeshpande you’re absolutely right, I was forgetting the apostrophes!
Thanks a bunch!

Glad to know Anuj’s suggestion worked. Cheers!