The current directory doesn't get created by capistrano when trying to deploy for the first time.
I try to deploy:check the project and everything is just fine, but when I actually deploy the process ends up in error:
DEBUG [8d5bfb3a] Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'
cap aborted!
if test ! -d /home/deployer/apps/reputationmonitor-api/current; then echo "Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'" 1>&2; false; fi exit status: 1
if test ! -d /home/deployer/apps/reputationmonitor-api/current; then echo "Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'" 1>&2; false; fi stdout: Nothing written
if test ! -d /home/deployer/apps/reputationmonitor-api/current; then echo "Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'" 1>&2; false; fi stderr: Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/command.rb:98:in `exit_status='
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/sshDEBUG [ac4ea3f3] Finished in 0.053 seconds with exit status 0 (successful).
INFO unicorn is running...
/connection/session.rb:561:in `channel_request'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/net-ssh-2.9.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/abstract.rb:75:in `within'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/capistrano3-unicorn-0.1.1/lib/capistrano3/tasks/unicorn.rake:17:in `block (3 levels) in <top (required)>'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/ngw/.rvm/gems/ruby-2.1.1@ec-api/gems/sshkit-1.4.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => unicorn:start
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: if test ! -d /home/deployer/apps/reputationmonitor-api/current; then echo "Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'" 1>&2; false; fi exit status: 1
if test ! -d /home/deployer/apps/reputationmonitor-api/current; then echo "Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'" 1>&2; false; fi stdout: Nothing written
if test ! -d /home/deployer/apps/reputationmonitor-api/current; then echo "Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'" 1>&2; false; fi stderr: Directory does not exist '/home/deployer/apps/reputationmonitor-api/current'
From my experience it's normally caused by a previous problem that didn't let the deploy end, but I can't really see any noticeable exception or error (but I might be missing something obvious).
lock '3.2.1'
set :application, 'reputationmonitor-api'
set :scm, :git
set :repo_url, '[email protected]:thefoolsrl/EngagementConsole-API'
set :ssh_options, {user: 'deployer', forward_agent: true}
set :stages, %w(staging demo production)
set :default_stage, 'staging'
set :user, 'deployer'
set :group, 'deployer'
set :deploy_to, '/home/deployer/apps/reputationmonitor-api'
set :format, :pretty
set :log_level, :debug
set :linked_files, %w{config/database.yml config/redis.yml config/unicorn.rb}
set :linked_dirs, %w{bin log sockets tmp/pids tmp/sockets}
set :redis_config, "#{shared_path}/config/redis.yml"
set :unicorn_config_path, "#{deploy_to}/shared/config/unicorn.rb"
set :sidekiq_timeout, 30
set :sidekiq_options, " -e #{fetch(:stage)} -C #{current_path}/config/sidekiq.yml -r #{current_path}/config/environment.rb -L #{shared_path}/log/sidekiq.log"
set :rvm_ruby_version, '2.1.1'
set :keep_releases, 5
namespace :deploy do
desc 'Start application'
task :start do
on roles(:app), in: :sequence, wait: 5 do
execute "sudo service nginx start"
end
end
desc 'Stop application' do
task :stop do
on roles(:app), in: :sequence, wait: 5 do
execute 'sudo service nginx stop'
end
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute 'sudo service nginx reload'
end
end
task :migrate do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
with rack_env: fetch(:rack_env) do
execute :rake, "db:migrate"
end
end
end
end
end
namespace :remote_invoker do
desc 'Restart RemoteCallbackInvoker Daemon'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
with rack_env: fetch(:rack_env) do
execute :ruby, "./scripts/callback_invoker restart"
end
end
end
end
end
after 'deploy:updated', 'deploy:migrate'
after "deploy:updated", "deploy:cleanup"
after 'deploy:migrate', 'unicorn:restart'
after 'unicorn:restart', 'remote_invoker:restart'
Does anybody have any clue what can I look to debug this?