Parametrized application launch

Hello,

I am new to BalenaOS and Cloud and I have an issue. Here is what I would like to do.
I got two devices. Both get the same application.
What I want to do it to be able to launch as much instance of the application (in docker) with different parameters.
Example :

  • Case 1 :
    • Device 1:
      • app with ID=1
      • app with ID=2
    • Device 2:
      • app with ID=3
      • app with ID=4
  • Case 2 :
    • Device 1:
      • app with ID=5
      • app with ID=2
    • Device 2:

What would be the simpler way to do that ?
I think at some solution :

  • pushing a new docker_compose file each time I want a modification
  • add a web app to launch the new docker instance on fly
  • something with service or environment variable ? But I didn’t find how to …
    But can’t we do that from the could management interface ?

I hope I was clear enough on what I want to do. Does somebody got an idea on how to do that ?

Hi, you can do this via balena dashboard through device summary -> Device Service Variables -> add variables for specific services. Is this what you are looking for?

If you’re trying to run different services based on environment variable, you can take a look at similar forum thread: Selectively running containers on a device

Hello,

thanks you for the fast response ! I seems to match my use case, I will try this solution !

It looks like docker compose scale feature would be a good candidate but this isn’t supported yet

Hey,

So I think the solution we have with balenaCloud isn’t suited to do what you want directly; but it would be possible for you to create a container and run balenaEngine within that container and drive it via a second service or environment variables. It would be a very technically challenging project though, so I don’t know if that’s something you want to undertake.

I am not aware of any sample projects we have which do this, so I cannot point you to anything unfortunately, but we would be interested to see how it worked out or if you found a different approach :+1:

the scale feature from docker compose would be the better approach I think.
For now my use case is quite simple so I got on the manually added variable road. I won’t be as simple as just have one service defined in the .yml but at least I will be able to launch/stop and modify each application from balenacloud, so that is cool !
I will share later my demo and the code !