kill -9 default express app causes web console disconnect

hi, my situation is this: i’ve an express server app running successfully on balena OS on a port other than 80, which is used by the default balena app (usr/src/app/server.js). my server continues running even if i close the web console window but i no longer have access (obviously) to its output even if create a new web console. i can’t start my app at boot. i can’t log its output (i don’t want to write to and ruin the SD card). i can only access my express server locally, not at the public URL. i cannot integrate my code into the default express app – it crashes (see below). my app requires node modules that need compilation, e.g. sharp, and therefore i must first run apt-get update, apt-get g++ and apt-get make) on balena OS.

also, killing the default express server (kill -9 xx) causes ALL web console and web log screens to disconnect (all that are open) & reconnect. is there a reason for this? is this normal behavior?

modifying the default app ("/usr/src/app) with our code causes repeated disconnects and reconnects. i don’t want to mess with it as we can get locked out; we are currently not able to ssh to the main OS using balena ssh – there’s some issue there (on a separate thread on this forum).

i use pm2 on my other web appliances to run and manage express – startup, logs, restart on crash, etc. it provides amazing control.




I can see that you have another thread with this same issue, but I think the title of this one in more fitting for the problem you’re experiencing.

…the default express (node.js) server in the main OS…

This (taken from the other thread) is a concern for me; fundamentally you’re not using balenaOS as intended. BalenaOS is intended to run Moby containers, defined in either a Dockerfile or docker-compose.yml, and installed via our balenaCloud or openBalena fleet management tools. You can access the balenaEngine in the device directly and run the containers there too, but this is slightly more involved,

You also mention installing gmake and g++ into the balenaOS host - this is something which would be done in your application service image and defined in the Dockerfile for this service. Before you go any further I think we need to clarify exaclt how you’re operating currently, as I don’t think we can really advise you without seeing the Dockerfile for this service you’re defining.

If you could share it with us, then we can help you out, I am sure :+1:

yes, i decided to open a new issue as the other one was losing focus :slight_smile:. my main goal (achieved) was the POC. what i need now is to run my server.js that listens on port 80 on the public url, and it has dependencies on modules, one of which needs g++ and make to get going. server.js needs to be able to get a unique name for the device on which it is running. it needs to record activity to a log, preferably not put on the SD card.

are there any files i can share with you that would help? some i can post here, others i will have to share privately.

let me know what i can do to help.




The public url is a feature of our cloud platform, you need to activate this in the dashboard. Can you provide us with your Dockerfile, that you use to build your application?

thanks, i’ll work on this when i get a chance. we’re a bit understaffed at the moment and working on other parts of the system. stay safe. best, mahesh