Know application update status from within service

We have a multi-container application, one of the containers is a PG database with multiple other services connecting to it. When we push an update various services, sometimes including the database, are restarted. When this happens and the database is asked to shutdown or restart we get various errors in the other services that are connected to it. Is there a way to know from within those services that the device is in an updating state and that these errors are expected?

I found GET /v2/state/status which i think would work, but we would have to poll it at a fairly high frequency from the services that are concerned about it. I know there are also lock files but I’m not sure if the supervisor generates one, even though i see the log “taking update locks”, that the services could watch for. If there is a file it would be much easier to setup a directory watcher to see these files coming and going instead of polling the supervisor so much.

Thanks for the help and making such an awesome product!

Hey I looked more into this and using the lockfile in /tmp/balena worked! More info here: balena-supervisor/docs/update-locking.md at master · balena-os/balena-supervisor · GitHub