Hosting your bot
Where to run your Discord bot — free tiers, paid VPS, container platforms, your own machine. Honest trade-offs and what to watch for.
CloudLine watches your bot, but it doesn't run it for you. You need somewhere for the bot's process to live — somewhere with a stable internet connection, enough CPU and RAM, and ideally a way to restart automatically when something crashes. This page goes through the realistic options and what to expect from each.
NOTE
This guide is host-agnostic. CloudLine works with any Linux box, container, VM, or serverless function that can make outbound HTTPS requests. There are no special integrations or recommended providers.
What your bot actually needs
A Discord bot is a long-running process. The host has to provide:
- A stable WebSocket connection to Discord. Discord's gateway is sensitive to TCP idle timeouts — anything that drops idle connections after 60–300 seconds will produce constant reconnects.
- Enough RAM to keep your bot's cache. Most small bots fit in 128 MB; larger ones (music, big guild counts) need 512 MB or more.
- Persistent or auto-restart on crash. If the bot dies, something needs to bring it back. CloudLine notices the outage but doesn't restart for you.
- Outbound HTTPS allowed. Both to Discord (gateway + REST) and to CloudLine's heartbeat endpoint.
That's it. Almost any modern hosting platform can do this; what varies is cost, reliability, and how much DevOps you have to learn.
The realistic options
Your own machine (home server, NAS, Raspberry Pi)
Cost: free (the electricity bill).
Good for: hobby bots, small private servers, testing.
Pros:
- No monthly fee.
- Full control.
- Great learning experience.
Cons:
- Residential ISP downtime. Your ISP routinely cycles your connection every few days. Each cycle is a brief outage for the bot.
- Power outages = bot offline. Without a UPS, every power blip restarts the bot.
- Network instability. Home networks have lower SLAs than data center networks.
- You're responsible for security. A misconfigured router can expose more than the bot.
Reliability tier you'll hit: typically Good (97-99%) due to ISP cycles. Possibly At-risk if your ISP is unstable.
Watch for: NAT timeouts on your home router killing the gateway connection. If you see frequent zombies, run the gateway watchdog from Zombie state.
Free tiers (Replit, Glitch, Railway hobby, Fly.io free)
Cost: free with limits.
Good for: very small bots, quick experiments, learning.
Pros:
- Cheap or free.
- Easy to get started — paste code, click deploy.
- Built-in restart on crash.
Cons:
- Sleep on idle. Most free tiers suspend your process after some period of inactivity. Discord bots are technically "active" (they hold a WebSocket), but some platforms count only HTTP traffic and put your bot to sleep anyway.
- Limited resources. 256 MB RAM and shared CPU is common — fine for tiny bots, painful for anything with caching.
- Outbound rate limits. Some free tiers cap outbound bandwidth, which can rate-limit your bot's actions on Discord.
- Sudden policy changes. Free tiers tighten or shut down. Don't build production bots on free hosting.
Reliability tier you'll hit: Good to At-risk depending on the host. Free hosting is rarely better than 95%.
Watch for: the bot showing offline every night around the same time — that's the host putting it to sleep. Solutions: pay for the no-sleep tier, or switch platforms.
VPS (Hetzner, DigitalOcean, Linode, Vultr)
Cost: $4–10 / month for a small box.
Good for: most personal and small-team bots, the "right" answer for ~80% of users.
Pros:
- Predictable reliability. Most providers hit 99.9% uptime.
- Full root access. You can install whatever you want.
- No sleep, no cold starts. The box is always on.
- Plenty of RAM and CPU for the price.
Cons:
- You manage the OS. Updates, firewall, restarts on reboot — all on you.
- No free tier worth speaking of. $4/month minimum.
- You need basic Linux skills. Or willingness to learn.
Reliability tier you'll hit: comfortably Excellent (99%+) with a process manager configured.
Setup: deploy your bot, install PM2 (Node) or use systemd (Python), enable on-boot start. Examples below.
Container platforms (Railway, Render, Fly.io paid tier, Heroku)
Cost: $5–20 / month for a small bot.
Good for: people who want VPS reliability without the OS management.
Pros:
- Deploy from git — push to main, and the bot restarts on the new version.
- Auto-restart on crash built in.
- Logs, metrics, dashboards out of the box.
- No OS to maintain.
Cons:
- Pricier than VPS for the same compute.
- Less control. Some platforms force you to listen on a port (your bot doesn't have one), which can be awkward.
- Cold starts if the platform supports auto-sleep — make sure you disable it.
Reliability tier you'll hit: Excellent as long as the platform is healthy and you've disabled sleep.
Watch for: platforms that require a HTTP endpoint. You can either expose a dummy /health route from your bot, or pick a platform that supports background workers.
Pterodactyl / "game-style" hosts (Wispbyte, Sparked, BisectHosting)
Cost: $3–10 / month.
Good for: people who want a web UI without learning Linux. Optimized for Discord bots specifically.
Pros:
- Built for Discord bots. Templates for discord.js, discord.py, common frameworks.
- One-click restart from the panel.
- File manager + console in the browser.
- Cheap at the entry tier.
Cons:
- Less flexible. Hard to install custom software.
- Resource quotas can be tight at the cheapest tier.
- Quality varies wildly between providers — pick one with good uptime history.
Reliability tier you'll hit: Good to Excellent depending on the provider.
Cloud (AWS / GCP / Azure)
Cost: $5–50 / month depending on what you use.
Good for: people already invested in a cloud ecosystem, or scaling beyond one bot.
Pros:
- Massive scale options if your bot grows.
- Mature tooling.
- Integrated everything — databases, secrets, logs.
Cons:
- Significant complexity for one Discord bot.
- Easy to overspend. A misconfigured load balancer can cost more than the bot itself.
- Steep learning curve.
Use cloud if you already know cloud. Otherwise it's almost always overkill for a Discord bot.
Process managers
Whatever host you pick, you want the bot to automatically restart if it crashes — otherwise one unhandled exception means your bot is down until you notice.
PM2 (Node.js)
The standard Node process manager. Install once, then:
npm install -g pm2
pm2 start index.js --name mybot
pm2 save
pm2 startup # creates an init script for boot-startPM2 also handles log rotation and restart-on-OOM. Configuration: ~/.pm2/dump.pm2.
systemd (any Linux)
The native service manager on every modern Linux distro. Create a unit file /etc/systemd/system/mybot.service:
[Unit]
Description=My Discord Bot
After=network.target
[Service]
Type=simple
User=botuser
WorkingDirectory=/home/botuser/mybot
ExecStart=/usr/bin/python3 bot.py
EnvironmentFile=/home/botuser/mybot/.env
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl daemon-reload
sudo systemctl enable mybot
sudo systemctl start mybot
sudo journalctl -u mybot -f # follow logsRestart=always brings the bot back if it crashes. RestartSec=10 avoids tight restart loops.
Docker
Wrap the bot in a Dockerfile and run with --restart unless-stopped. For Node:
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
CMD ["node", "index.js"]Then:
docker build -t mybot .
docker run -d --name mybot --restart unless-stopped \
-e CLOUDLINE_BOT_ID=bot_… \
-e CLOUDLINE_SECRET=clb_live_… \
-e DISCORD_TOKEN=… \
mybotDocker's --restart unless-stopped handles crash recovery. Logs via docker logs -f mybot.
Environment variables
However you host, never commit secrets to your repo. Use whatever your host provides:
- VPS / systemd:
EnvironmentFile=/path/to/.envin the unit file. - PM2: a
.envnext to your bot +pm2 start --update-env. - Docker:
--envflags or--env-file .env. - Container platforms: the host's Secrets / Environment Variables UI.
- Cloud: AWS Secrets Manager, GCP Secret Manager, Doppler.
The two CloudLine variables you need are:
CLOUDLINE_BOT_ID— short string from the dashboard URL.CLOUDLINE_SECRET— theclb_live_…heartbeat secret.
See Heartbeat secret for the full story on safe storage.
A pragmatic recommendation
If you're starting from zero:
- Just experimenting? Replit or Railway free tier. Move when you grow.
- Personal bot for your friends? Hetzner CX11 (€4/month) or DigitalOcean droplet. Comfortably runs anything for years.
- Bot for hire or paid SaaS? VPS or container platform. Set up CI/CD. Use a process manager. Monitor seriously.
- You don't want to learn Linux? Pick a container platform (Railway, Render) or a Pterodactyl host.
Whichever you pick, attach the CloudLine SDK to your bot — see Quick start — so you actually find out when something breaks.