Blog · General

Where to host a bot 24/7: bot hosts, a VPS or serverless

What a bot that runs non-stop actually needs, what each hosting option costs, and why serverless does not go with an open connection.

Published on October 30, 2026 · 5 min read

A bot that posts results to a group needs one thing your laptop cannot give: to stay on. Closing the lid must not take the service down, and restarting Windows must not open a gap in the history. This article compares where to put that process, with real consumption numbers from a working bot, and ends with what to configure in any of the options.

The example bot is the one from our tutorials, such as the Bac Bo Telegram bot: a Python process that reads the API and sends messages.

What your bot actually consumes

Before picking a plan, measure what you need. A results bot is surprisingly small:

What it doesTypical consumption
Holding one HTTP connection open (/stream)Tens of MB of memory, CPU essentially idle
Polling /latest every 3 secondsThe same, plus 20 requests a minute
Formatting and sending messagesIrrelevant
Running a browser (Selenium, Playwright)Hundreds of MB and CPU spikes

That last row is the difference that decides everything. A bot on top of an API fits the smallest plan anywhere; a bot that opens Chrome to scrape a page needs a much bigger server, for the reasons in scraping or an API.

The options

Bot hosts (Discloud, SquareCloud)

They are built for exactly this case: you upload the project, a config file says which is the main file, and they keep the process up and restart it if it dies. You can connect them to GitHub and publish on every push. It is the shortest path for anyone who does not want to administer a server.

Two things we learned running Discloud in production that are not obvious in the panel:

  • The processor follows the RAM you pay for. 512 MB comes with half a vCPU and 1 GB with one vCPU. For a bot that is irrelevant, but for anything that processes images or video the bottleneck is CPU, not memory — and you raise the RAM to get CPU.
  • The RAM value in the config file is not applied on its own in a push deploy: the app stays on the old value until you change it in the panel's settings, which triggers a rebuild. Checking that saves hours of investigation into an app that is, in fact, still on the old plan.

A VPS (any provider)

A small Linux machine, around 1 GB of RAM, handles several bots. You gain full control and lose simplicity: you become responsible for keeping the process up, for system updates and for logs. Use systemd rather than nohup, so the service comes back by itself after a reboot:

/etc/systemd/system/mybot.service

[Unit]
Description=Results bot
After=network-online.target

[Service]
ExecStart=/usr/bin/python3 /opt/mybot/bot.py
EnvironmentFile=/etc/mybot.env
Restart=always
RestartSec=5
User=mybot

[Install]
WantedBy=multi-user.target

Then it is systemctl enable --now mybot and journalctl -u mybot -f to watch the logs.

Serverless (Vercel, Cloudflare Workers, Lambda)

Cheap, scales by itself and no good for an open connection: the function has a timeout, so /stream dies mid-way. Serverless works for the other pattern, polling:

  • A scheduled function (cron) every 1 or 2 minutes.
  • It polls /latest, compares with the last id stored in a KV, database or file, and posts if it changed.

The trade-off is honest: with a 1-minute cron you lose few-second granularity and may merge two rounds into one message. If your group accepts that, it is the cheapest option there is. If not, you need a process that stays up.

A container (Docker anywhere)

If you already use Docker, a five-line Dockerfile runs at any container provider and avoids "it works on my machine". It is worth it when the bot has dependencies beyond pure Python.

The comparison

Bot hostsVPSServerless
Keeps a process upYes, that is the productYes, with systemdNo
Works with /streamYesYesNo
Requires system administrationNoYesNo
Deploy on every pushYes, by connecting GitHubYou set it upYes
Logs out of the boxYes, in the paneljournalctlYes, in the panel
Good forOne or a few botsSeveral bots and servicesCron jobs and webhooks

What to configure, in any option

  • Keys in environment variables, never in the code. The API key and the bot token go in the host's panel or in the EnvironmentFile, and .env goes into .gitignore before the first commit. The rest is in API security.
  • Automatic restart. The process will go down one day; what it cannot do is stay down.
  • Backfill on startup. After every restart, ask for what you missed with after before listening live again — that is what stops a gap in the history, as we show in storing real-time data.
  • A sign of life. One log line per round is enough to know it is working, and an alert when too long passes without a round is worth more than all the others.
  • The server's time zone in UTC. Leave conversion for display time, and never depend on the machine's zone.

What it costs, in practice

A results bot on top of an API is the cheap part of the bill: it fits the smallest plan at the bot hosts, and a small VPS handles several. Add the API subscription — our plans start at R$ 21.90 a month, as covered in how the subscription works — and you have the operation's total cost, which is predictable and does not grow with the number of members in the group.

Frequently asked questions

Where should I host a Telegram bot that runs 24/7?

On a bot host such as Discloud or SquareCloud, which keep the process up and publish on every push, or on a small VPS with systemd. A bot that only reads an API and sends messages fits the smallest plan at any of them.

Can I run a results bot on serverless?

You can, but only in the polling pattern: a scheduled function that polls /latest and compares with the last stored id. An open connection like /stream does not work on serverless, because the function has a timeout.

How much memory does a results bot need?

Tens of megabytes, if it only reads an API and sends messages. What demands a big server is running an automated browser, such as Selenium or Playwright, to scrape pages.

Why did my bot disappear after a server reboot?

Because it was started by hand, with no supervisor. Use systemd with Restart=always on a VPS, or a bot host, which already restarts the process for you, and have the bot ask for the history it missed with the after parameter on startup.

Read also