I was looking for a way to add commenting functionality to the blog. The obvious candidate was Disqus but I did not choose it for 2 reasons:
- It’s too heavy(at around 200KB)
- It contains ads
The weight itself would kill my quest for page speed instantly.So I set up to find a way to provide commenting ability on the blog. I knew this would probably lead me to a self-hosted solution but that did not scare me. Requirements were quite simple:
- It must be cheap(or be hostable under EC2 nano - 512MB RAM for the whole instance)
- It must be easily customizable
Isso
After a bit of research, I found Isso. After looking at it a bit, I gave it a shot. The running service consumes just under 35MB of RAM(idle). This means even if it doubles its memory consumption under load, the EC2 nano instance should be able to handle this service. Isso also states, that the required JS only comes at “40kb (12kb gzipped)”. This is way better than Disqus. I have some python experience so editing it to suite my needs should not be too hard. I end up sticking with Isso.
The architecture
I start setting it up and hit a few roadblocks on the way, but I’ll explain those in a bit. Here’s what the final architecture looks like on AWS:
As I mentioned before everyting runs under EC2 nano. Supervisord runs inside the EC2 instance and ensures that the nginx and Isso are continuously running. If the instance restarts, Supervisord assures that both of them are also started. Nginx is mostly there if I ever decide to use the same instance for some other service and not just comments. For now it only exposes isso and adds a no cache header to the response as I’m using CloudFront. Talking about which, the cloud front distribution is needed because I really wanted my service to be accessible with https. The easy way to do that in AWS is to get a certificate from AWS certificate manager. These can only be applied to AWS resources, so you can’t add it to your instance directly. You could add an application load balancer in front of your EC2 instance but these are costly and will set you back at least 20$ a month. When you consider that the whole instance will set you back 5$ a month the load balancer does not seem worth it. The way to make the ssl cheaper is use a CloudFront distribution. You point it to your EC2 instance and point your Route 53 records to the CloudFront distribution. Now you can communicate with Isso through a secure channel.
Lowering costs
To lower the costs for your EC2 instance to just under 4$(or even cheaper if you commit for a longer period) you can take a reserved instance. Combined with the Route 53(which you are gonna pay for a domain anyway) and CloudFront costs the totals for the comments per month is less than 4.5$/month for me at the moment.
Configuration files
Below you’ll find the all the configuration files I’ve used:
What do you guys think? Is Isso a good choice for self-hosted comments? Do you even self-host your comments? Let me know in the comments below!