Hi @bversluijs,
Indeed we still don’t support using depends_on with a healthcheck.
But, you can do this:
- The webserver exposes an endpoint where it exposes its own version (whatever versioning system you want to use). Alternatively, if you don’t wanna write this endpoint, you can use the supervisor’s API to get the releaseId for the webserver container: https://www.balena.io/docs/reference/supervisor/supervisor-api/#get-v2-applications-state
- On startup, the ElectronJS container queries the webserver version and stores it.
- The ElectronJS container keeps polling the webserver version and comparing it to the stored one. If the version changes, it hits the supervisor API asking for a restart.
Alternatively, instead of hitting the supervisor API for a restart, you could make the webserver version check part of the ElectronJS’ healthcheck script. balenaEngine has a feature by which it restarts any container that is marked unhealthy, so you could make the healthcheck exit 1 if the webserver version doesn’t match the stored one.
Not sure if these are the best solutions, but it’s what I would try if I were in your place It’s also considered a good practice to make your application not rely much on depends_on, but rather to check whether the other things it depends on are available at any particular moment.
Hope this helps!