What does this `force` option does that is in the apps databag?


#1

Hi chefians!

In the standard application cookbook’s rails recipe, the following is defined.

deploy_revision app['id'] do
  revision app['revision'][node.chef_environment]
  repository app['repository']
  ......
  action app['force'][node.chef_environment] ? :force_deploy : :deploy
  ssh_wrapper "#{app['deploy_to']}/deploy-ssh-wrapper" if app['deploy_key']
  shallow_clone true
  ......
end

And this values are passed from the apps databag:

....
"force": {
  "production": false, "development": true, "test": false
},
....

@sean_horn from Opscode said: force feeds into the chef_deploy resource.

But I was not clear enough.

Can someone explain with a use case what does that feeds into the chef_deploy resource means?

And what does that shallow_clone true does in the above defined deploy_revision app['id'] do..... mean?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


#2

It means that the deploy revision’s action is force_deploy rather than deploy. From http://wiki.opscode.com/display/chef/Deploy+Resource

The drawback to the revision deploy strategy is that if the deploy fails for any reason, and you want to re-deploy with the same code, you’ll need to manually set the action to :force_deploy. Forcing a deploy will remove the old release directory and then proceed with the deployment as usual. Be forewarned that this can cause downtime if you force a deployment over the current release.

I.e. most of the time you want it as false. If you are testing things or for what ever reason the deploy didn’t work fully (like you are tweaking the scripts or something just went wrong) then you set it to force once, run chef and then set it back.

-ash

On 17 Mar 2012, at 15:20, Sachin Sagar Rai wrote:

Hi chefians!

In the standard application cookbook’s rails recipe, the following is defined.

deploy_revision app['id'] do
  revision app['revision'][node.chef_environment]
  repository app['repository']
  ......
  action app['force'][node.chef_environment] ? :force_deploy : :deploy
  ssh_wrapper "#{app['deploy_to']}/deploy-ssh-wrapper" if app['deploy_key']
  shallow_clone true
  ......
end

And this values are passed from the apps databag:

....
"force": {
  "production": false, "development": true, "test": false
},
....

@sean_horn from Opscode said: force feeds into the chef_deploy resource.

But I was not clear enough.

Can someone explain with a use case what does that feeds into the chef_deploy resource means?

And what does that shallow_clone true does in the above defined deploy_revision app['id'] do..... mean?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow