eritislami / evobot

🤖 EvoBot is a Discord Music Bot built with TypeScript + Discord.js, includes Docker builds & localization in 20+ languages
MIT License
1.85k stars 2.01k forks source link

🚀 Health Checks #1620

Closed djpiper28 closed 3 months ago

djpiper28 commented 5 months ago

Is your feature request related to a problem? Please describe. Sometimes the bot will not respond to commands, and requires a restart. I run the app within a kubernetes cluster and ideally it will have the ability to add a healthcheck so that my cluster can restart the bot when it isn't working.

Describe the solution you'd like The bot runs an express server (or similar), with a singular healthcheck endpoint. This tries to ping discord, if it can it returns a 200 code, otherwise a 500 code. This means my cluster can detect failure and restart the offending pod.

Describe alternatives you've considered n/a

Additional context App runs in kubernetes.

eritislami commented 4 months ago

I understand your need for this change but I feel it is outside of the needs of the average user, adding an entire express server to the project feels to me like it is outside of the domain of the project, it's more so something end-users can implement on their own, as for now the bot does have a ping command which returns the API latency to Discord.

djpiper28 commented 4 months ago

I understand your need for this change but I feel it is outside of the needs of the average user, adding an entire express server to the project feels to me like it is outside of the domain of the project, it's more so something end-users can implement on their own, as for now the bot does have a ping command which returns the API latency to Discord.

If I were to add this feature and put it behind a feature flag that defaults to disabled is that okay?

eritislami commented 4 months ago

I understand your need for this change but I feel it is outside of the needs of the average user, adding an entire express server to the project feels to me like it is outside of the domain of the project, it's more so something end-users can implement on their own, as for now the bot does have a ping command which returns the API latency to Discord.

If I were to add this feature and put it behind a feature flag that defaults to disabled is that okay?

For this repository my main point is that i don't want to accept a PR for something that i don't feel comfortable maintaining, I think a more lightweight solution would be to run a restart command via PM2 to restart the bot since that is something that i am more familiar with, if not then you are free to modify the code in your version of the bot.

Perhaps it can be added to the ping command.

djpiper28 commented 3 months ago

What I've don't is forked the repo and added the functionality I needed there. There are a few other bug fixes I might work on when I have time and I'll pr those into the main repo.