So this application works perfectly fine when I deploy it to Heroku
I am trying to deploy this to a VM (a plain ubuntu droplet on digital ocean)
Have set up Capistrano as expected. Am unable to figure out where this error is possibly coming from
SSHKit::Runner::ExecuteError: Exception while executing as deploy@<IP ADDRRESS>: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
The Capistrano deploy logs are as follows:
00:21 deploy:assets:precompile
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
#<Thread:0x00007ff9d8ba40f8 /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
13: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
12: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:31:in `run'
11: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
10: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/capistrano-rails-1.6.1/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'
9: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:92:in `within'
8: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/capistrano-rails-1.6.1/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'
7: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:100:in `with'
6: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/capistrano-rails-1.6.1/lib/capistrano/tasks/assets.rake:69:in `block (6 levels) in <top (required)>'
5: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:80:in `execute'
4: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
3: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:148:in `tap'
2: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
1: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/command.rb:97:in `exit_status=': rake exit status: 1 (SSHKit::Command::Failed)
rake stdout: Nothing written
rake stderr: Nothing written
1: from /Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/josh.kurien/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sshkit-1.21.1/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@<IP ADDRRESS>: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: Nothing written
rake stderr: Nothing written
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@<IP ADDRRESS>: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
Caused by:
SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@<IP ADDRRESS>: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
** DEPLOY FAILED
Tried running the last command manually (as shown in debug logs)
cd /home/deploy/mark_antony/releases/20201201034511 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.7.1" RAILS_ENV="production" RAILS_GROUPS="" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
and this works perfectly fine. When i try to run this build on the server manually, that works too
Need some help please 😅
This is my deploy.rb
:
# config valid for current version and patch releases of Capistrano
lock "~> 3.14.1"
set :application, "mark_antony"
set :repo_url, "[email protected]:browneinstitute/mark.git"
# Default branch is :master
set :deploy_to, "/home/deploy/#{fetch :application}"
append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', '.bundle', 'public/system', 'public/uploads'
set :keep_releases, 5
append :linked_files, "config/master.key"
Side Note: I manually made a new current
symlink to a release directory that was created in this manner to see if nginx is able to serve the webpage.
And it is able to
So I figured this always failed at precompile assets and the answer here: https://stackoverflow.com/a/61210930/2358326
helped solve the issue, except I had to add a slightly different value for the path
# add in deploy.rb
set :default_env, {
PATH: '$HOME/.nvm/versions/node/v14.15.1/bin/:$PATH',
NODE_ENVIRONMENT: 'production'
}
this was because running $ which yarn
on the VM returned the following:
/home/deploy/.nvm/versions/node/v14.15.1/bin/yarn