Skip to content

Instantly share code, notes, and snippets.

@cobaltgit
Last active January 26, 2024 20:03
Show Gist options
  • Save cobaltgit/fc032f3a52a450fafd04be767488664a to your computer and use it in GitHub Desktop.
Save cobaltgit/fc032f3a52a450fafd04be767488664a to your computer and use it in GitHub Desktop.
A Guide to Discord Bot Hosting

Cobalt's Guide to Discord Bot Hosting

Here is a guide to help you what Discord bot host to pick. This was originally a tag on the discord.py server, but was moved to this GitHub gist as it eventually rolled over the 2000 character limit.

VPS Hosting (best)

I recommend a cheap VPS server as the best way to host your bot online for 24/7. Here are some good picks, credit to the discord.py server for this

Scaleway - EU
Linode - EU/US/Asia
DigitalOcean - EU/US/Canada/Asia
Vultr - EU/US/Asia
OVH - EU/US/Canada/Singapore/Australia
Hetzner - Germany/Finland/US
Time4VPS - Lithuania
UpCloud - EU/US/Singapore/Australia
Netcup - EU

Location-wise, I'd go for a server in the United States, which yields blazing fast websocket latency

Free Hosting

Free PaaS Services

I don't recommend or endorse the usage of "free" services such as Replit, Heroku, Railway or Glitch. The below options are usually the better ones in this category.

  • These hosts are designed to host web applications, hence why ports are exposed to the Internet
  • Deployments are typically ephemeral, which means every time your bot is restarted, the contents are wiped. Flat-file databases such as SQLite are out of the question here
  • Keeping your bot online 24/7 on their free plans requires a sidecar web server, which will only take up more resources. Glitch, however, has banned the usage of ping services such as Uptime Robot, making you pay to host your bot
  • Overpriced paid plans ($7/month just to keep a single Heroku dyno online 24/7, exponentially increasing from here)
  • Heroku's dependency control is barebones, which means things like lxml (libxml) and PyNaCl (libsodium, needed for voice support) won't work in native environments, requiring you to resort to using third party buildpacks to facilitate extension control
  • Railway (uses Heroku buildpacks) has some restrictions on what is hosted on their platform (disallows music bots, Lavalink)
  • Important: They typically use a shared IP for everything that runs on their servers - in layman's terms, if a bad actor runs a self bot or gets API banned on their service, you and everyone on that IP address will be affected

Cloud Free Tiers

AWS, Google Cloud and Azure have 1 year free micro instances, enough for smaller bots. However, AWS may charge if you go over their resource limits on their EC2 micro.

Oracle Cloud has a very powerful (up to 4 cores, 24GB RAM and 200GB disk) always free tier instance powered by Ampere Altra Q80-33 2.8GHz ARM processors, however your mileage may vary - they sometimes have a tendency to delete your instance after around 60 days, so a boot volume backup would be handy to make in that window of time, so you can seamlessly recreate your instance if it gets disabled.

Shared Hosts

With shared bot hosts such as PloxHost, PebbleHost and the likes, your mileage may vary, depending on your choice. Some may oversell their nodes (squeezing as many instances onto a single server), leaving you with little resources, hindering your larger bot's performance.

Don't fall for hosts that have "unmetered" server space (see above for PloxHost screenshot), they may have hidden limits to keep their nodes under load - in short, false advertising

Self Hosting

Self hosting depends on your internet connection. If you have a good enough fibre optic connection, you should be alright for a small bot. The Raspberry Pi series of single board computers is a viable option for this use case, however any computer with sufficient resources will work. Your mileage may vary, depending on these conditions. Self-hosting however also has its caveats, such as power cuts downing your bot with no ETA and high network usage on larger bots

Credits

  • The discord.py server, for providing most of the information on free hosts, as well as VPS provider suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment