Self Hosting [Pt 1]
The Self Hosting series are guides to setup bare minimum server software on a number of operating systems. In these articles I will go through the steps to choose a hosting provider, install and configure server software and best practices for security in your systems. In Part 1 of this series we will discuss the various options and how to choose the right provider for your software.
What is Self Hosting?
Many business rely on services like AWS, Azure and Google Cloud Platform to handle infrastructure resources and for good reason: These services provide good secure defaults and offer benefits that are automatic. When you run your own backend systems (commonly referred to as "Self Hosting") you have the advantage of maintaining full control over your infrastructure. The trade-off is that if you are experienced enough you can implement a stronger and faster system than what is available with the various preconfigured platforms. Self hosting your services also typically has a lower cost than using a provider because you can choose what fits your needs most in a more flexible way than what you can do with many providers. Self hosting also decouples you from third party dependency in a specific platform like Amazon, Microsoft and Google which is nice if you, like me, feel morally obligated to not feed certain companies more money 💰
Consider your Needs
The first step is to figure out what your needs are. If you have an existing project you can use the tooling on your computer such as Activity Monitor or Task Manager to make best guesses as to what the hardware requirements of your platform are and then scale them up to how many users you expect to have and what scale your project is expected to be in the short term. For the purposes of this article I'll assume that you are just learning and wanting to setup your own service from scratch so we will go with what typically works best for most projects.
Many projects will do just fine with a Virtual Private Server (VPS) this is basically your own virtual computer hosted in a datacenter where things like network and availability are managed for you. If you really need extra power you can choose to go with a Dedicated Server which is also your own computer hosted in a datacenter but you have full machine resources instead of being inside of a virtual container. Dedicated servers are usually much more expensive and are typically better suited to mature projects with many users.
Note: You can also follow these steps on a personal computer or Virtual Machine but I would advise against running public facing software from your home as there are severe security, privacy and performance implications when doing so for example
- Your home network is slow compared to datacenter networks that typically have many high speed connections optimized for transfering large amounts of data in and out
- Your home network can be identified by outsiders if you expose it to the web attackers can gain information such as approximate location if you're network is not secured properly
- Your home network can be compromised by hackers if improperly exposed to the web and running a public service makes you more of a target for attacks. Attacks of this nature can compromise personal computers and devices connected to your home network
- Data centers typically have multiple failover connections to the internet which means if one goes down it's instantly reverted to another this maintains high availability of your services which is super important!
Choosing a Provider
At Cryptobyte we use Vultr for our systems and have for a long time. Vultr is a modern platform that provides high performance machines and virtual containers to host anything you want. There are a number of other providers as well such as Digital Ocean and Linode which offer comparable services. There are so many providers that a quick search for "hosting provider" will return vast amounts of results to choose from. As such you can search for ones that you believe fit best if you'd rather not go with the suggested ones.
Here are a few key points you will want to keep in mind when searching for a provider
- Only use reputable services. Do a search of the business and look around for people discussing them. If you can't find anything or see a ton of negative feedback choose a different provider.
- Only use modern consistently updated services. Check if the business has a blog or social media accounts and look for updates. Are they constantly adding new features and services or have they seemed to stall? If they are not updating their platform choose a different provider.
- Avoid sketchy services. Like anything on the web avoid using services that seem sketchy. You will be paying money for these services and you want to trust your provider with your payment information. You want to be able to trust that your service won't suddenly dissapear if the company goes out or anything of that nature.
- Avoid "Shared Hosting". Shared hosting is basically a server that's being split between many different customers. While you can find really, really cheap or free shared hosting providers they will typically be far slower with way less resources available to each customer. There's always been a trend in marketing for these services to say something like "Unlimited Storage*" which is never true because there is no such thing as unlimited in this context. Your system will constantly compete for resources with other systems running on the same machine so you will never get close to the performance of a VPS or Dedicated Server with Shared Hosting.
Here are a few bonus points that providers can offer which are nice additions
- Wide variety of supported operating systems. This is great if you're exploring and learning because there are many diffferent operating systems offering unique features that you can explore. We will cover a few of them in this series.
- Wide variety of service levels. As a system scales you will need to upgrade your server and add more capability. You will eventually need more hardware and more features so it's important that you can upgrade your service at any time and that the upgrade is relatively painless. You want to avoid services that require you to deploy a whole new machine to upgrade because that introduces a ton of work for no reason.
- Good security features are also important such as DDoS protection and automated backups these features will save you lots of trouble down the road. Firewall configuration is nice as well but not absolutely necessary because we will setup a software firewall later on that's free and easy to use.
Choosing a provider and service that meets your needs is an important step to self hosting your software. In the next few articles we will discuss configuring many different kinds of server software on your platform and getting things ready for hosting your own services. If you have any questions or comments feel free to comment below!