a.k.a. Making of tjwoon.com, v1. Profit part to come soon :D
This is a study of the technical design and development of my website, which may be interesting because:
- I deploy my app to Google App Engine without sending any source code to Google;
- My website costs zero money apart from the domain (which can be free if you don't mind an appspot domain);
- I make use of multiple cloud hosting services but will only need to pay one of them if I get enough traffic to run over the free quota;
I'll just describe the 2nd and 3rd points in this blog post because my writing still sucks and I don't have time to describe the 1st point right now...
What do I serve from my website?
All of these have multiple free content publishing platforms which do a great job hosting and serving out the content. However, I wanted a single point to collect all the content I publish online, which means i will have to create a website of my own.
An important consideration is that I did not want to host the content on my own servers, because:
- Servers need maintenance and regular backup,
- Renting servers will limit my bandwidth, transfer volume, and speed,
- I do not want to monitor the website load and performance constantly, upgrading the hosting package, adding virtual machine instances, etc in case of any traffic spikes.
What the free content publishing platforms do very well is exactly what I would struggle to cope with given my own infrastructure. Therefore I decided to stay with these platforms, namely: Flickr, Blogger, and of course, Twitter.
Another benefit of having my content on both my own website and Flickr/Twitter/etc is that I might bring in more viewers from there :yay:
So far, we have this:
- Content must be hosted on 3rd party platforms (Flickr/Blogger/etc)
- I need to create a website which just links to the content above.
Naturally, I want the website to be hosted on a platform which also will not die on me in case of increasing load, so traditional web hosting solutions are out. My choices were now: Google App Engine, Amazon AWS, MS Azure, and other cloud hosting platforms.
I went with App Engine as that frees me from the hassle of infrastructure setup and maintenance.
We now have 4 service providers to deal with, 3 of which will either cost me money or simply break above a certain usage threshold. It is therefore important to design the website to keep costs low.
It actually won't cost me any money if the traffic goes directly to e.g. Twitter; but it will cost me money or downtime if I call their APIs too often, so I have to cache the API responses in my website.
Now we're really getting somewhere!
- Flickr, Twitter, Blogger
- Content Cache
I use Python on App Engine to serve my website. HTML templates are simply stored in the Python source code. Cache is stored in App Engine's NDB. Every time a request is made to my site, I check if the cache is past an age threshold, and refresh the cache asynchronously by fetching latest data from the content publishing platforms. (This means that the first visitor to my site after new content is posted will see the old cache contents - I will probably change the site to update the cache at regular intervals soon.)
I control the rate of calling the publishing platform APIs by simply adjusting the frequency of cache updates. As traffic increases, the only platform whose free quota might be depleted is App Engine.
Website ← Cache ← Flickr + Twitter + Blogger
An additional thing I did was to make sure I only upload compiled bytecode files to App Engine, as I am the paranoid sort of person. This was easy to do, but I will blog about it and post sample code another day!