Skip to content

Instantly share code, notes, and snippets.

@DanThiffault
Created March 20, 2012 11:41
Show Gist options
  • Save DanThiffault/2134403 to your computer and use it in GitHub Desktop.
Save DanThiffault/2134403 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 'build-essential'
cookbook 'ruby_build',
:git => 'git://github.com/fnichol/chef-ruby_build.git', :ref => 'v0.6.2'
cookbook 'rbenv',
:git => 'https://github.com/fnichol/chef-rbenv', :ref => 'v0.6.10'
cookbook 'apt',
:git => 'https://github.com/opscode-cookbooks/apt'
cookbook 'unicorn'
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 precise64 http://files.vagrantup.com/precise64.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 = "precise64"
# 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/precise64.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 "rails-lastmile"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment