I’ve deployed 3 Discord bots written in TypeScript (Deno) to the service over the last few days. Each bot seems to disconnect from Discord after a while - usually after 3-4 hours, but sometimes much longer. Due to not having an HTTP endpoint to hit, I’m not currently making use of health checks.
On the most recent restarts of one of the apps, I added a log statement to tick every 5 minutes. I see those statements regularly for ~4.5 hours:
2023-05-06T01:13:08.565 app[6e82d4d6c00568] lax [info] Health tick <... regular 5 min logs ...> 2023-05-06T05:38:08.625 app[6e82d4d6c00568] lax [info] Health tick <... nothing until manual app restart ...> 2023-05-06T18:35:52.648 app[6e82d4d6c00568] lax [info] Sending signal SIGINT to main child process w/ PID 513 2023-05-06T18:35:53.560 app[6e82d4d6c00568] lax [info] Starting clean up. 2023-05-06T18:35:54.562 app[6e82d4d6c00568] lax [info] [62595.354941] reboot: Restarting system
Version of the CLI:
flyctl v0.0.558 linux/amd64 Commit: 44f30c48 BuildDate: 2023-05-05T21:53:05Z. I’m running on a single machine. Memory usage is about 85MB.
I absolutely accept that I may be doing something incorrectly with my fly.io configuration! The code is on GitHub, here, and my
fly.toml is very simple:
app = "celeo-gandalf-bot" primary_region = "lax"
I’ve read through many posts on these forums and articles across the web about deploying Discord bots here, and I haven’t read about any hidden complexity or similar. I would quickly blame my code, but these bots have been running on another provider’s VPS for years without this issue.
I’ve played around with adding a simple HTTP endpoint for health checks, but that would only cover the problem, not truly fix it.
Any advice is much appreciated!
EDIT: the apps have been stable for 48hrs, and I’ve made some changes, so perhaps everything is fine.