Created
April 13, 2016 03:01
-
-
Save stephenreid/bc708484101a2b3d3475e91a651a9680 to your computer and use it in GitHub Desktop.
Amazon Opsworks Assets Deploy
This file contains 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
Chef::Log.info("Precompiling assets for RAILS_ENV=#{rails_env}...") | |
# Precompile assets. Assets are compiled into shared/assets and shared between deploys. | |
shared_path = "#{new_resource.deploy_to}/shared" | |
# create shared directory for assets, if it doesn't exist | |
directory "#{shared_path}/assets" do | |
mode 0770 | |
action :create | |
recursive true | |
end | |
# symlink current deploy's asset folder to shared assets each deploy | |
link "#{release_path}/public/assets" do | |
to "#{shared_path}/assets" | |
end | |
directory "#{shared_path}/cache" do | |
mode 0770 | |
action :create | |
recursive true | |
end | |
# symlink current deploy's cache folder to cache assets each deploy | |
link "#{release_path}/tmp/cache" do | |
to "#{shared_path}/cache" | |
end | |
execute "rake assets:precompile" do | |
cwd release_path | |
command "bundle exec rake assets:precompile" | |
environment "RAILS_ENV" => rails_env | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment