deploy_revision with asset pipeline compilation


#1

Ohai Chefs!

I’ve a situation with my rails app deployment.

This assets:precompile hook is taking a LONG TIME, almost 5mins just waiting, though the assets were not modified.

deploy_revision app[‘id’] do


before_restart do
# release_path is the path to the timestamp dir for the current release
current_release = release_path
# Create a local variable for the node so we’ll have access to the attributes
deploy_node = node
# A local variable with the deploy resource.
deploy_resource = new_resource
Chef::Log.info “---- Release path is: #{current_release} ----”

Chef::Log.info "*" * 20 + "COMPILING ASSETS" + "*" * 20
execute "asset_precompile" do
  cwd release_path
  user app['owner']
  group app['group']
  command "bundle exec rake assets:precompile --trace"
  environment ({'RAILS_ENV' => rails_env})
end

end
end

There are gists available for capistrano recipe.
What I want is to add somekind of check and if repo is updated, do the compilation.
If not then just move/copy the earlier compiled assets without breaking the asset pipeline.


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