Skip to content

Instantly share code, notes, and snippets.

@matthewjackowski
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewjackowski/8913638 to your computer and use it in GitHub Desktop.
Save matthewjackowski/8913638 to your computer and use it in GitHub Desktop.
Ghost Vagrant Setup - Similar to what the project has already except provisioning using Chef

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

:octocat:fin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment