See all articles
Deploying Jekyll website to Heroku

Deploying Jekyll website to Heroku

Last time we showed you how to deploy Phoenix application to Heroku. In this article we will show you how to host static website there.

Recently we wanted to setup a staging environment for one of our `Jekyll` powered websites on Heroku.

It turns out, it’s easy to host Jekyll websites as `rack` apps with the puma server - so we thought we’d share with you how to do it.

Configuration

Update Gemfile

You need to add the following gems to your `Gemfile`:

  • `rack-jekyll` - for transforming your Jekyll app into a `rack` app
  • `rake` - for generating pages during deploy (necessary because Heroku provides a read-only filesystem)
  • `puma` - for serving your `rack` app

Create Procfile

Heroku uses `Procfile` for declaring what commands are run on dynos, so we need one as well:

web: bundle exec puma -t 8:32 -w 3 -p $PORT

This basically will start `puma` with 3 workers and 8-32 threads per worker.

You can find all the config options here.

Add config.ru

Since we are going to run a `rack` app we need `config.ru` file:

require 'rack/jekyll' require 'yaml'
run Rack::Jekyll.new

Deploy

Now are ready to deploy our app to Heroku:

git push heroku master

Simple, huh? If you have configuration issues that you would like us to handle, then let us take a look at your DevOps setup. We have helped many software companies in the USA and around the world with their systems configuration. Reach out to us at iRonin now!

Read Similar Articles