bdw53
By:
bdw53

Rails Nginx Capistrano error with deployment during assets:precompile - Ubuntu 16.04

September 27, 2017 149 views
Ruby on Rails Nginx Deployment DigitalOcean Ubuntu 16.04

Been working my way though a few errors but can't seem to get through this one. Trying to deploy my API with:

bundle exec cap production deploy

and am making it further and further but now I'm stuck. Sorry for all the block code.
Error with trace:

00:04 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 rake aborted!
      01 Don't know how to build task 'assets:precompile' (see --tasks)
      01 /home/deploy/crimelist/shared/bundle/ruby/2.4.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
      01 /home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `load'
      01 /home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `<main>'
      01 (See full trace by running task with --trace)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xxx.xxx.xx.xxx: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
Don't know how to build task 'assets:precompile' (see --tasks)
/home/deploy/crimelist/shared/bundle/ruby/2.4.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `<main>'
(See full trace by running task with --trace)
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
Don't know how to build task 'assets:precompile' (see --tasks)
/home/deploy/crimelist/shared/bundle/ruby/2.4.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `<main>'
(See full trace by running task with --trace)
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/command.rb:99:in `exit_status='
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/netssh.rb:167:in `execute_command'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:141:in `tap'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:74:in `execute'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/capistrano-rails-1.3.0/lib/capistrano/tasks/assets.rake:69:in `block (6 levels) in <top (required)>'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:93:in `with'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/capistrano-rails-1.3.0/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:85:in `within'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/capistrano-rails-1.3.0/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:29:in `run'
/home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:precompile
The deploy has failed with an error: Exception while executing as deploy@xxx.xxx.xx.xxx: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
Don't know how to build task 'assets:precompile' (see --tasks)
/home/deploy/crimelist/shared/bundle/ruby/2.4.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `load'
/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `<main>'
(See full trace by running task with --trace)
** Invoke deploy:failed (first_time)
** Execute deploy:failed


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


 DEBUG [80122b45] Running $HOME/.rbenv/bin/rbenv exec bundle check --path /home/deploy/crimelist/shared/bundle as deploy@xxx.xxx.xx.xxx

 DEBUG [80122b45] Command: cd /home/deploy/crimelist/releases/20170927171619 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.1" ; $HOME/.rbenv/bin/rbenv exec bundle check --path /home/deploy/crimelist/shared/bundle )

 DEBUG [80122b45]   The following gems are missing

 DEBUG [80122b45]    * byebug (9.1.0)

 DEBUG [80122b45]   Install missing gems with `bundle install`

 DEBUG [80122b45] Finished in 0.424 seconds with exit status 1 (failed).

  INFO [0f55c9a5] Running $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/crimelist/shared/bundle --without development test --deployment --quiet as deploy@xxx.xxx.xx.xxx

 DEBUG [0f55c9a5] Command: cd /home/deploy/crimelist/releases/20170927171619 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.1" ; $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/crimelist/shared/bundle --without development test --deployment --quiet )

  INFO [0f55c9a5] Finished in 0.687 seconds with exit status 0 (successful).

 DEBUG [92749045] Running if test ! -d /home/deploy/crimelist/releases/20170927171619; then echo "Directory does not exist '/home/deploy/crimelist/releases/20170927171619'" 1>&2; false; fi as deploy@xxx.xxx.xx.xxx

 DEBUG [92749045] Command: if test ! -d /home/deploy/crimelist/releases/20170927171619; then echo "Directory does not exist '/home/deploy/crimelist/releases/20170927171619'" 1>&2; false; fi

 DEBUG [92749045] Finished in 0.047 seconds with exit status 0 (successful).

  INFO [37973eb4] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as deploy@xxx.xxx.xx.xxx

 DEBUG [37973eb4] Command: cd /home/deploy/crimelist/releases/20170927171619 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.1" RAILS_ENV="production" RAILS_GROUPS="" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )

 DEBUG [37973eb4]   rake aborted!

 DEBUG [37973eb4]   Don't know how to build task 'assets:precompile' (see --tasks)

 DEBUG [37973eb4]   /home/deploy/crimelist/shared/bundle/ruby/2.4.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'

/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `load'

/home/deploy/.rbenv/versions/2.4.1/bin/bundle:22:in `<main>'

 DEBUG [37973eb4]   (See full trace by running task with --trace)

Capfile:

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'

require 'capistrano/rails'
require 'capistrano/passenger'

 require 'capistrano/rbenv'
 set :rbenv_type, :user
 set :rbenv_ruby, '2.4.1'



# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#   https://github.com/capistrano/passenger
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
 #require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
# require 'capistrano/passenger'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

application.rb:

require_relative 'boot'
require "rails"
require 'sprockets/railtie'
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
require "sprockets/railtie"
require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Crimelist
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Only loads a smaller set of middleware suitable for API only apps.
    # Middleware like session, flash, cookies can be added back manually.
    # Skip views, helpers and assets when generating a new resource.
    config.api_only = true
  end
end

I'm not sure what the "don't know how to build task 'assets:precompile'" means or what "SSHKit::Runner::ExecuteError: Exception while executing as deploy@xxx.xxx.xx.xxx: rake exit status: 1" means.

Be the first one to answer this question.