Hacker News new | ask | show | jobs
by K0nserv 3492 days ago
I use Github to host the source for my blog/website which is open source. Jekyll for the building which happens on Travis CI. Deployment on S3 with cloudflare as a CDN for SSL and reduced bandwidth. I really like this setup. I wrote a guide called The One Cent Blog[0] a while back detailing how it's setup. Typical months the cost is around $0.01-$0.03.

Becuase people usually ask why S3 over Github pages I'll answer it up front. Github pages is too limited in terms of what you can do with custom jekyll plugins and code.

0: https://hugotunius.se/2016/01/10/the-one-cent-blog.html

5 comments

However, you can simplify this on your computer like I do by having a repo with your source, disabling jekyll on github, and pushing the results to the user.github.io repo so that github acts like s3 and you get a $0.00 blog.

Nice thing for S3 though is you could cloudfront it if you wanted to for some reason. And it's in your control.

Yeah, I do this too - https://github.com/jrheard/blog is my source, https://github.com/jrheard/jrheard.github.io is the generated static site. This allows me to use whatever Jekyll plugins I want.

I literally wholesale copy-pasted the Rakefile in http://ixti.net/software/2013/01/28/using-jekyll-plugins-on-... in order to set this up, it was very easy thanks to that great article - all you have to do is run `rake publish` at the command line, and your site builds locally and the finished product is deployed to your github pages repo.

I like your Travis CI setup, I may copy it myself.

Here's the workflow I currently use if the OP wants something with less moving parts. I just use s3_website from the command line. It will even create the s3/cloudfront configuration completely automatically.

    gem install s3_website
    ; set up s3_website.yml and AWS environment variables
    s3_website cfg apply ; this creates and configures the S3 bucket and cloudfront configuration
    s3_website push ; push to S3, invalidate cloudfront caches
If you're just hosting a static blog website/personal site - is it really worth using Travis on it?

I've yet to use it on mine and curious if I should start essentially.

No. People add so much unnecessary overhead and bullshit these days. All you need for static is a push from local to your host with SCP. A one-line script if you include some markdown to HTML, or just use Jekyll and straight SCP that.
To each their own. I actually think this setup is much simpler. I just have to push to git which I'd be doing in any case and it automatically deploys everything. If I were to manually sync I'd both have to remember that and I'd have to figure out a secure way to store the credentials.
I figured as such...I just use Github Pages with my own domain, develop on one branch and push changes to gh_pages...and done. Simple and fast.
+1

For basic blogs/sites github pages are free and fast. For all custom static sites I run a local Jekyll setup with multiple plugins and push the _site folder to Github for free hosting.

> Typical months the cost is around $0.01-$0.03.

For how many visitors?

Not that many admittedly, about 10k requests from 1.5k unique users in the past month. With that said 10m requests would still only come out at $4 so it's still a good choice for most low traffic sites.
I just checked one article on my WordPress to have a point of comparison. That's 87 requests total and 4.7 MB.

The first page of HN (and reposts) will bring over 100k views in the month.

Either I'm crazy, or that's about 1M HTTP requests and 500 GB of traffic to serve u_u

Serving that over S3 or CloudFront would be $45 (mostly traffic charge). OMG. Definitely not a bill i want for my personal blog.

That's a great idea for a future post: "The day I listened to HN advice and bankrupted myself by hosting my blog on S3". With a live counter and animations to see how much each visitor is ruining me in real time, it will be awesome! :D

I guess it depends on your page size. My pages average around 10kb and make two requests per page. At 1m hits that's still only $0.80 if we don't include Cloudflare reducing the number of requests that reach S3. If anything 87 requests and 4.7mb makes it sound like you have a bit of an obesity[0] problem on your blog.

0: http://idlewords.com/talks/website_obesity.htm

I'd say you're the one who has a lack of content problem.

Just the raw text of the article is over 10kb.

The pictures (logo, header, images, graphs in the articles) are easily 0.1 to 1 MB for every article.

The specific article I checked has 2 animated gifs which are MB each. That's why the 5 MB. I sure don't want to pay $50 because of a picture.

Well, there's your problem then. You could easily not host the gifs, or use a much slimmer format to reduce those MBs.

If you host your page on a "pay-per-view/size" service, then it might make sense to not send as much content as you can, but instead try to reduce it.

I used to have my site on s3, but the last time I was on hn I got dinged $450 (images and 4k videos)

now I self host with failover to s3.

I don't understand why you need the S3 if you're already hosting it on github pages.
Sorry about the confusion. The source[0] is hosted on Github, but the actual page when compiled to static files is hosted on S3.

0: https://github.com/k0nserv/hugotunius.se

Yeh I think everybody is saying that if you are already hosting the source on GH, there is no need to host the static files on S3 -- you may as well just host it on GH:pages, because that will be free and you get all the benefits of S3.
Plus, you can use custom URLs on Github pages.