github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

ezmobius / chef-deploy

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 213
    • 21
  • Source
  • Commits
  • Network (21)
  • Issues (3)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • url_change
  • Tags (1)
    • v0.1.4
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Chef Resources and Providers for deploying ruby web apps without capistrano — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

tiny refactoring 
smerritt (author)
Tue Dec 08 11:25:56 -0800 2009
ezmobius (committer)
Mon Jan 04 13:52:19 -0800 2010
commit  e047bb3f13b01e102264bd63e544d243f5d8a083
tree    667a0e6f9eacdcc6a833a16bc7909a41eade2190
parent  6dc44acd04da8444c21d32ba467e98b29eac6879
chef-deploy /
name age
history
message
file LICENSE Tue Mar 24 14:23:42 -0700 2009 first commit of chef-deploy [ezmobius]
file README.rdoc Fri Jun 26 12:05:39 -0700 2009 formatting for readme [ezmobius]
file Rakefile Fri Oct 30 15:11:20 -0700 2009 make copy_exlude actually work [ezmobius]
file TODO Tue Mar 24 14:23:42 -0700 2009 first commit of chef-deploy [ezmobius]
directory lib/ Mon Jan 04 13:52:19 -0800 2010 tiny refactoring [Sam Merritt]
README.rdoc

chef-deploy

A gem that provides resources and providers for deploying ruby web apps from chef recipes

Uses the same directory layout as capistrano and steals the git remote cached deploy strategy from cap and adapts it to work without cap and under chef. Not all options are required but they are all shown here as an example.

 require 'chef-deploy'

 deploy "/data/myrackapp" do
   repo "git://github.com/engineyard/rack-app.git"
   branch "HEAD"
   user "ez"
   role "app_master"
   enable_submodules true
   migrate true
   migration_command "rake db:migrate"
   environment "production"
   shallow_clone true
   revision '0xbeadbeef'
   restart_command "touch tmp/restart.txt" # "monit restart all -g foo", etc.
   action :deploy # or :rollback
 end

Chef-deploy is backwards compatible with capistrano in the fact that it uses the same exact filesystem layout. You can deploy with cap on top of a chef-deploy system and visca-versca(sic?).

Chef-deploy hooks:

If you create a APP_ROOT/deploy directory in your app you can place named hook files in there that will be triggered at the appropriate times during the deploy. the hooks are defined as follows:

APP_ROOT/

  deploy/
    before_migrate.rb
    before_symlink.rb
    before_restart.rb
    after_restart.rb

These scripts will be instance_eval’d in the context of the chef-deploy resource. This means that you will have certain commands and variables available to you in these hooks. For example:

  run "echo 'release_path: #{release_path}' >> #{shared_path}/logs.log"
  run "echo 'current_path: #{current_path}' >> #{shared_path}/logs.log"
  run "echo 'shared_path: #{shared_path}' >> #{shared_path}/logs.log"
  sudo "echo 'sudo works' >> /root/sudo.log"

You have access to a run command and a sudo command. Both of these will run shell commands, run will run as your normal unix user that the app is deployed as and sudo will run as root for when you need more permissions.

You will have variables like in capistrano:

  release_path: this is the full path to the current release:  /data/appname/releases/12345678
  shared_path: this is the path to the shared dir: /data/appname/shared
  current_path: this is the path to the currently symlinked release:  /data/appname/current
  node:  node is the full chef node object, this will have all of the JSON collected by ohai as well as any custom json you passed into your client run. THis way you can get at *any* data you have available to any of your chef recipes.

Using subversion:

In your deploy block, simply add: scm ‘subversion’ (as well as svn_username and svn_password, if needed). Obviously, git-specific options like enable_submodules can be removed as they’re not applicable.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server