-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.json
1 lines (1 loc) · 6.6 KB
/
search.json
1
[{"content":"I have wrote about my previous setup for Hugo blog here that was using the AWS S3 bucket and CloudFront as static site. Although it is decent setup, there are some complexities that can be simplified.\n First, that setup will cost you the S3 bandwidth charges. Storage charges are not much because of the small size but if traffic on your blog is increasing it will increase the AWS bill. Deployment is bit complex. If you are not aware how AWS S3 and CloudFront works, you will have a hard fixing/upgrading it. So to solve these problems, I found a better solution, use Github pages to host your blog with a custom domain. Github pages are free and serve the site from the Github repo. This way there is no cost involved for the hosting. Hugo has simple official support documentation to run it on Github pages. Deployment is very simple, just push the changes to the Github repo.\nI have dumped the fancy io domain hemc.io to simple .com domain hemc4.com which costs 1/4 of the io domain.\nIt is better the keep the whole setup simple for maintainability. Simpler the setup, less friction it will generate to do the actual work.\nHugo Site on Github Pages Hugo has official documentation for setting up site with Github pages. This is concise and self sufficient for the setup. I just followed the approach with the 2 repos setup.\n Private repo to Hugo files Public repo for generated static site files I have slightly modified the script for pushing the changes to private repo.\n Internet is full of the more complex setup with Github actions and different CI/CD tools, but I prefer this simple setup for deploy. After every new post creation just run the script.\n./deploy.sh\nCustom domain for Github Pages Custom domain setup requires changes on the DNS file of your domain and the Github bucket repo settings.\nSetting up the domain DNS entries Domain requires 4 A entries and 1 CNAME entry in the DNS file.\nSetting up Github repo if you face any problem while setting up custom domain Github has detailed guide here\n References:\nHugo official doc for Github pages hosting\nGithub official docs for custom domains\nSetting up a custom domain to point to Github pages\nGithub custom domain troubleshooting\n","description":"","title":"Hosting Hugo Blog on Github Pages","uri":"/posts/hosting-hugo-blog-on-github-pages/"},{"content":"I am software Engineer with interest in highly scalable and high performance systems.\nIn my free time I like to read books and riding off road bikes.\n Please follow the links in the bottom to connect.\n","description":"","title":"About","uri":"/about/"},{"content":" Update :- This deployment in not in use anymore. check new setup here\n For quite a while, I was planning to restart my blog to share my recent adventures and learnings in tech/life but the headache of maintenance and monthly bill to keep running it, leads to keep procrastinating it.\nWhy not Wordpress ? I once started using blogspot during my college days and it was amazing but it didn't work for too long. Although the hosting, custom domain and other things were sorted, the efforts to customize little things annoyed me. Then after some friends recommendations, switched it to popular Wordpress but high server cost,time for maintenance and security issues forced me to look for alternatives.\n A lot of non-programmers, tech-savvy people are using Wordpress and it is really easy to maintain, just install plugin for almost everything you want to do with Wordpress then why it is a maintenance overhead ?\n Every other week I could see some bot scanning the very known Wordpress architecture to figure out loopholes and take it down and I don't want my Wordpress server sending backdoor data or displaying porn ads on my blog. All I needed was simple static blog with the comments on. Medium would have worked fine but I wanted more control on the content.\nHugo While reading some post in Go community I came to know Hugo, a static site generator. The idea of converting the .md docs to blog was really exciting. Those Markdown docs I keep creating during day to day base programming sessions, could be converted to blog post real quick.\nAfter browsing through docs, It appeared very simple, powerful and really fast. I heard @spf13(Creator of Hugo) mentioning in talk that someone using Hugo to generate 25k static blog posts and it is still fast.\nInstallation I have installed it on my favorite cloud AWS by simple following steps on this post. Once this you setup this way there is no need to put the content on server, it just directly serves from s3 using Cloudfront and Route53.\nThis setup is very cheap and if you are running on AWS free tier then almost free.\nCustomization Didn't you just said it is dead simple then why you need to customize it ?\n Hugo comes with it's own command line tools to generate, test and deploy the blog, once you put it with s3 it requires some additional scripts to handle seamless deployment so why not just write some script and bind it to tools you use everyday. I decided to combine it with npm by just adding some custom scripts.\nIntegration with npm Hugo has it's own commands to run and build. In this simple config file, I have created small small scripts to handle these commands on Hugo level.\n AWS CLI Integration makes these scripts more powerful to handle build and deployments.\nRun Local npm start command is linked to run Hugo server with all the drafts on local machine. Whenever you make any changes to files it reloads the blog in browser.\nBuild During the build, I don't want to reset my git logs as I am maintaining a state of blog on Github, So instead of deleting the whole public folder, only content will be removed not the .git files\n Deploy In case of s3 Hugo setup, deployment require these things\n Sync the local updated files with s3 bucket Invalidate the Cloudfront cache to serve the fresh posts from s3 bucket Check Deploy Status Invalidation some times takes a while so how do I know if the cache is clear and the blog serving the updated posts ?\n There might be some better way to solve this problem but I came with a simple script that checks the aws cloufront status from aws-cli and you can check the status of the latest deployment.\n So you only need few npm commands to publish a blog post.\n#run the local server npm start # create a new post hugo new post/first-post.md # build npm run-script build #deploy npm run-script deploy #check deploy status npm run-script deploystatus Now it is really easy to add a new post and simply publish it in single command. If you found any other way to simplify , Please put in comments.\nHappy Blogging :)\n","description":"","title":"Switching to Hugo Blog","uri":"/posts/hugo-blog/"}]