2
votes

I trying to deploy rails app through capistrano. All assets (css, js and images) build by webpacker. I removed app/assets folder and now deploy failed when capistrano trying to backup manifest. This task running always https://github.com/capistrano/rails/blob/master/lib/capistrano/tasks/assets.rake

If I enable sprockets require "sprockets/railtie" everything is fine.

1

1 Answers

3
votes

As explained in the capistrano-rails README, if you don't use the asset pipeline, then exclude capistrano/rails/assets from your Capfile. In other words:

# Instead of this:
require "capistrano/rails"

# Require only these:
require "capistrano/bundler"
require "capistrano/rails/migrations"

However, if you are using Webpacker, then there is a good chance that you still need to run asset-pipeline tasks. Notably, you still probably need to run assets:precompile during deployment, in order to trigger the webpack build.

In this case, you would need a more precise exclusion of the backup_manifest task. Following the instructions in the official Capistrano docs, you can clear the default implementation as follows:

# In deploy.rb
Rake::Task["deploy:assets:backup_manifest"].clear_actions