Automatically repair app when the HealthCheck goes down (Not Responding)
-
@Lonk said in Automatically "/repair" app when the HealthCheck goes down (Not Responding):
Box / The dashboard would /repair the app. It’s an undocumented Cloudron endpoint and always fixes any issue I have with apps, unlike simply restarting them.
But what does this
/repair
do ? I am not clear on how an endpoint can magically repair an app in all case.. -
@mehdi said in Automatically "/repair" app when the HealthCheck goes down (Not Responding):
@Lonk said in Automatically "/repair" app when the HealthCheck goes down (Not Responding):
Box / The dashboard would /repair the app. It’s an undocumented Cloudron endpoint and always fixes any issue I have with apps, unlike simply restarting them.
But what does this
/repair
do ? I am not clear on how an endpoint can magically repair an app in all case..It destroys the container and rebuilds it (it’s undocumented but exists). If there’s something wrong with the container - this will fix it. If there’s something wrong with NGINX, this will fix it.
Restarting the container can help. But only 10% of the time when 90% of the time, the repair endpoint fixes a “Not Responding” app for me.
-
The idea for the repair is to be done consciously and also ideally be monitored by the admin. So I don't think it is good to just run it for good measure.
I think what would be more important to get down to why things have failed and then see how to prevent that instead. This may mean we have to add better logging or status reporting.
-
@nebulon said in Automatically "/repair" app when the HealthCheck goes down (Not Responding):
The idea for the repair is to be done consciously and also ideally be monitored by the admin. So I don't think it is good to just run it for good measure.
I think what would be more important to get down to why things have failed and then see how to prevent that instead. This may mean we have to add better logging or status reporting.
The reason I brought this up in the forum is because I was going to make a script that checked the health status of all my apps and
/repair
them when they switch to Not Responding, which is about 5 minutes after they actually go down.Then I realized, what's the healthcheck for except for to react when an app goes down. I'm not saying don't log it in notifications. If it's a one-off thing, then it didn't require human intervention to get working again (which could take awhile if you infrequently monitor the Dashboard).
So, give us the info, sure, not a bad idea - but automatically trying to repair the app first and noting that it was successfully repaired after being down in notifications is a better solution. Having this be a manual step so that the admin "knows about it" is silly if it's a random one-off thing is silly and irrelevant if they get a notification about it. If the
/repair
endpoint works - then that's all the admin would do, review their notifications. It could be run a singular time to keep the site up and notify the admin and that sounds best IMO. Better logging, for sure, I can agree with that. But notifying + auto-repair (just one try) and then notifying if that repair was a success is better. Much better. It's the reason healthchecks exist - the native Docker now has "restart on failed healthcheck" (as doessupervisor
) - but you guys can take it beyond that with a/repair
.I can still write my script. I can even keep it on the same Cloudron instance, monitoring the status of all the apps and do a
/repair
on one if it "stops responding". If it starts responding cool, I'll check the logs as soon as I can to make sure it doesn't happen again. If it doesn't start responding after that, I'll find the problem and fix it.I just don't get the stance "we could automate the first troubleshooting step that every admin will take to get their site up and running again, but we don't think it's a good idea because we want them to intentionally take that step." My question to that is, why when you could be losing on precious uptime?
-
Cloudron already restarts an app when it starts using too much memory. Cloudron could just stop the app using too much memory and have the admin notified that it stopped the app so they can start it back up manually (which, of course, sounds ridiculous - and I don't see the difference between this and that). It doesn't do that though, it restarts it, why? I'd say to keep the app running.
So not at least attempting a single
/repair
when an app stops responding for the sake of the admin to do so manually feels needlessly manual and doesn't keep the app running when it could be (say the admin is the only admin and they're on vacation for a week, this feature could save them). -
I still think we should not hide issues, which may be fixed running repair. This is a bit like just having bandage over an issue lurking in the dark. Generally if repair does indeed fix the issue, then this indicates either problems in the app package, the runtime management of apps in the platform or maybe external dependencies should be handled better (like DNS setup)
This is a bit like docker issues we encounter every now and then. Sometimes docker restart fixes them, but the conclusion should probably not be to restart docker every now and then if an app fails for good measure.
My be just me, but I haven't experienced many systems which work well in a self-healing manner and I am afraid of hiding real bugs through this. To me this conversation should be about the issue which triggered your thinking of automatically running repair in the first place.
-
@nebulon said in Automatically "/repair" app when the HealthCheck goes down (Not Responding):
- My goal is not to hide anything from the admin, just make the apps have higher up times by cutting out a human step. I don't see a difference of handling this the same way you run out of memory. Post a notification on the Dashboard, display the error:
"App was not responding due to x error - Cloudron automatically repaired the app and it's running but please look at the logs here to see what might have happen to have caused this (and the log screen should show the last bit of the log file before the app stopped responding).
-
For me personally, this has only happened once. A Wordpress blog that wasn't even in use (no plugins yet - aside from the pre-installed ones) stopped responding and a restart didn't work. A "repair" did though. I still don't know what was wrong but it never went down after that (it's been a month now). So this feature is more of a comfort for me to know that edge case would be covered when I'm on "vacation for a week."
-
As a developer, I don't want "band-aids" - I want to fix the problem, but if your notification system gives me the date, time, and logs of when it had to
/repair
the app, then I can still do that with virtually only 5 minutes downtime of my app (instead of me, a human, getting around to checking the logs, try to figure out what happened, meanwhile I can't repair without adding more to the log, so a snapshot of the log, and a automatic singular attempt to "repair" the app seems like a better flow for user and developer alike). I, of course, don't mind an app stopping since I only use Cloudron for development - but I'm thinking more about your everyday users. If people get this proposed repair notification feature I'm asking for, then there app doesn't stay down, which is good - but it allows them to post on the forums the logs and the app (mine was Wordpress Unmanaged, and like I said, it only happened once). -
As @fbartels mentioned, surpervisor does things like this. And as @girish mentioned, the latest Docker itself now does this. So, this is definitely a valid suggestion. Why would all of these other app managers do this is if it wasn't useful? We can make it even more useful by snapshotting the logs and adding a notification saying that something may need to be fixed even though a auto-repair was successful (then click on the snapshotted logs and dig in).
-
Today, after the update to latest cloudron version, I had between 15-20 apps in a failed state.
Clicking the repair fixed every one of them. And I had a client send me a message about downtime. I didn't look more into it, having spent at least 30 minutes going into each not responding app settings individually, clicking repair and waiting for it to successfully get back online. (And I wish there was a button to repair all apps at once^^)
As much as I agree with not bandaidging issues, for my client and my reputation, I wished not responding apps would have been repaired automatically and errors to be reported.
Between repairing an app and getting to run or start an asynchronous debugging on the forum, I'll always click on the repair button first.
If repairing is detrimental to bug solving/reporting, I would suggest to put a place where not responding logs/errors can be retrieved in one click.
-
Note 1: Even though it's only happened to me once organically, I would feel at peace knowing there's at least, an extra added / precaution / attempt there to keep a production app up.
Note 2: The reason I encounter this often on purpose is when I update the code of the VPN Client app I'm working on, it breaks any apps containers that were connected to it, and those apps take 8 mins and then go to "Not responding..." status in the dashboard. Their container needs to be re-created and
/repair
does that while/restart
does not so I consider/repair
to be more thorough when attempting to bring back up an app that went down (again, just one attempt) for any reason. @girish and I will make certain that when the OpenVPN Client on the app store gets updated, any apps connected to it gets "re-connected" properly but if I hadn't have noticed that big and we did a v1.1 release of the OpenVPN Client app, then people's apps could have gone down and they'd have no way to know why but if that/repair
protection in place, it's likely neither they nor the users would notice the 8 minute downtime.Of course, as the developer of this app, I would eventually notice the behavior and fix it. That's why I'm working with @girish on
box
code to make sure this doesn't happen.But I just explained to you a real case that could have happened and it helps users and doesn't hurt developers. All pros, no cons. So, you tell me why a user wouldn't want that added protection (but they should still be notified it happened like I said above)? Cause I understand your belief system, but when I see all pros with no cons, I have to fight my case.
-
@ruihildt said in Automatically "/repair" app when the HealthCheck goes down (Not Responding):
Today, after the update to latest cloudron version, I had between 15-20 apps in a failed state.
Clicking the repair fixed every one of them. And I had a client send me a message about downtime. I didn't look more into it, having spent at meats 30 minutes going into each not responding app settings individually, clicking repair and waiting for it to successfully get back online. (And I wish there was a button to repair all apps at once^^)
As much as I agree with not bandaidging issues, for my client and my reputation, I wished not responding apps would have been repaired automatically and errors to be reported.
Between repairing an app and getting to run or start an asynchronous debugging on the forum, I'll always click on the repair button first.
If repairing is detrimental to bug solving/reporting, I would suggest to put a place where not responding logs/errors can be retrieved in one click.
Nevermind, ignore my potential "use case" for adding this protection because it was theoretical and instead @ruihildt's is real (we literally posted at the same time and the cases were oddly similar) and I think it should be heavily considered and talked about with @girish and yourself ( @nebulon ). This is a real problem that occurred with one of your users in a production environment recently and this protection I'm proposing would have made the issue transparent to the user and his client. But us developers will eventually catch all the bugs as we build out better unit tests and whatnot. User experience is my number one priority, and nothing says it better than @ruihildt's testimony.
-
This would be a precaution added until @girish is ready to add what he wrote below (I don't know if
dockerode
has it which would be a huge difference in difficulty in adding that as a feature):@girish said in Automatically "/repair" app when the HealthCheck goes down (Not Responding):
I would ideally like to remove Cloudron's healthcheck field and replace it with Docker's own HEALTHCHECK (https://github.com/moby/moby/pull/22719). When we started out, that feature didn't exist in docker and maybe it replaces what Cloudron does internally. Once we do that, we can get automatic restarts etc from upstream docker. Even though I note that https://github.com/moby/moby/issues/28400 is open for over 2 years now.
-
I think this is a great conversation, and great points from different points of view. For what it's worth, my two cents is that the health check should indeed do more than just simply log it, it should take a predetermined action. This is how other health checks work on different platforms and I think is the general expectation of users coming to Cloudron from managing a Docker Swarm cluster, or using Kubernetes, etc.
I think the appropriate measure would be for health checks to be logged as they already are, and for a new option for an admin to set an action to be taken whenever a health check state goes to "Error", for example, such as automatically restarting the node. I've personally never encountered an issue yet where an app in "Error" state isn't fixed by a simple reboot of the app, and even fi it wasn't and was then in a reboot loop, well if it wasn't working anyways then not much has really changed so it can only really help in a way not harm.
-
@nebulon And that's what you should do, of course, but it'd be a lot easier of him to do if he'd gotten a notification with the portion of the log of when the app went down, and had it automatically repaired (both the logs shortly before it repaired and shortly after would be delivered with the notification). He could get you that info at anytime (if a notification system like I proposed is created). It's far too late for that now - making his ability to report what happened, effectively more diminished than if we agreed on a position in this thread on where we should go in terms of reporting to devs and pre-determined actions. I argue pre-determined actions are the point of a healthcheck but, hmm.
This is an ideal you and I fundamentally disagree on and no matter what you have the final say, but I'm feeling meeting in the middle with my proposal to increase the ease of use / ability for users to report to the devs when apps go down, and it increases uptime.
That was me taking what you wanted (accountability and log reporting), and what I wanted (higher uptime, even if it is only a 0.0001% difference, it'll make me and other users feel safe in that way). I'm a developer, but user experience is key - so I always put myself in their shoes while debating the way to make these kinds of infrastructure changes.
Basically, @nebulon, what I'm asking you is - does my proposal not only solve both of our problems at once, but actually increases the ability for users to do what you wanted them to do in the end anyway (hit repair manually and report the log) as long as we do it in the right way as has been discussed?
-
I would also like to point out that @girish said in this thread that this is going to be a feature down the road as Cloudron gets more Docker features. So, it's already a Docker feature, and they must have also discussed this. I wonder if I can find the ticket for their discussion on this very subject. But thanks @robi for finding and posting this, I thought it was a good read about this whole issue:
https://github.com/moby/moby/issues/28400#issuecomment-712510304
-
@nebulon probably didn't communicate properly but it's not about implementing the feature or how it can be implemented. He is saying that we need to understand the root cause of apps not responding in the first place. Once we understand the problem, we can think of the correct solution.
We have 5-6 Cloudrons ourselves and essentially never have to repair/restart apps. In fact, this whole repair stuff was only added some releases ago and we thought even that was uncommon
Anyway, this thread exists so people can tell us if apps are not responding often. Like things stop working every day? every week? every month? Depending on the various experiences, we can try to figure out how to solve it. For example, if you had to restart like once a month, it's already not a priority with respect to our massive back log. So far, I have noted two, let's hear from more users. But we made Cloudron so one doesn't have to deal with all this stuff about apps going up and down.
-
@girish Like I said, it happened to me only once between updates so the system is pretty stable. I outlined a theoretical situation where it would be needed. Then another user mentioned an important use case for simply adding a single endpoint to reaction to a Not Responding status
dashboard
function.But you yourself said Docker supports this, and multiple people have expressed that customizable actions based on "status changes" of apps are beneficial. I even outlined how to make @nebulon's and your main issue with this work even better while still increasing uptime. Increasing uptime for users was important enough for Docker to implement it themselves with their heathchecks. Even supervisor.
The notifications can literally say "We restarted your app
x
, if you notice this happening often with this app - click this to send the log directly to the developers."Only @mehdi appears opposed to this though I couldn't tell, I'd say it's almost unanimous and why wouldn't we compromise to make everyone happy app devs,
Cloudron
developers (you and @nebulon), and especially users.But the point you guys made (yourself and @nebulon) is valid, it's just overruled by using the notification system you already have in place to make this situation so much easier for the users to repot more to mitigate your concerns while simultaneously increasing user reporting and increasing app uptimes. Win-win - does anyone disagree with that?
Note: I agree with @girish that we should hear from more users and their opinions btw.
-
Also, @girish, I wasn't saying that
/repair
wasn't overkill, I was saying, why not use the overkill option that already exists and has claimed (by users) to fix more issues than/restart
to try to fix something as bad as literal website downtime. What if @ruihildt had been on vacation and Cloudron auto-updates (as it does) and it caused the need for a manual repair of all of those apps (he said 20 per installation). Yes, a dumb admin user shouldn't exist but what if he didn't know what to do and then @ruihildt had to be interrupted to fix these apps, each one by one. When he could have, after his vacation, clicked the "Report to Developers" button in his Notification Center when he sees them. He's more likely to report, you're more likely to have the data you want, he's a happier user. And the rest of the users feel comfortable with that one more protection against downtime.Btw, the one time it happened to me was after a Cloudron auto-update, with the Wordpress Unmanaged app. So there could be a common factor here. But the fact that we don't know it and this solution accounts for this and other potential user-downtime-impacting situations. It's just very important to consider for developers and users alike. But I think we've all made it a point to consider this so maybe we'll revisit it later.