Created
February 28, 2012 19:50
-
-
Save robinator/1934684 to your computer and use it in GitHub Desktop.
Deploying Rails 3.2 to passenger.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://guides.rubyonrails.org/asset_pipeline.html | |
Add: | |
<LocationMatch "^/assets/.*$"> | |
Header unset ETag | |
FileETag None | |
# RFC says only cache for 1 year | |
ExpiresActive On | |
ExpiresDefault "access plus 1 year" | |
</LocationMatch> | |
to v-host file. | |
Add: | |
load 'deploy/assets' | |
and | |
namespace :deploy do | |
task :restart do | |
# nothing | |
end | |
namespace :assets do | |
task :precompile, :roles => :web, :except => { :no_release => true } do | |
from = source.next_revision(current_revision) | |
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0 | |
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile} | |
else | |
logger.info "Skipping asset pre-compilation because there were no asset changes" | |
end | |
end | |
end | |
end | |
to deploy.rb | |
# http://stackoverflow.com/questions/9016002/speed-up-assetsprecompile-with-rails-3-1-3-2-capistrano-deployment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment