Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-131763 / 25.04 / Improve app status reporting #14668

Merged
merged 4 commits into from
Oct 16, 2024
Merged

Conversation

sonicaj
Copy link
Member

@sonicaj sonicaj commented Oct 13, 2024

This PR aims to improve how we report in what state the app is in right now. Before we get to what we are doing in this PR, some context here - so when we have a compose file which has multiple dependencies, the services dependent on the service running right now won't start unless the service they depend on finishes gracefully - in this case docker does create containers for these services which are waiting to start but does not actually start them.

What was happening with our earlier logic was that when we started an app - we reported it as deploying -> crashed -> deploying -> running (for some apps), this happened because there were some dependencies involved and when 1 dependency finished executing, there wasn't another container running atm and we marked it as crashed which is obviously not true.

So what we have done now is, that we account for 2 more container states i.e crashed/created. Crashed is that a container exited but with a non-zero exit code and created is that it is up and waiting for the service it is dependent on to finish it's execution so this one can start. Using these 2 new states, we see if we have any crashed container - we mark that app as failed and then if we have any container in created status or in starting status (healthcheck not green which we say is starting) we mark it as deploying and finally if exited containers (containers which exited with 0 exit code) plus running containers is the total number of containers we have, then we mark it as running.

@sonicaj sonicaj self-assigned this Oct 13, 2024
@bugclerk bugclerk changed the title Improve app status reporting NAS-131763 / 25.04 / Improve app status reporting Oct 13, 2024
@bugclerk
Copy link
Contributor

@truenas truenas deleted a comment from bugclerk Oct 13, 2024
@stavros-k
Copy link
Contributor

stavros-k commented Oct 14, 2024

Tested nextcloud and immich which both have some dependencies.
Both of them showed deploying when containers were in the created state. (As expected).

Also installed 2 custom apps, one that runs once and exits 0 and one that exits 1.
The exit 0, shows up as stopped and the other one shows as crashed. (As expected)

Same on reboot.

Also tried stopping/starting. Statuses look good.

LGTM

@sonicaj sonicaj merged commit d2e7460 into master Oct 16, 2024
3 checks passed
@sonicaj sonicaj deleted the fix-app-statuses branch October 16, 2024 17:38
@bugclerk
Copy link
Contributor

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators Oct 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants