Skip to content
pmatos edited this page Aug 18, 2011 · 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 (<- Broken link, any alternative?).

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, like used for litanyagainstfear A more complex example that deals with multiple branches used in gitready.

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

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

Clone this wiki locally