From 6d0739096a6ce10273a5850ec092321e2141bba7 Mon Sep 17 00:00:00 2001 From: Artem Kopytin Date: Sun, 9 Aug 2026 14:14:52 +0000 Subject: [PATCH] Stop the fly proxy from shutting the bot down The app declared an http service on port 8080 with autostop enabled, but a long polling bot never listens on a port. The proxy therefore cordoned and stopped the machine roughly five minutes after every start, and autostart could not bring it back because no traffic ever reaches the app. Drop the service section so the worker simply runs. Also raise kill_timeout to 30s, which the graceful shutdown now needs, record the 768MB the machine already runs with, and remove the obsolete experimental block left over from the 2022 nomad config. --- fly.toml | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/fly.toml b/fly.toml index e62a9b7..7c0d692 100644 --- a/fly.toml +++ b/fly.toml @@ -1,34 +1,21 @@ -# fly.toml file generated for platinum on 2022-12-13T14:19:08+05:00 - app = "platinum" -kill_signal = "SIGINT" -kill_timeout = 5 +primary_region = "ams" -[env] +# main.py catches KeyboardInterrupt, so SIGINT is what triggers the graceful +# shutdown: closing the bot session, the scheduler and the database pool, and +# notifying the admins over the network. Five seconds was not enough room. +kill_signal = "SIGINT" +kill_timeout = "30s" -[experimental] - allowed_public_ports = [] - auto_rollback = true - cmd = [] - entrypoint = [] - exec = [] +# No [[services]] or [http_service] on purpose. This is a Telegram long polling +# bot: it only opens outbound connections and never listens on a port. Declaring +# a service hands the machine to the fly proxy, which cordons and stops it once +# no traffic arrives on the declared port — that is what took the bot down. [processes] worker = "python main.py" -[[services]] +[[vm]] + size = "shared-cpu-1x" + memory = "768mb" processes = ["worker"] - protocol = "tcp" - [services.concurrency] - hard_limit = 25 - soft_limit = 20 - type = "connections" - - [[services.ports]] - force_https = true - handlers = ["http"] - port = 80 - - [[services.ports]] - handlers = ["tls", "http"] - port = 443