In some ways, it’s the getting started with chef problem. But, I’m trying to create a simple recipe to checkout from github my jekyll code then run jekyll to build it locally. I’ve not started worrying about getting the nginx configuration running, but I’ve tried just about 100 different permutations of the ‘before_migrate’ script and have yet to find a way to load jekyll into either a gem that’s available or into the path to do an command "jekyll ..."
Here is the current recipe as it stands:
include_recipe "git"
application "corpsite" do
path "/opt/tubularlabs/corpsite"
repository "git@github.com:Tubular/corpsite.git"
revision "master"
deploy_key <<EOF
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
EOF
before_migrate do
execute 'Deploy Jekyll blog' do
chef_gem "jekyll" do
action :install
end
require "jekyll"
command "jekyll"
action :run
end
end
end
UPDATE:
The problem turned out not to be a recipe issue at all, but rather that one of the HTML docs contained a UTF-8 charactered and jekyll was running with LC_ALL=C thus barfing. It didn’t help that this was of course the first recipe I ever tried to write.
For historical sake, heres’ the final script
before_migrate do
chef_gem "jekyll"
execute 'Deploy Jekyll blog' do
cwd release_path
environment ({"LC_ALL" => "en_US.UTF-8"})
command "jekyll"
end
end
I’ve installed gems and required them before like this
Hopefully that works out for you (tried it with jekyll and works)