Deploying Hugo blog on S3 with Jenkins

August 2017 ยท 2 minute read

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

Recipe

  1. Move existing content

    Both ghost and hugo uses markdown format, so was easy to migrate for me, and its like 4 posts!

  2. Create website with generated content zip using wizard Host a Website

  3. Register or Transfer domain on Route53

  4. Create IAM role / Access Key to allow full s3 access to allow Jenkins to publish content on s3

  5. Install Jenkins S3 Plugin and add IAM role / Access Key credentials in Jenkins Configuration

  6. Setup git repository (I’m using self hosted gitlab)

  7. Install Hugo on Jenkins server, I’m using Ubuntu 16.04 as base OS

    sudo apt-get install hugo

  8. Create Freestyle project on Jenkins for deploying blog

    1. Configure git repository in source countrol management

    2. Configure push event trigger in Jenkins

    3. Configure push webhook in Gitlab ( This step will vary as per git repo hosting method )

    4. Jenkins build step

    5. Publish content to s3 in post build using

  9. Its done, now just push to git repo to publish content!


contact - social@apurv.me