How to deploy Rails 4 with Capistrano 2 and precompile assets locally -
recently upgraded application rails 3 rails 4. in deploy scripts precompile assets locally , rsync them server(s). in rails 4 asset pipeline produces manifest- < random > .json
instead of manifest.yml
. since manifest files named differently, adds multiple manifest.json
files shared assets directory. application picks wrong manifest file, , serves old assets.
i have read various issues related in github pull request threads:
- https://github.com/capistrano/capistrano/pull/412
- https://github.com/capistrano/capistrano/issues/210
- https://github.com/capistrano/capistrano/pull/281
my options seem be:
don't share asset directory.
this break old clients asking old resources.
switch compiling assets on servers.
this add complexity server.
move manifest file outside of shared asset directory.
i have since learned option removed in rails 4.
are there other solutions problem?
i found best answer after looking @ standard capistrano rails asset precompile task. added command local precompile task moves old asset manifest current release asset_manifest.json. leaves 1 manifest when new 1 uploaded.
run "mv -- #{shared_manifest_path.shellescape} #{current_path.to_s.shellescape}/assets_manifest#{file.extname(shared_manifest_path)}".compact
moving manifest-.json current_dir asset_manifest.json allows capistrano restore correct manifest file on rollback.
Comments
Post a Comment