This blog was previously hosted on small linux vps using ghost. I liked the idea of changing it to a statically generated one and hosting it on s3, saves cost and web performance is much better with Cloudfront and Route53.
Things/Tools used
- Hugo
- Jenkins CI
- S3 Plugin for Jenkins
- Gitlab Plugin for Jenkins
- Gitlab CE
- AWS S3
- AWS CloudFront
- AWS Route53
Recipe
Move existing content
Both ghost and hugo uses markdown format, so was easy to migrate for me, and its like 4 posts!
Create website with generated content zip using wizard Host a Website
Register or Transfer domain on Route53
Create IAM role / Access Key to allow full s3 access to allow Jenkins to publish content on s3
Install Jenkins S3 Plugin and add IAM role / Access Key credentials in Jenkins Configuration
Setup git repository (I’m using self hosted gitlab)
Install Hugo on Jenkins server, I’m using Ubuntu 16.04 as base OS
sudo apt-get install hugo
Create Freestyle project on Jenkins for deploying blog
Configure git repository in source countrol management
Configure push event trigger in Jenkins
Configure push webhook in Gitlab ( This step will vary as per git repo hosting method )
Jenkins build step
Publish content to s3 in post build using
Its done, now just push to git repo to publish content!