Product / Provider | Description | Cost |
---|---|---|
Linode | Primary VPS with on-site backup enabled | $12.50 / month (scales as needed) |
Linode | Failover VPS | $5 / month |
ServerPilot | Primary VPS server management | $10 / month |
ServerPilot | Failover VPS server management | $0 |
Spatie Laravel Backup | VPS backup | $0 |
Amazon S3 | Off-site backup storage | $1 / month (estimate) |
DNS Made Easy | DNS hosting & failover | $35 / year |
This component is pretty straightforward and there are a few well known low-cost VPS "cloud" providers. I personally use Linode but have also tried DigitalOcean and Vultr and don't think you can go wrong with any of these hosts.
You will need two VPS instances: a primary and a failover. For the primary VPS, you will have to assess your hardware needs on a case by case basis. The $10 / month offering at the hosts mentioned above is a good starting point but this obviously depends on many variables such as the applications and content that you are serving but. Adding capacity is easy, inexpensive, and requires minimal to no downtime so my advice is to start with a less expensive plan and scale as needed. You can use tools like Apache Bench (free) or Loader.io (freemium) to test how your server behaves under load.
For the failover VPS, the $5 / month plans should be sufficient for a secondary instance that will hopefully never be used. This approach assumes that your failover simply displays a message that your site is currently unavailable (the "fail whale" approach).
Your primary and failover instances should be in different data centers and you should even consider using different hosts.
Some level of web-based server management for routine tasks like package updates, security patches, and creating sites and databases may be preferable over having to use the command line. For initial server configuration and ongoing maintenance I am using ServerPilot who provides all of this functionality without ever having to SSH into the server. They also provision LetsEncrypt (free) SSL certificates with the click of a button and automatically renew them. Even though ServerPilot configures your VPS initially and provides a simple control panel for common tasks, you are still able to access your server as root for your own customizations. ServerPilot is meant for PHP hosting so it's not ideal if you are a heavy user of another server-side scripting language.
The one-click SSL feature requires the $10 / month ServerPilot "Coach" plan. The $10 charge is per server but I personally did not have a need for SSL on my failover server so use the $10 plan for my primary server and the free plan for the failover server. This requires two ServerPilot accounts because you can only have one plan per account (a small inconvenience but not a deal breaker).
I also considered the following providers to help with server management but ultimately went with ServerPilot.
You can host your DNS for free using your hosting provider, domain registrar, or CloudFlare but there are advantages to using a company that specializes in DNS hosting including quicker resolution speeds and features like DNS failover. DNS failover is an inexpensive way to get some basic redundancy. It works by monitoring your primary server and automatically repointing your DNS to a secondary (failover) server in the event your primary server is unreachable. This switch is made almost immediately so there is little to no downtime for end users.
A good option for DNS hosting and failover is DNS Made Easy which offers a good balance between price and features. Some other alternatives include Amazon Route 53 and DynDNS.
Backup is a critical part of any infrastructure that warrants its own discussion but I'll touch upon it briefly in this article. All of the VPS providers mentioned above offer some level of backup for a nominal charge. This is a good first layer of protection but should not be all you rely on for backups. These providers store your backups in the same data center where your VPS is located so if the data center is unavailable (think DDoS attack) your backups will also be unavailable. Additionally, hosting provider backups do not typically allow for granular control over backup frequency and rotation.
A great tool which pairs well with the backup solutions offered by hosting providers is an open source package from the folks at Spatie.be called Laravel Backup. Despite the name, you can actually backup an entire VPS and its databases with this package and push the backups to any filesystem driver supported by Laravel. You will need to be familiar with Laravel to setup and configure the package but once you do it can backup files, directories, and databases on your VPS.
If you are not familiar with Laravel or comfortable installing / configuring this package, a good alternative is Ottomatik but it does come at a cost.