Blog tech and hosting
12 Mar 2018 | technology codeThis iteration of my website and content will continue to evolve but for now there are two key components:
- Blog adamrumbold.com
- API api.adamrumbold.com
Domain registration and management
My domain is registered through Netregistry. I’ve delegated the domain however to Cloudflare as this provides free hosting that supports full management and CDN capability for small sites.
Blog hosting and technology
The main blog is managed through Github pages. This allows for free hosting and management of the blog through my github account and an associated adamrumbold.github.io project.
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.
Summary
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.