Blog tech and hosting12 Mar 2018 | technology code
This iteration of my website and content will continue to evolve but for now there are two key components:
Domain registration and management
Blog hosting and technology
This has also had the added benefit of allowing me to move to a static wCMS, with all posts written in Markdown and managed as a new file in the github project. The website is run as a Jekyll site, using the Lanyon theme. I linked in my google-analytics account details so I can get some metrics on visitors and their behaviour.
It was reasonably straightforward to use a migration tool to export my existing WordPress blog and repackage the content into the Jekyll based site. Since then I’ve continued created semi-regular updates.
API hosting and technology
The API is based on an open source project and was initially setup to work with RedHat OpenShift. Due to upgrades in that platform that did not support the use of custom subdomains for hosted content, I migrated to AWS. Initially this was using a Ubuntu instance on EC2 to keep the service running. That however proved too expensive, so I looked to take advantage of AWS serverless architecture to serve the content. Given you only pay for the transactions through the lambda function - this should prove very cheap way to host this rarely called service.
Unfortunately this was trickier than I first thought - with the main steps and traps being:
- install the Node serverless packages including the serverless-offline package for local testing
- modify the project with a serverless.yaml and other minor modifications
- test locally
- set a very large (300000) AWS_CLIENT_TIMEOUT environment variable to avoid a deployment timeout
- deploy to AWS
However since AWS API Gateway only supports HTTPS the following steps were also requried
- copy and upload Cloudflare certificate into AWS Certificate Manager (US-East-1 region only)
- setup the custom domain in the API Gateway and map the default path to the production stage of the API
- using the API Gateway generated cloudfront domain create a CNAME entry for api.adamrumbold.com
- ensure the ‘orange’ CDN enabled flow is configured for the subdomain on Cloudflare
It’s now all working and hopefully next months AWS bill is only a few cents and not the $15-$20 of previous months for a dinky EC2 server running 24x7.
I’m pretty happy with the setup now. I’m paying around $25 / year for the domain registration, and that is it!
The DNS, the blog, the CDN and DDoS protection are all free. The API is not free but should be next to nothing given the cost is $3.5 per million calls to the API.