BalenaOS inside a regular Ubuntu implementation?

Hi all,

Our company has been using Balena + Balena Cloud for a while now but we’ve hit a bit of a brick wall with the product. We use Balena to deploy graphical interfaces to NUC’s with touch screens (and sometimes with custom hardware attached). We run a server that serves our content and then another container service that runs Electron in X11 showing that content to the user. Our graphical interfaces are now getting pretty hungry, and we’re finding that they can no longer run efficiently inside a container. I know this has come up at least once on Balena forums, but I just wanted to get the latest on how people solve this problem? It became very stark when I ran the exact same app on a bare-bones Ubuntu with an X11 serving Chromium in kiosk mode vs a Balena image equivalent. The latter wouldn’t even give me a frame per second for one particularly hungry web app. The former was smooth as butter.

I appreciate this may be out of Balena’s remit, but I find the Balena Cloud so useful, and have no problem deploying servers and file serving into Docker containers… But not being able to serve over an X11 server that is closer to the hardware is essentially forcing us to migrate to our own custom setup. So this is my last ditch attempt to work out if we’re over-reacting:

  1. Is it possible to modify BalenaOS such that we can run a decent X11 kiosk close to the hardware? I’ve tried Balena Experimental Browser (GitHub - balena-io-experimental/browser: A drop-in web browser block) with GPU enabled but it still isn’t good enough.
  2. Are we able to perhaps run our devices on a regular Linux distro and then VM the BalenaOS inside that? We really only need the functionality of a Chromium view that’s close to the hardware; everything else can be served from a Balena container (i.e our apps can be served to the Chromium browser from containers, and so therefore easily updated remotely)…
  3. Are we misunderstanding what/who Balena is “for”?

It’s a real shame because I do really like Balena Cloud and the containerised approach - it just seems to fall short when it comes to graphical interfaces. If I’m trying to fit a square peg in a round hole, then I fear that we may end up having to write something ourselves.

Hello @shennan first of all welcome to the balena community!

Thanks for your message and it’s really interesting to learn about this type of use cases.

I have some questions for you:

  • Could you please share more details when you say that your graphical interfaces are now getting pretty hungry?

  • What exact hardware would you like to use (CPU, memory, display, etc)?

  • What do you mean by GPU enabled but still isn't good enough? Is this the rendering experience? Is this related to interaction?

  • Finally is it possible to share a dummy docker-compose that you are using and the configurations?

Thanks and looking forward to explore more how to help you here!

Thanks for your reply.

We’ve been mostly using standard wizard-like interfaces on touch screens. Apps rendered in Electron which have things like questionnaires, some PI data capture etc. Sometimes we attach vending or printing hardware which we communicate over Serial to control. But recently we’ve needed to make more graphics intensive experiences. The specific app I’ve been using as a benchmark is a simple pinball game, using MatterJS and PixiJS to render onto Canvas.

Regardless of the app we’re using, I should re-iterate that I’ve deployed the exact same app on a bare-bones Ubuntu installation onto the exact same machine, using chromium in kiosk mode, and it has worked fine with a good frame rate. Deploying it onto a balenaOS machine (same NUC specs), with X11 Electron (using chromium under the hood) and also deploying using the balena-io-experimental/browser with the ENABLE_GPU=1 flag set, they both perform terribly (balena-io-experimental/browser very marginally better). By “terribly” I mean the frame rate is under 1 frame per second; so it is unplayable.

So although I’m sure the app could be optimised, the differences in performance hint at a much wider issue.

Below is the docker-compose we normally use for our setups:

version: '2'
volumes:
  resin-data:
  app:
  config:
services:

  app:
    build: ./app
    restart: always
    volumes:
      - 'app:/app'
    ports:
      - "80:80"

  electron:
    build: ./electron
    privileged: true
    restart: always
    volumes:
      - 'config:/config'
    labels:
      io.balena.features.dbus: '1'
    environment:
      - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
      - ELECTRON_DISABLE_SECURITY_WARNINGS=true
    depends_on:
      - app

Note that we run Electron as a separate service, and serve the app from the “app” service.

Below was the very bare-bones docker-compose that I used to test the balena-io-experimental/browser setup. Here I just dropped in the app build folder and served from the same service:

version: '2'

volumes:
  settings:

services:

  browser:
    build: .
    privileged: true
    network_mode: host
    cpus: "6.0"
    mem_limit: "8g"
    volumes:
      - 'settings:/data'

You mention what hardware we’d like to use: I guess anything that helps to make graphical, canvas-rendered games workable in a balenaOS setup. We run it on NUCs with 16GB of RAM, attached to touch screen displays.

Let me know if there is any other information you need.

1 Like

@mpous I’m guessing this is perhaps not something we can fix within Balena Cloud? We pay a subscription currently and will be deciding soon whether to cancel that in favour of building something custom if we can’t make this work - so do let me know if you think this is fixable.

FYI Our company is using a separate account to this personal one.

Hello @shennan we are also happy to attend you through the support portal for customers if you preffer.

Let me share this internally and let me know if you would like to use Zendesk for continue the conversation!

@mpous Is Zendesk a better place to get technical support? Should I just do that and reference this thread (it will be from a different, paid account).

@shennan does the project discussed here belong to the paid organization? Yes! feel free to add it there and link this conversation!

@mpous Yes it does. I just didn’t want to expose our organisation account on a public forum. I will go ahead and do that and will report back here for the public if a solution is found that may help others.

2 Likes