Skip to content
himynameisjonas edited this page Jan 2, 2013 · 27 revisions

Deploying Jekyll? No problem: Just copy the generated _site to somewhere that your favorite web server can serve it up. There’re also automated ways to do it, listed below. If you’ve created your own way, edit away!

Post-update hook

If you store your jekyll site in git, it’s pretty easy to automate the deployment process by setting up a post-update hook in your git repository, like this.

Post-receive hook

This is where it’s at. You created a user account named deployer which has all the users public keys that are authorized to deploy in its `authorized_keys` file right? Great, deploying Jekyll is this easy then:

laptop$ ssh [email protected]
server$ mkdir myrepo.git
server$ cd myrepo.git
server$ git --bare init
server$ cp hooks/post-receive.sample hooks/post-receive
server$ mkdir /var/www/myrepo

Add the following lines to hooks/post-receive and be sure jekyll is installed on the server

GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=/var/www/myrepo

git clone $GIT_REPO $TMP_GIT_CLONE
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit

Finally do the following on any users laptop that needs to be able to deploy

laptops$ git remote add deploy [email protected]:~/myrepo.git

Deploying is now as easy as telling nginx or apache to look at /var/www/myrepo and running the following:

laptops$ git push deploy master

BOOM!

Rake

Another way to deploy your jekyll site is to use rake, highline, and net-ssh. A more complex example that deals with multiple branches used in gitready.

You can also deploy using a hybrid of Rake and rsync, using this predefined rake task

rsync

Just generate the _site and rsync it, e.g. with a tasks/deploy shell script.

There’s even a TextMate command to run this script.

ftp

As sometimes you don’t have anything else than FTP to deploy your site (not dedicated hosting), with glynn, you can easily generate your jekyll powered website’s static files and send them to your host through ftp.

Rack-Jekyll

Easy way to deploy your site on any server (EC2, Slicehost, Heroku, etc) with rack-jekyll. It also can run with shotgun , rackup , mongrel, unicorn , and more…

See rack-jekyll’s README

Read this post on how to deploy to Heroku. Or you can use Unicorn on Heroku with no need to generate the site before each deploy.

Jekyll-Admin for Rails

If you want to maintain Jekyll inside your existing Rails app, Jekyll-Admin contains drop in code to make this possible. See Jekyll-Admin’s README

Amazon S3

If you want to host your site in Amazon S3, you can do so with jekyll-s3. It will push your site to Amazon S3 where it can be served like any web server, dynamically scaling to almost unlimited traffic. This approach has the benefit of being about the cheapest hosting option available for low-volume blogs as you only pay for what you use.

Chef cookbook

There’s also a Chef cookbook available. Though in an early stage it might come in handy if there’s need to update some content at regular intervals. See its README for more information.

Clone this wiki locally