Running Ghost Blog with vagrant - Chef. My usual disclaimer, I assume you already have Vagrant and Virtual box setup. And Vagrant plugins for vbguest, omnibus and berkshelf.
Ghost requires both Ruby and Node and maintains Git submodule dependencies, which quite frankly turns it into a configuration nightmare. We'll use fnichol's excellent rvm cookbook, and the standard nodejs.
Here's my Berkfile with the cookbooks we'll be using:
cookbook "dmg", "<= 2.0.6"
cookbook "git"
cookbook "curl"
cookbook "rvm", git: 'https://github.com/fnichol/chef-rvm.git'
cookbook "nodejs"
cookbook "npm"
cookbook "sqlite"
Next up are the chef bits in the Vagrantfile. Pretty straightforward:
chef.add_recipe "git"
chef.add_recipe "rvm::vagrant"
chef.add_recipe "rvm::user"
chef.add_recipe "nodejs"
chef.add_recipe "npm"
chef.add_recipe "sqlite"
chef.json = {
:rvm => {
:user_installs => [
{
:user => "vagrant",
:default_ruby => "1.9.3-dev",
:rubies => ["1.9.3-dev"],
:global_gems => [
{ :name => 'bundler' }
]
}
]
},
:nodejs => {
:version => "0.10.25",
:npm => "1.3.24",
:install_method => "grunt-cli"
},
}
Once everything is setup you can run bundle install
for the ruby bits and npm install
for the node bits. Hopefully they can switch out the ruby shortly as the ruby SASS library leads to the problem below.
The SASS gem will attempt to save cached files inside our directory. This causes all sorts of problems with the Vagrant mapping and Git repo that all all pointing to the same set of files. The quickest solution is to just modify the grunt action to a different location with the 'cache-location': '/tmp/sass-cache',
under options.
And that's it! Run using npm start
or your favorite daemonizer.
####Creds
- https://github.com/TryGhost/Ghost/blob/master/CONTRIBUTING.md#working-on-ghost-core
- https://github.com/fnichol/chef-rvm
fin