NetrunHome

What it costs

How to move a Telegram bot off a VPS and stop administering a server

· 6 min read

In short

Moving a Telegram bot off a VPS takes an evening: download the bot folder and its database file, upload the code to Netrun, add the token as a secret, put the database in the persistent folder, and stop the old bot so the token has a single instance. After that the platform runs the server: around-the-clock operation costs $1.49 a week or $4.99 a month, and systemd and system updates are no longer your problem.

A bot on your own VPS usually works fine right up to the first event: the disk fills up, the system updates, a certificate expires, a process dies — and you are back on SSH working out what happened. The extra annoyance is that this happens rarely and always at a bad moment: whatever sysadmin skill you had has faded since last time.

If you have one or two bots and never meant to administer a server, the move takes an evening. Here is the order of operations so nothing gets lost along the way.

  1. Take the code and the data off the server#

    Download the whole project folder, and separately look for the files the bot created itself: the SQLite database, uploaded images, caches. They are easy to forget — they are not in the repository, they sit next to the bot on the server disk. If the bot writes to PostgreSQL or MySQL, take a dump. Check the folder has a requirements.txt or package.json with the library list: without it you will be reconstructing dependencies by memory on the new place.

  2. Write down the environment variables#

    Look inside .env, the systemd unit file, or wherever your settings live: the bot token, keys for external services, the database connection string, the admin id. That is what has to travel separately from the code — none of those values should be inside the code itself.

  3. Upload the bot to Netrun#

    Upload the folder as an archive or connect a GitHub repository. The platform detects the language from your code, installs dependencies and builds the project — no Python or Node.js to install, no Dockerfile to write, no autostart to configure. The values from the old .env go in as secrets, so they never end up in the archive or the repository.

  4. Move the database across#

    Each project has a persistent folder: whatever sits in it survives publishing a new version of the code. Upload the SQLite file and any upload folders there, and your users, their settings and the accumulated history stay intact. If the bot used PostgreSQL, run the database as a separate service of the project and restore the dump.

  5. Stop the old bot before starting the new one#

    This is the crucial step of the move. A single token can only have one running instance: if the old bot on the VPS keeps polling Telegram, updates go to one copy and then the other, and the bot answers every other message. Stop the process on the server first, then start on the platform. Do not delete the server yet — let it sit for a day or two as insurance.

  6. Check the bot, then decommission the server#

    Run through the usual scenarios: the /start command, the main buttons, saving something to the database, replying after a restart. Logs are visible in your account in real time, so any error shows up as text. Once you are happy, cancel the rental. From then on the bot costs $4.99 a month (or $47.99 a year, roughly $4 a month), and system updates, autostart and disk space stop being your job.

The move is one evening of work, after which SSH is no longer part of your life. Upload the bot to Netrun, compare its behaviour with the old one, and switch the server off: the first 3 days are free, so you can run both side by side.

Common questions

How long does moving a bot off a VPS take?

Usually an evening: download the code and data, upload the project, enter the token and settings, move the database and test the scenarios. Testing takes longer than publishing. The first 3 days are free, so you can exercise the new bot while the old one is still on the server.

What do I do with the bot database?

The SQLite file and any upload folders go into the project persistent folder, which is kept when you publish a new version of the code. If the bot uses PostgreSQL or MySQL, run the database as a separate service of the project and restore the data from a dump.

Why does the bot answer every other message after the move?

Almost always because the old bot on the VPS is still running. A single token can only have one live instance — Telegram hands updates to one and then the other. Stop the process on the server.

Do I need to rewrite the bot code?

No. The same project moves across: the platform detects the language and dependencies from your files. The only thing worth fixing is moving the token and any keys out of the code and into environment variables, if they are still there.

Which ends up cheaper, a server or a platform?

The sticker prices are comparable: $4.99 a month or $47.99 a year. The difference is that the platform price includes the work you would otherwise do yourself: updates, autostart, restarts after a crash, keeping disk space free.

Can I go back to my own server if I do not like it?

Yes. The code stays yours and stays with you, the bot needs no platform-specific settings, and the files in the persistent folder can be downloaded from your account. Going back is no different from a normal server install.

Do I need my own server or VPS?

No. Netrun deploys your project on its own servers. There is no VPS to rent, no systemd or nginx to configure and no certificates to renew — all of that runs for you.

Is my data kept when I update the code?

Yes, as long as your data lives in persistent storage. For a regular project that is the /data folder: anything your app saves there stays in place when you update the code or restart, and you can browse and download the files on the "Data" tab. If you described the services yourself in docker-compose, persistent storage means the named volumes from your file, and such a project has no /data folder. Files written outside persistent storage are created from scratch on the next deploy. Your project link stays the same either way.

Where do I set tokens and other secret values?

Every project has a Secrets tab where you set the values from your code — for example the token from BotFather. We store them encrypted: you can see the variable names, but the values are shown to no one, including you.

Can I run several services at once?

Yes. With docker-compose you can bring up to five connected services in one project — for example, an app together with a database.

Get your own project online

Upload your code, answer a couple of questions and get a working link. There is a free plan

Try Netrun
All blog articles