Running a scalable site in 2020

Running a scalable, fault tolerant, backed up, HTTPS secured, automate-able blog in 2020, for around €3,50 a month, is easier than ever.

Background

When I set out to start this blog, I wanted to have a cost effective setup, which would also allow me to scale the blog in future if I somehow got a load of traffic I didn’t expect.  

In this post, I’m briefly going to go over a few of the points around the features that this blog has for it’s incredibly low price, and hopefully show that in this day and age, it’s pretty easy to run a site for a fairly low cost, while still being confident that it can be scaled up and support thousands of requests fairly easily and efficiently if required.

Fault Tolerance

All the services needed to run this site are containerised and ready for deployment using a container orchestration platform.

In this department, this site uses Docker Swarm.  While not the necessarily the industry standard for container orchestration right now, it is one of the simplest, with minimal overhead and setup required to get things going.  Thus, this means if I were needing to add a lot of new capacity, I could bring up new instances with Scaleway, and simply join them to the swarm to allow more compute capacity to be added at a software level.

In the long run, yes, we would like to do this with something like Terraform, but in a short period of time, or for a personal blog, this may or may not be required, and is still possible either way.


Scalability

A large basis for this ability lies in where and how this blog is hosted.  For starters, the instance it is hosted on, is on Scaleway.  Scaleway offers anything from tiny,  inexpensive hosts, to giant hosts, able to run very heavy workloads.  The smallest instances start at just €2,99 per month.  And this is indeed what this blog uses as a host.

However, even though this is a small inexpensive host, it can also be scaled very easily.  Spinning up new hosts on demand is a quick and seamless process, and additionally Scaleway offers items such as Load Balancers, so that these instances can be put behind a load balancer if ultimately required to support the load of the site.

Additionally, the internal load balancer that this blog uses (Traefik - https://containo.us/traefik/) I have mentioned many times before, and allows me to run the site with confidence, that if I were to add more instances to the Swarm, Traefik would automatically be able to scale with this (with some configuration of course) and easily be able to handle this increased load, with minimal effort.

All in all, this means that, should I quickly need a bunch more instances to support the load of the site, I can do so in fairly short notice.  The current total monthly cost for the instance that I run for this blog is indeed €2,99 per month, and Traefik itself is open source! - https://github.com/containous/traefik


Security/HTTPS

In this day and age, it’s crazy to run a site that is not HTTPS/SSL enabled.  Luckily there are lots of services out there today which make this a lot simpler and more cost effective than in the past.

This blog runs Traefik, as mentioned, and in turn, uses Let’s Encrypt to obtain short-lived, automated, easily obtainable SSL certificates for verification.  Traefik handles most of this process, and ensures that the blog stays HTTPS enabled and secure.

The only configuration that I have had to do in this regard, is the acme configuration in traefik itself to support and generate the required certificates.  I covered what this configuration looks like in the Traefik v1 to v2 upgrade post - https://blog.devinsmith.co.za/traefik-1-2-migration/


DNS

To mange the DNS entries and services that run behind this domain, I use Amazon Route53.  This is a robust, trusted and cost effective solution for managing DNS.  

With a low cost, and a widely known and understood API, Route53 is a great choice to have a minimal overhead, as well as be able to implement a lot of self-service and self-updating features using the API driven services in the background. This service really has made this component of domain management simple, and yet extremely powerful for someone running personal services.

The entire cost for this service is around $1 a month in total.  And obviously there is a yearly renewal cost for the domain, however I am excluding this cost for now, as I use the domain for many other uses than just this blog.


Backups

The scary part, that everyone seems to worry about!  Thankfully, with Scaleway offering a service that is fully AWS S3 API compatible, and offering 75GB of storage/transfer for free, setting up backups on this blog, manually, was not difficult.  

It might not be the most elegant solution, but in the background there is a crontab, which compresses the blog data into a tar archive, and uploads that to Scaleway’s S3 service every day.

This means that the blog has daily backups.  I can tune this to my liking if necessary, potentially only running once a week if I deem it not necessary to run every day, or running it more often if I’d like.

As there is a free 75GB on this service with Scaleway, this backup that I have enabled for the blog is free and I do not get billed for it.  Happy to update here if this changes.


Conclusion

Looking at the total costs here, we are looking at a total of around €3.50 per month to run everything involved in the operation of this blog.

What is more impressive in my mind, is that we are accomplishing a large majority of the factors covered in “The Twelve-Factor App” and more - https://12factor.net/.  This is something I try to follow day to day, and usually find incredible valuable.  

Yes, I fully understand this site isn’t it’s own “App” in essence, but we have fault tolerance, scalability, backups and we are addressing the codebase and deployment issues, by deploying the services using Github Actions (covered in my previous post here: https://blog.devinsmith.co.za/deploying-this-blog-with-github-actions/)

In my mind, fairly impressive that in this day and age, we can run services like this, in the cloud, with no need to own physical servers, and still have it meet all these criteria and then some.

As always, credits to the services and items that I use to achieve this, none of this would be possible without:

In a future post, I hope to be covering another facet of this, how to monitor a blog like this, for as little cost as possible ;)

As always, I get my header images from Unsplash (https://unsplash.com/) - credits to the image on this post to Fabian Irsara (https://unsplash.com/photos/67l-QujB14w)


This was a bit of a different post, let me know if you enjoyed this style.  As always, there are many varying opinions, the ones expressed here are just mine.  Thanks for reading as always.

-Devin

comments powered by Disqus