Skip to content

Instantly share code, notes, and snippets.

@zzondlo
Forked from DanThiffault/Cheffile
Created April 7, 2012 14:48
Show Gist options
  • Save zzondlo/2329482 to your computer and use it in GitHub Desktop.
Save zzondlo/2329482 to your computer and use it in GitHub Desktop.
Rails lastmile example
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'ruby_build',
:git => 'git://github.com/fnichol/chef-ruby_build.git', :ref => 'v0.6.0'
cookbook 'rbenv',
:git => 'https://github.com/fnichol/chef-rbenv', :ref => 'v0.6.4'
cookbook 'apt',
:git => 'https://github.com/fnichol/chef-apt'
cookbook 'nginx'
cookbook 'runit'
cookbook 'rails-lastmile',
:git => 'git://github.com/DanThiffault/rails-lastmile.git'
# Install librarian
gem install librarian
# Add its work directories to your gitignore
echo cookbooks >> .gitignore
echo tmp >> .gitignore
# Create the Librarian config file
librarian-chef init
# Create a spot for vendored cookbooks
mkdir cookbooks-src
# Can be whatever you'd like it to be
rails new coolapp
cd coolapp
# Install the gem
gem install vagrant
# Grab the 64-bit base box. This could take a while
vagrant box add lucid64 http://files.vagrantup.com/lucid64.box
# Make sure you're in the application directory and create a Vagrantfile
vagrant init
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "lucid64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
config.vm.network :hostonly, "33.33.33.10"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks","cookbooks-src"]
chef.add_recipe "apt"
chef.add_recipe "ruby_build"
chef.add_recipe "rbenv::system"
chef.add_recipe "rbenv::vagrant"
chef.add_recipe "nginx"
chef.add_recipe "rails-lastmile"
chef.json = {
'rvm' => {
'default_ruby' => 'ruby-1.9.2-p290',
'gem_package' => {
'rvm_string' => 'ruby-1.9.2-p290'
}
}
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment