Reputation: 13
I am trying to deploy my rails applications to AWS using NGINX and Capistrano. running the deploy command:
$ cap production deploy
[41abe7d2] Running ~/.rvm/bin/rvm version as [email protected]
DEBUG [41abe7d2] Command: ~/.rvm/bin/rvm version
DEBUG [41abe7d2] rvm 1.26.11 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
DEBUG [41abe7d2]
DEBUG [41abe7d2] Finished in 0.429 seconds with exit status 0 (successful).
rvm 1.26.11 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
DEBUG [61defd93] Running ~/.rvm/bin/rvm current as [email protected]
DEBUG [61defd93] Command: ~/.rvm/bin/rvm current
DEBUG [61defd93] ruby-2.2.1
DEBUG [61defd93]
DEBUG [61defd93] Finished in 0.140 seconds with exit status 0 (successful).
ruby-2.2.1
DEBUG [01260e54] Running ~/.rvm/bin/rvm ruby 2.2.1p85 do ruby --version as [email protected]
DEBUG [01260e54] Command: ~/.rvm/bin/rvm ruby 2.2.1p85 do ruby --version
DEBUG [01260e54] Please note that `rvm ruby ...` was removed, try `ruby 2.2.1p85 do ruby --version` or `rvm all do ruby 2.2.1p85 do ruby --version` instead. ( see: 'rvm usage' )
DEBUG [01260e54]
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: ruby exit status: 1
ruby stdout: Please note that `rvm ruby ...` was removed, try `ruby 2.2.1p85 do ruby --version` or `rvm all do ruby 2.2.1p85 do ruby --version` instead. ( see: 'rvm usage' )
ruby stderr: Nothing written
here is my capfile
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/rails/assets' # for asset handling add
require 'capistrano/rails/migrations' # for running migrations
require 'capistrano/puma'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
here is my deploy.rb
# config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'Speyskraft_cms'
set :repo_url, 'https://[email protected]/onozor/speyskraft_cms.git' # Edit this to match your repository
set :branch, :master
set :deploy_to, '/home/deploy/speyskraft_cms'
set :scm_username, "deploy"
set :scm_passphrase, "onozorgheneho"
set :pty, true
set :linked_files, %w{config/database.yml config/application.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
set :keep_releases, 5
set :rvm_type, :user
set :rvm_ruby_version, 'ruby 2.2.1p85' # Edit this if you are using MRI Ruby
set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind
set :puma_conf, "#{shared_path}/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_error.log"
set :puma_error_log, "#{shared_path}/log/puma_access.log"
set :puma_role, :app
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
set :puma_threads, [0, 8]
set :puma_workers, 0
set :puma_worker_timeout, nil
set :puma_init_active_record, true
set :puma_preload_app, false
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
please can some help me out of this mess this is my first time deploying on AWS. Thanks in Advance.
Upvotes: 1
Views: 2261
Reputation: 81
In my case error is: SSHKit::Runner::ExecuteError: Exception while executing on host x.x.x.x.x.com: Don't know how to build task 'puma:restart' (See the list of available tasks with cap --tasks
)
Sloution:
just go to deploy.rb file
see puma restart section
find the following line and comment it like this: # after :finishing, :restart
save the file now run cap production deploy or cap dev deploy boom!
Upvotes: 0
Reputation: 271
A failure at SSHKit::Runner::ExecuteError: means that the prod server can't process your request correctly. Try installing nodejs and yarn on the user you deploy to. Docker simplifies the stack by abstracting much of the production configuration from the developer.
cap production deploy --trace
sudo apt-get install nodejs
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
Upvotes: 0
Reputation: 18444
That is because of space in your :rvm_ruby_version
causing deprecated-like rvm commands to be generated, try replacing to:
set :rvm_ruby_version, 'ruby-2.2.1p85'
Upvotes: 1