Rails 3.2
ruby 1.9.3
that's where my releases are stored on server
deploy#production-web:/var/www/mrd_production/releases$ ls
20150729224354 20150730101637 20150730110152 20150730122336
that's where my current productions are stored in server
deploy#production-web:/var/www/mrd_production/current$ ls
app config.ru Gemfile public spec
assets_manifest_backup db Gemfile.lock Rakefile tmp
bin doc Guardfile README Vagrantfile
Capfile features lib REVISION
config fixtures log script
So, I am using capistrano for deploy:
bundle exec cap production deploy
deploy.rb
lock '3.4.0'
set :application, 's2yd'
set :repo_url, 'git#bitbucket.org:mrdelivery/mxad-mr.-delivery.git'
set :keep_releases, 3
set :log_level, :info
set :linked_files, %w{.env}
set :linked_dirs, %w{public/system}
set :migration_role, :app
set :rbenv_type, :user
set :rbenv_ruby, '1.9.3-p484'
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 3 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
end
namespace :rails do
desc 'Open the rails console on the primary remote server'
task :console do
on roles(:app), primary: true do |host|
command = "cd #{deploy_to}/current && /home/#{host.user}/.rbenv/shims/bundle exec rails console #{fetch(:stage)}"
exec "ssh -l #{host.user} #{host.hostname} -p #{host.port || 22} -t 'cd #{deploy_to}/current && #{command}'"
end
end
end
config/deploy/production.rb
set :deploy_to, '/var/www/mrd_production' # Change this to match your deploy_dir in vars/app.yml
server '104.130.31.250', user: 'deploy', roles: %w{web app}
namespace :deploy do
desc 'generate_ymls'
task :generate_ymls do
on roles(:app) do
upload! File.expand_path('../../database.yml.production', __FILE__), "#{release_path}/config/database.yml"
end
end
end
before "deploy:migrate", 'deploy:generate_ymls'
After deploy, I enter the folder /var/www/mrd_production/current where my app resides...
deploy#production-web:/var/www/mrd_production/current$ RAILS_ENV=production rails c
irb(main):001:0> Rails.root
=> #<Pathname:/var/www/mrd_production/releases/20150730122336>
irb(main):002:0>
The problem is Rails.root points to /var/www/mrd_production/releases/20150730122336 but I need it to be pointed to the folder where I am in /var/www/mrd_production/current
How can I change Rails.root?
EDIT
bundle exec cap production deploy log:
INFO [8ba777a3] Running /usr/bin/env mkdir -p /tmp/s2yd/ as deploy#<server-ip>
INFO [8ba777a3] Finished in 0.269 seconds with exit status 0 (successful).
INFO Uploading /tmp/s2yd/git-ssh.sh 100.0%
INFO [867961a0] Running /usr/bin/env chmod +x /tmp/s2yd/git-ssh.sh as deploy#<server-ip>
INFO [867961a0] Finished in 0.267 seconds with exit status 0 (successful).
INFO [6be86a24] Running /usr/bin/env git ls-remote --heads git#bitbucket.org:mrdelivery/mxad-mr.-delivery.git as deploy#<server-ip>
INFO [6be86a24] Finished in 0.900 seconds with exit status 0 (successful).
INFO [e6f437c4] Running /usr/bin/env mkdir -p /var/www/mrd_production/shared /var/www/mrd_production/releases as deploy#<server-ip>
INFO [e6f437c4] Finished in 0.334 seconds with exit status 0 (successful).
INFO [37165e60] Running /usr/bin/env mkdir -p /var/www/mrd_production/shared/public/system as deploy#<server-ip>
INFO [37165e60] Finished in 0.266 seconds with exit status 0 (successful).
INFO [3c9b9d10] Running /usr/bin/env mkdir -p /var/www/mrd_production/shared as deploy#<server-ip>
INFO [3c9b9d10] Finished in 0.265 seconds with exit status 0 (successful).
INFO The repository mirror is at /var/www/mrd_production/repo
INFO [0002d83c] Running /usr/bin/env git remote update as deploy#<server-ip>
INFO [0002d83c] Finished in 2.495 seconds with exit status 0 (successful).
INFO [869b66a7] Running /usr/bin/env mkdir -p /var/www/mrd_production/releases/20150730220743 as deploy#<server-ip>
INFO [869b66a7] Finished in 0.271 seconds with exit status 0 (successful).
INFO [1b9871ea] Running /usr/bin/env git archive master | tar -x -f - -C /var/www/mrd_production/releases/20150730220743 as deploy#<server-ip>
INFO [1b9871ea] Finished in 0.528 seconds with exit status 0 (successful).
INFO [c28030f4] Running /usr/bin/env echo "6ce11b0" >> REVISION as deploy#<server-ip>
INFO [c28030f4] Finished in 0.266 seconds with exit status 0 (successful).
INFO [0af78fb4] Running /usr/bin/env mkdir -p /var/www/mrd_production/releases/20150730220743 as deploy#<server-ip>
INFO [0af78fb4] Finished in 0.273 seconds with exit status 0 (successful).
INFO [86aef2af] Running /usr/bin/env ln -s /var/www/mrd_production/shared/.env /var/www/mrd_production/releases/20150730220743/.env as deploy#<server-ip>
INFO [86aef2af] Finished in 0.267 seconds with exit status 0 (successful).
INFO [80cc46a1] Running /usr/bin/env mkdir -p /var/www/mrd_production/releases/20150730220743/public as deploy#<server-ip>
INFO [80cc46a1] Finished in 0.268 seconds with exit status 0 (successful).
INFO [bbfef99c] Running /usr/bin/env rm -rf /var/www/mrd_production/releases/20150730220743/public/system as deploy#<server-ip>
INFO [bbfef99c] Finished in 0.270 seconds with exit status 0 (successful).
INFO [66f90632] Running /usr/bin/env ln -s /var/www/mrd_production/shared/public/system /var/www/mrd_production/releases/20150730220743/public/system as deploy#<server-ip>
INFO [66f90632] Finished in 0.268 seconds with exit status 0 (successful).
INFO [e63b7bd2] Running ~/.rbenv/bin/rbenv exec bundle install --path /var/www/mrd_production/shared/bundle --without development test --deployment --quiet as deploy#<server-ip>
INFO [e63b7bd2] Finished in 0.701 seconds with exit status 0 (successful).
INFO [89bd1320] Running ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as deploy#<server-ip>
INFO [89bd1320] Finished in 15.517 seconds with exit status 0 (successful).
INFO [8e1765be] Running /usr/bin/env mkdir -p /var/www/mrd_production/releases/20150730220743/assets_manifest_backup as deploy#<server-ip>
INFO [8e1765be] Finished in 0.266 seconds with exit status 0 (successful).
INFO [30408583] Running /usr/bin/env cp /var/www/mrd_production/releases/20150730220743/public/assets/manifest.yml /var/www/mrd_production/releases/20150730220743/assets_manifest_backup as deploy#<server-ip>
INFO [30408583] Finished in 0.270 seconds with exit status 0 (successful).
INFO Uploading /home/drobazko/www/mxad-mr.-delivery/config/database.yml.production 100.0%
INFO [deploy:migrate] Run `rake db:migrate`
INFO [e0eabe3f] Running ~/.rbenv/bin/rbenv exec bundle exec rake db:migrate as deploy#<server-ip>
INFO [e0eabe3f] Finished in 14.161 seconds with exit status 0 (successful).
INFO [36cbdf44] Running /usr/bin/env ln -s /var/www/mrd_production/releases/20150730220743 /var/www/mrd_production/releases/current as deploy#<server-ip>
INFO [36cbdf44] Finished in 0.270 seconds with exit status 0 (successful).
INFO [f261e897] Running /usr/bin/env mv /var/www/mrd_production/releases/current /var/www/mrd_production as deploy#<server-ip>
INFO [f261e897] Finished in 0.266 seconds with exit status 0 (successful).
INFO [47336a26] Running /usr/bin/env touch /var/www/mrd_production/releases/20150730220743/tmp/restart.txt as deploy#<server-ip>
INFO [47336a26] Finished in 0.267 seconds with exit status 0 (successful).
INFO Keeping 3 of 4 deployed releases on <server-ip>
INFO [81cb4cbd] Running /usr/bin/env rm -rf /var/www/mrd_production/releases/20150730162232 as deploy#<server-ip>
INFO [81cb4cbd] Finished in 0.384 seconds with exit status 0 (successful).
INFO [673ac3d6] Running /usr/bin/env echo "Branch master (at 6ce11b0) deployed as release 20150730220743 by drobazko" >> /var/www/mrd_production/revisions.log as deploy#<server-ip>
If I'm not mistaken, when Capistrano makes the current folder it is actually a "shortcut" (for lack of a better term) to the most recent release (perhaps symlinked directory is better).
I don't know of a link to their doc that describes what I'm talking about, but I'm fairly certain that you should be fine with whatever you'd like to run.
EDIT:
this page describes the structure of the capistrano directory hierarchy. If you look specifically at the section on current it reads:
current is a symlink pointing to the latest release. This symlink is updated at the end of a successful deployment. If the deployment fails in any step the current symlink still points to the old release.
releases holds all deployments in a timestamped folder. These folders are the target of the current symlink.
Looks like you're still in the "old" current symlink after you deployed. cd out of current then back in, then jump back into the Rails console and you should be in the new correct release path.
This line is showing that the symlinking of current to the latest release directory happened correctly
INFO [36cbdf44] Running /usr/bin/env ln -s /var/www/mrd_production/releases/20150730220743 /var/www/mrd_production/releases/current as deploy#<server-ip>
You can't stay in current while the deploy happens else the symlink is change out from under you and the shell doesn't know.
Other things of note:
To open a shell like you are in deploy.rb, just use https://github.com/marshall-lee/capistrano-shell.
Additionally don't create shell commands from string concatenation, use the DSL, for example.
task :do_something do
on roles(:web) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, 'simple:task'
end
end
end
end
Related
I have a gitlab-runner that I would like to use to deploy my Ruby on Rails application to a server. I am using the cap deploy function from the Capistrano Gem to deploy to my remote server. When I run the cap deploy function locally it works and finishes correctly however when I run it in my gitlab-runner it just sits and spins once it gets to a certain point, and eventually times out my gitlab-runner when running the Publish stage.
I would like to get this to work correctly so, if anyone has any ideas or could offer guidance I would greatly appreciate it.
.gitlab-ci.yml
before_script:
- ruby -v
- whoami
- which ruby
- bundle install --quiet
- RAILS_ENV=test bundle exec rake db:migrate --quiet
stages:
- citest
- security
- lint
- publish
- sendnotice
Citest:
stage: citest
script:
- rails t
Security:
stage: security
script:
- bundle exec brakeman -z -q
Lint:
stage: lint
script:
- bundle exec rubocop -a
- bundle exec rubocop -P
Publish:
stage: publish
script:
- eval `ssh-agent -s`
- ssh-add
- cap production deploy
SendNotice:
stage: sendnotice
script:
- ruby deploy_notice.rb
gitlab-runner - config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "cilinux"
url = "http://example.com/"
token = "ssssssssssssssssssss"
executor = "shell"
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
Here is my gitlab-runner console output it just sits and spins at the last line
Running with gitlab-runner 11.7.0 (8bb608ff)
on cilinux zzBcVZd6
Using Shell executor...
Running on proserver...
Cloning repository...
Cloning into '/home/ci/builds/zzBcVZd6/0/Library/csi'...
Checking out 78654903 as master...
Skipping Git submodules setup
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
$ whoami
ci
$ which ruby
/home/ci/.rvm/rubies/ruby-2.5.1/bin/ruby
$ bundle install --quiet
$ RAILS_ENV=test bundle exec rake db:migrate --quiet
$ eval `ssh-agent -s`
Agent pid 9096
$ ssh-add
Identity added: /home/ci/.ssh/id_rsa (/home/ci/.ssh/id_rsa)
$ cap production deploy
Skipping task `puma:restart'.
Capistrano tasks may only be invoked once. Since task `puma:restart' was previously invoked, invoke("puma:restart") at /home/ci/.rvm/gems/ruby-2.5.1/gems/capistrano3-puma-3.1.1/lib/capistrano/tasks/puma.rake:96 will be skipped.
If you really meant to run this task again, use invoke!("puma:restart")
THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF CAPISTRANO. Please join the conversation here if this affects you.
https://github.com/capistrano/capistrano/issues/1686
INFO [62149be6] Running /usr/bin/env mkdir -p /tmp on 192.168.4.68
INFO [17c17043] Finished in 0.039 seconds with exit status 0 (successful).
INFO Uploading /tmp/git-ssh-CSI-production-ci.sh 100.0%
INFO [2ea27bf0] Running /usr/bin/env chmod 700 /tmp/git-ssh-CSI-production-ci.sh on 192.168.4.68
INFO [ec4b6bc5] Finished in 0.044 seconds with exit status 0 (successful).
INFO [d0d40773] Running /usr/bin/env git ls-remote git#example.com:Library/csi.git HEAD on 192.168.4.68
INFO [1c63f5ce] Finished in 5.555 seconds with exit status 0 (successful).
INFO [0c2cdf20] Running /usr/bin/env mkdir -p /home/deploy/apps/CSI/shared /home/deploy/apps/CSI/releases on 192.168.4.68
INFO [ec964bdd] Finished in 0.010 seconds with exit status 0 (successful).
INFO [0ae11325] Running /usr/bin/env mkdir -p /home/deploy/apps/CSI/shared/public/assets on 192.168.4.68
INFO [d9121d4f] Finished in 0.047 seconds with exit status 0 (successful).
INFO [8806e1ba] Running /usr/bin/env mkdir -p /home/deploy/apps/CSI/shared/config on 192.168.4.68
INFO [f3e1f3c4] Finished in 0.046 seconds with exit status 0 (successful).
INFO The repository mirror is at /home/deploy/apps/CSI/repo
INFO [40d9a02e] Running /usr/bin/env git remote set-url origin git#examplecom:mydomain/csi.git on 192.168.4.68
INFO [8a0a2d6d] Finished in 0.047 seconds with exit status 0 (successful).
INFO [4b634e41] Running /usr/bin/env git remote update --prune on 192.168.4.68
INFO [0efa9ecf] Finished in 5.588 seconds with exit status 0 (successful).
INFO [7cf384f1] Running /usr/bin/env mkdir -p /home/deploy/apps/CSI/releases/20190219192659 on 192.168.4.68
INFO [089f6fd2] Finished in 0.045 seconds with exit status 0 (successful).
INFO [79e639ea] Running /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /home/deploy/apps/CSI/releases/20190219192659 on 192.168.4.68
INFO [2e47c81b] Finished in 0.060 seconds with exit status 0 (successful).
INFO [132ffc7e] Running /usr/bin/env echo "78654903778db4079706dc5c990292c11fc3bfd6" > REVISION on 192.168.4.68
INFO [e9a299c4] Finished in 0.045 seconds with exit status 0 (successful).
INFO [61aebbb2] Running /usr/bin/env mkdir -p /home/deploy/apps/CSI/releases/20190219192659/config on 192.168.4.68
INFO [c32f803c] Finished in 0.047 seconds with exit status 0 (successful).
INFO [5de3f8d7] Running /usr/bin/env ln -s /home/deploy/apps/CSI/shared/config/master.key /home/deploy/apps/CSI/releases/20190219192659/config/master.key on 192.168.4.68
INFO [fd68c3e6] Finished in 0.044 seconds with exit status 0 (successful).
INFO [ae83c25d] Running /usr/bin/env mkdir -p /home/deploy/apps/CSI/releases/20190219192659/public on 192.168.4.68
INFO [219cde3c] Finished in 0.043 seconds with exit status 0 (successful).
INFO [8daea977] Running /usr/bin/env ln -s /home/deploy/apps/CSI/shared/public/assets /home/deploy/apps/CSI/releases/20190219192659/public/assets on 192.168.4.68
INFO [776bd6d9] Finished in 0.045 seconds with exit status 0 (successful).
INFO [9b6d224d] Running ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/CSI/shared/bundle --jobs 4 --without development test --deployment --quiet on 192.168.4.68
INFO [a7a6eab9] Finished in 12.598 seconds with exit status 0 (successful).
INFO [aa1ce450] Running ~/.rvm/bin/rvm default do bundle exec rake assets:precompile on 192.168.4.68
INFO [361e893b] Finished in 26.688 seconds with exit status 0 (successful).
INFO [df357b56] Running /usr/bin/env mkdir -p /home/deploy/apps/CSI/releases/20190219192659/assets_manifest_backup on 192.168.4.68
INFO [4b7c3340] Finished in 0.048 seconds with exit status 0 (successful).
INFO [a7d45495] Running /usr/bin/env cp /home/deploy/apps/CSI/releases/20190219192659/public/assets/.sprockets-manifest-6c09bafc512e6d668d8d88812378e77c.json /home/deploy/apps/CSI/releases/20190219192659/assets_manifest_backup on 192.168.4.68
INFO [b6ebf727] Finished in 0.047 seconds with exit status 0 (successful).
INFO [deploy:migrate] Run `rake db:migrate`
INFO [5e0d430c] Running ~/.rvm/bin/rvm default do bundle exec rake db:migrate on 192.168.4.68
INFO [64374921] Finished in 7.839 seconds with exit status 0 (successful).
INFO [3e852c97] Running /usr/bin/env ln -s /home/deploy/apps/CSI/releases/20190219192659 /home/deploy/apps/CSI/releases/current on 192.168.4.68
INFO [10e08783] Finished in 0.048 seconds with exit status 0 (successful).
INFO [36c88135] Running /usr/bin/env mv /home/deploy/apps/CSI/releases/current /home/deploy/apps/CSI on 192.168.4.68
INFO [0408953b] Finished in 0.046 seconds with exit status 0 (successful).
INFO Keeping 3 of 4 deployed releases on 192.168.4.68
INFO [44ecd2da] Running /usr/bin/env rm -rf /home/deploy/apps/CSI/releases/20190219173006 on 192.168.4.68
INFO [baa3970a] Finished in 0.149 seconds with exit status 0 (successful).
INFO [b90baafa] Running ~/.rvm/bin/rvm default do bundle exec pumactl -S /home/deploy/apps/CSI/shared/tmp/pids/puma.state -F /home/deploy/apps/CSI/shared/puma.rb restart on 192.168.4.68
INFO [bcbdb282] Finished in 1.102 seconds with exit status 0 (successful).
INFO [da13ee51] Running /usr/bin/env echo "Branch master (at 78654903778db4079706dc5c990292c11fc3bfd6) deployed as release 20190219192659 by ci" >> /home/deploy/apps/CSI/revisions.log on 192.168.4.68
INFO [6a780fb0] Finished in 0.046 seconds with exit status 0 (successful).
//SITS AND SPINS HERE
cap deploy.rb
# frozen_string_literal: true
server '192.168.4.68', roles: %i[web app db], primary: true
set :repo_url, 'git#codelib.pennunited.com:PennUnited_Code_Library/csi.git'
set :application, 'CSI'
set :user, 'deploy'
set :puma_threads, [4, 16]
set :puma_workers, 4
set :pty, true
set :use_sudo, false
set :stage, :production
set :deploy_via, :remote_cache
set :deploy_to, "/home/#{fetch(:user)}/apps/#{fetch(:application)}"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log, "#{release_path}/log/puma.access.log"
set :ssh_options, forward_agent: true, user: fetch(:user), keys: %w[~/.ssh/id_rsa.pub], keepalive: true
set :puma_preload_app, true
set :puma_worker_timeout, nil
set :puma_init_active_record, true # Change to true if using ActiveRecord
## Defaults:
set :branch, :master
set :format, :pretty
set :log_level, :info
set :keep_releases, 3
## Linked Files & Directories (Default None):
set :linked_files, %w[config/master.key]
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
namespace :puma do
desc 'Create Directories for Puma Pids and Socket'
task :make_dirs do
on roles(:app) do
execute "mkdir #{shared_path}/tmp/sockets -p"
execute "mkdir #{shared_path}/tmp/pids -p"
end
end
namespace :deploy do
desc "Make sure local git is in sync with remote."
task :check_revision do
on roles(:app) do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
end
desc 'Initial Deploy'
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke 'puma:restart'
end
end
before :starting, :check_revision
after :finishing, :compile_assets
after :finishing, :cleanup
after :finishing, :restart
end
before :start, :make_dirs
end
I was helped by removal of the keys added to ssh-agent (ssh-agent - k) after cap production deploy, job ceased to hang
My deploy goes good until the sidekiq:start:
00:18 sidekiq:start
01 sidekiq --index 0 --pidfile /home/user/cap/shared/tmp/pids/sidekiq-0.pid --environment production --logfile /home/user/cap/shared/log/sidekiq.log --concurrency 4 --daemon
01 /usr/bin/env: sidekiq: No such file or directory
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as user#app.domain.com: sidekiq exit status: 127
sidekiq stdout: Nothing written
sidekiq stderr: /usr/bin/env: sidekiq: No such file or directory
SSHKit::Command::Failed: sidekiq exit status: 127
sidekiq stdout: Nothing written
sidekiq stderr: /usr/bin/env: sidekiq: No such file or directory
Tasks: TOP => sidekiq:start
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as user#app.domain.com: sidekiq exit status: 127
sidekiq stdout: Nothing written
sidekiq stderr: /usr/bin/env: sidekiq: No such file or directory
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
DEBUG [c0e43b64] Command: if test ! -d /home/user/cap/releases/20160629062112; then echo "Directory does not exist '/home/user/cap/releases/20160629062112'" 1>&2; false; fi
DEBUG [c0e43b64] Finished in 0.079 seconds with exit status 0 (successful).
DEBUG [2c3323b9] Running /usr/bin/env [ -f /home/user/cap/shared/tmp/pids/sidekiq-0.pid ] as user#app.domain.com
DEBUG [2c3323b9] Command: cd /home/user/cap/releases/20160629062112 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.0" ; /usr/bin/env [ -f /home/user/cap/shared/tmp/pids/sidekiq-0.pid ] )
DEBUG [2c3323b9] Finished in 0.083 seconds with exit status 1 (failed).
INFO [6813e38f] Running /usr/bin/env ln -s /home/user/cap/releases/20160629062112 /home/user/cap/releases/current as user#app.domain.com
DEBUG [6813e38f] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.0" ; /usr/bin/env ln -s /home/user/cap/releases/20160629062112 /home/user/cap/releases/current )
INFO [6813e38f] Finished in 0.080 seconds with exit status 0 (successful).
INFO [6d1d7708] Running /usr/bin/env mv /home/user/cap/releases/current /home/user/cap as user#app.domain.com
DEBUG [6d1d7708] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.0" ; /usr/bin/env mv /home/user/cap/releases/current /home/user/cap )
INFO [6d1d7708] Finished in 0.080 seconds with exit status 0 (successful).
DEBUG [0dbc1637] Running if test ! -d /home/user/cap/releases/20160629062112; then echo "Directory does not exist '/home/user/cap/releases/20160629062112'" 1>&2; false; fi as user#portal.nordcloud…
DEBUG [0dbc1637] Command: if test ! -d /home/user/cap/releases/20160629062112; then echo "Directory does not exist '/home/user/cap/releases/20160629062112'" 1>&2; false; fi
DEBUG [0dbc1637] Finished in 0.079 seconds with exit status 0 (successful).
DEBUG [6b62769e] Running /usr/bin/env [ -f /home/user/cap/shared/tmp/pids/sidekiq-0.pid ] as user#app.domain.com
DEBUG [6b62769e] Command: cd /home/user/cap/releases/20160629062112 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.0" ; /usr/bin/env [ -f /home/user/cap/shared/tmp/pids/sidekiq-0.pid ] )
DEBUG [6b62769e] Finished in 0.081 seconds with exit status 1 (failed).
INFO [eaed2dfc] Running /usr/bin/env sidekiq --index 0 --pidfile /home/user/cap/shared/tmp/pids/sidekiq-0.pid --environment production --logfile /home/user/cap/shared/log/sidekiq.log --concurrency …
DEBUG [eaed2dfc] Command: cd /home/user/cap/releases/20160629062112 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.0" ; /usr/bin/env sidekiq --index 0 --pidfile /home/user/cap/shared/tmp/p…
DEBUG [eaed2dfc] /usr/bin/env: sidekiq: No such file or directory
Does anyone have hints what's going on, what is it looking for in /usr/bin/env and mail question: how do I solve it?
Looks like you use rbenv. Do you also have the Capistrano support gem included?
https://github.com/capistrano/rbenv
Also, take a look into this bug report - might be helpful!
Hello I have problem with deploy my app.
I can't deploy my application because I have problem with git release
DEBUG[53fd915c] Finished in 2.573 seconds with exit status 0 (successful).
INFO[545c6125] Running /usr/bin/env mkdir -pv ~/deploy/shared ~/deploy/releases on
DEBUG[545c6125] Command: ( RVM_BIN_PATH=~/.rvm/bin /usr/bin/env mkdir -pv ~/deploy/shared ~/deploy/releases )
INFO[545c6125] Finished in 0.042 seconds with exit status 0 (successful).
INFO[021eadb4] Running /usr/bin/env mkdir -pv ~/deploy/shared/bin ~/deploy/shared/log ~/deploy/shared/tmp/pids ~/deploy/shared/tmp/cache ~/deploy/shared/tmp/sockets ~/deploy/shared/vendor/bundle ~/deploy/shared/public/system on DEBUG[021eadb4] Command: ( RVM_BIN_PATH=~/.rvm/bin /usr/bin/env mkdir -pv ~/deploy/shared/bin ~/deploy/shared/log ~/deploy/shared/tmp/pids ~/deploy/shared/tmp/cache ~/deploy/shared/tmp/sockets ~/deploy/shared/vendor/bundle ~/deploy/shared/public/system )
INFO[021eadb4] Finished in 0.040 seconds with exit status 0 (successful).
INFO[c4cc4af5] Running /usr/bin/env mkdir -pv ~/deploy/shared/config on DEBUG[c4cc4af5] Command: ( RVM_BIN_PATH=~/.rvm/bin /usr/bin/env mkdir -pv ~/deploy/shared/config )
INFO[c4cc4af5] Finished in 0.038 seconds with exit status 0 (successful).
DEBUG[c231d0c7] Running /usr/bin/env [ -f ~/deploy/shared/config/database.yml ] on DEBUG[c231d0c7] Command: [ -f ~/deploy/shared/config/database.yml ]
DEBUG[c231d0c7] Finished in 0.032 seconds with exit status 0 (successful).
DEBUG[b42c9ef2] Running /usr/bin/env [ -f ~/deploy/current/REVISION ] on DEBUG[b42c9ef2] Command: [ -f ~/deploy/current/REVISION ]
DEBUG[b42c9ef2] Finished in 0.031 seconds with exit status 1 (failed).
DEBUG[9f6e7e95] Running /usr/bin/env [ -f ~/deploy/repo/HEAD ] on
DEBUG[9f6e7e95] Command: [ -f ~/deploy/repo/HEAD ]
DEBUG[9f6e7e95] Finished in 0.031 seconds with exit status 0 (successful).
INFOThe repository mirror is at ~/deploy/repo
DEBUG[2c4a5ab1] Running /usr/bin/env if test ! -d ~/deploy/repo; then echo "Directory does not exist '~/deploy/repo'" 1>&2; false; fi on
DEBUG[2c4a5ab1] Command: if test ! -d ~/deploy/repo; then echo "Directory does not exist '~/deploy/repo'" 1>&2; false; fi
DEBUG[2c4a5ab1] Finished in 0.029 seconds with exit status 0 (successful).
INFO[ba7cef28] Running /usr/bin/env git remote update on
DEBUG[ba7cef28] Command: cd ~/deploy/repo && ( RVM_BIN_PATH=~/.rvm/bin GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/aligator/git-ssh.sh /usr/bin/env git remote update )
INFO[ba7cef28] Finished in 0.038 seconds with exit status 0 (successful).
DEBUG[f0098e08] Running /usr/bin/env if test ! -d ~/deploy/repo; then echo "Directory does not exist '~/deploy/repo'" 1>&2; false; fi on
DEBUG[f0098e08] Command: if test ! -d ~/deploy/repo; then echo "Directory does not exist '~/deploy/repo'" 1>&2; false; fi
DEBUG[f0098e08] Finished in 0.031 seconds with exit status 0 (successful).
INFO[4b4fe200] Running /usr/bin/env mkdir -p ~/deploy/releases/20140805094710 on
DEBUG[4b4fe200] Command: cd ~/deploy/repo && ( RVM_BIN_PATH=~/.rvm/bin GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/aligator/git-ssh.sh /usr/bin/env mkdir -p ~/deploy/releases/20140805094710 )
INFO[4b4fe200] Finished in 0.038 seconds with exit status 0 (successful).
INFO[1bd3716b] Running /usr/bin/env git archive master | tar -x -C ~/deploy/releases/20140805094710 on
DEBUG[1bd3716b] Command: cd ~/deploy/repo && ( RVM_BIN_PATH=~/.rvm/bin GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/aligator/git-ssh.sh /usr/bin/env git archive master | tar -x -C ~/deploy/releases/20140805094710 )
DEBUG[1bd3716b] fatal: Not a valid object name
DEBUG[1bd3716b] tar: This does not look like a tar archive
DEBUG[1bd3716b] tar: Exiting with failure status due to previous errors
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host : git exit status: 2
git stdout: Nothing written
git stderr: Nothing written
Anyone have idea why it happen?
Maybe it's a problem with rvm or something, I spent with this a lot of time but no success
I also got the same issue like you (but my case is deploy to specific branch), and some one suggest here Capistrano error tar: This does not look like a tar archive. But he gave 2 options that should not suitable to my situation, I don't want to delete my current repo.
So after 1 hour to workaround, I have a solution:
Ex:
before: (deploy/production.rb)
set :branch, ENV["BRANCH_NAME"] || "master"
(I stay at master branch then run command)
BRANCH_NAME=another_branch_name cap production deploy
then I get an error like above
after: (deploy/production.rb)
set :branch, `git rev-parse --abbrev-ref HEAD`.chomp
(I stay at another_branch_name then run command)
cap production deploy
the error was fixed.
I'm using Capistrano 3.2.1 with Rails 4.0 in my application. I'm trying to install gem from my github repo. But it's not working. I have no idea what's going on. When I run ssh -T git#github.com on my server it gets succeed. But when I run cap production deploy I get following errors:
DEBUG [d89fd157] 000a0d807aabdb327d80bbe21d5212e62142f9ca refs/tags/staging-2014-05-22-15-58-38-0400^{}
DEBUG [d89fd157] 1cbcc8350316c7511035f1ef85f1f8d177197a24 refs/tags/staging-2014-05-22-16-55-02-0400
DEBUG [d89fd157] 5e905411ca362abe83fdbfbb4aa81222945dcecc refs/tags/staging-2014-05-22-16-55-02-0400^{}
DEBUG [d89fd157] fa200661a9791aefa41318a54c3fee477a246ece refs/tags/staging-2014-05-22-20-01-16-0400
DEBUG [d89fd157] 665fd3d871e75f6b092c11572c23e126d139d9d9 refs/tags/staging-2014-05-22-20-01-16-0400^{}
DEBUG [d89fd157] 84b23c1e93c47d91d4a442866d83a9e275428369 refs/tags/staging-2014-05-23-11-27-24-0400
DEBUG [d89fd157] 10a2c4dab3e76eb05ba07b18392f92bcc7e30ccf refs/tags/staging-2014-05-23-11-27-24-0400^{}
DEBUG [d89fd157] b7ca8b7bcad98e4160deb06df6688153e372f658 refs/tags/staging-2014-05-28-22-48-47-0530
DEBUG [d89fd157] f69bf3a92ad5ef65cb9425428be0446c2459143a refs/tags/staging-2014-05-28-22-48-47-0530^{}
DEBUG [d89fd157] 62a2a29e5c88e3603666826421cb1ea28f78423c refs/tags/staging-2014-05-29-00-46-10-0530
DEBUG [d89fd157] f69bf3a92ad5ef65cb9425428be0446c2459143a refs/tags/staging-2014-05-29-00-46-10-0530^{}
DEBUG [d89fd157] 960e24c40e0ab7207f92812f34015ae41a307e7e refs/tags/staging-2014-05-29-00-51-04-0530
DEBUG [d89fd157] f69bf3a92ad5ef65cb9425428be0446c2459143a refs/tags/staging-2014-05-29-00-51-04-0530^{}
DEBUG [d89fd157] Finished in 2.876 seconds with exit status 0 (successful).
INFO [dc211684] Running /usr/bin/env mkdir -pv /data/apps/myautobrain/shared /data/apps/myautobrain/releases on 107.170.168.224
DEBUG [dc211684] Command: ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 /usr/bin/env mkdir -pv /data/apps/myautobrain/shared /data/apps/myautobrain/releases )
INFO [dc211684] Finished in 1.669 seconds with exit status 0 (successful).
INFO [3b633fa7] Running /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/log /data/apps/myautobrain/shared/tmp /data/apps/myautobrain/shared/vendor/bundle /data/apps/myautobrain/shared/db/backups /data/apps/myautobrain/shared/config/settings on 107.170.168.224
DEBUG [3b633fa7] Command: ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/log /data/apps/myautobrain/shared/tmp /data/apps/myautobrain/shared/vendor/bundle /data/apps/myautobrain/shared/db/backups /data/apps/myautobrain/shared/config/settings )
INFO [3b633fa7] Finished in 1.646 seconds with exit status 0 (successful).
INFO [1581b4a0] Running /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/config on 107.170.168.224
DEBUG [1581b4a0] Command: ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 /usr/bin/env mkdir -pv /data/apps/myautobrain/shared/config )
INFO [1581b4a0] Finished in 1.691 seconds with exit status 0 (successful).
DEBUG [48a6c211] Running /usr/bin/env [ -f /data/apps/myautobrain/shared/config/database.yml ] on 107.170.168.224
DEBUG [48a6c211] Command: [ -f /data/apps/myautobrain/shared/config/database.yml ]
DEBUG [48a6c211] Finished in 1.676 seconds with exit status 0 (successful).
DEBUG [0a11405e] Running /usr/bin/env [ -f /data/apps/myautobrain/shared/config/database.yml ] on 107.170.168.224
DEBUG [0a11405e] Command: [ -f /data/apps/myautobrain/shared/config/database.yml ]
DEBUG [0a11405e] Finished in 1.575 seconds with exit status 0 (successful).
DEBUG [2c1a88cc] Running /usr/bin/env [ $(which nodejs || which node ) ] on 107.170.168.224
DEBUG [2c1a88cc] Command: [ $(which nodejs || which node ) ]
DEBUG [2c1a88cc] Finished in 1.560 seconds with exit status 0 (successful).
INFO Javascript runtime nodejs is available on 107.170.168.224
DEBUG [5c2090dd] Running /usr/bin/env [ $(which identify) ] on 107.170.168.224
DEBUG [5c2090dd] Command: [ $(which identify) ]
DEBUG [5c2090dd] Finished in 1.643 seconds with exit status 0 (successful).
INFO Javascript runtime nodejs is available on 107.170.168.224
DEBUG [51feab0b] Running /usr/bin/env [ -f /data/apps/myautobrain/repo/HEAD ] on 107.170.168.224
DEBUG [51feab0b] Command: [ -f /data/apps/myautobrain/repo/HEAD ]
DEBUG [51feab0b] Finished in 1.620 seconds with exit status 0 (successful).
INFO The repository mirror is at /data/apps/myautobrain/repo
DEBUG [60a484d1] Running /usr/bin/env if test ! -d /data/apps/myautobrain/repo; then echo "Directory does not exist '/data/apps/myautobrain/repo'" 1>&2; false; fi on 107.170.168.224
DEBUG [60a484d1] Command: if test ! -d /data/apps/myautobrain/repo; then echo "Directory does not exist '/data/apps/myautobrain/repo'" 1>&2; false; fi
DEBUG [60a484d1] Finished in 1.592 seconds with exit status 0 (successful).
DEBUG [be3246e2] Running /usr/bin/env cd /data/apps/myautobrain/repo && git rev-parse --short HEAD on 107.170.168.224
DEBUG [be3246e2] Command: cd /data/apps/myautobrain/repo && git rev-parse --short HEAD
DEBUG [be3246e2] 3dbe0cd
DEBUG [be3246e2]
DEBUG [be3246e2] Finished in 0.194 seconds with exit status 0 (successful).
INFO [375571f4] Running /usr/bin/env git remote update on 107.170.168.224
DEBUG [375571f4] Command: cd /data/apps/myautobrain/repo && ( RAILS_ENV=staging RBENV_ROOT=/data/rbenv RBENV_VERSION=2.1.1 GIT_ASKPASS=/bin/echo GIT_SSH=/data/tmp/myautobrain/git-ssh.sh /usr/bin/env git remote update )
DEBUG [375571f4] Fetching origin
DEBUG [375571f4]
DEBUG [375571f4] ERROR: Repository not found.
DEBUG [375571f4]
DEBUG [375571f4] fatal: The remote end hung up unexpectedly
DEBUG [375571f4]
DEBUG [375571f4] error: Could not fetch origin
DEBUG [375571f4]
cap aborted!
git exit status: 1
git stdout: Nothing written
git stderr: Nothing written
Tasks: TOP => git:create_release => git:update
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: git exit status: 1
git stdout: Nothing written
git stderr: Nothing written
>
Here's deploy.rb:
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.1.1'
#TODO: Check the application name
set :application, 'myautobrain'
#TODO: Replace with valid github url
set :repo_url, 'git#github.com:swjg-ventures/myautobrain.git'
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :deploy_to, "/data/apps/#{fetch(:application)}"
set :scm, :git
set :format, :pretty
set :log_level, :debug
set :pty, true
set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{log tmp vendor/bundle db/backups config/settings}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
set :keep_releases, 5
set :bundle_without, %w{development test utils}.join(' ')
set :git_tag_name, proc { Time.now.to_s.gsub(/[-\s\:\+]+/, '-') }
before 'deploy:migrate', 'db:backup'
after 'deploy:finishing', 'deploy:restart'
after 'deploy:finishing', 'deploy:cleanup'
From server:
deployer#myautobrain-staging:~$ ls -l ~/.ssh
total 20
-rw------- 1 deployer deployer 4815 May 28 17:57 authorized_keys
-rw------- 1 deployer deployer 1675 May 28 17:29 id_rsa
-rw-r--r-- 1 deployer deployer 404 May 28 17:29 id_rsa.pub
-rw-r--r-- 1 deployer deployer 2210 May 28 13:17 known_hosts
The most frustrating part of this process is that this process works on my coworkers computer.
Any idea? If you need more info, let me know.
I had this error when trying to deploy my app, all I needed to do was:
remove ${deploy_dir}/repo and successfully deployed.
In my case I had changed from https://github.com to https://bitbucket.org
and all the configurations from github was still in the ${deploy_dir}/repo.
You have to make sure the remote server has access to the private keys to access the repository. Log in to the server and verify the private keys are accessible:
ls -l ~/.ssh
Make sure they have to correct permissions too (600), including the directory.
Also try:
set :repository, "git#github.com:name/project.git"
instead of :repo_url. (I think this is for version 2. Version 3 does seem to use :repo_url.)
I am using the latest version of Capistrano w/ my Rails 4 application. When running cap dpeloy. I get a lot of output including this failure:
DEBUG [04b6e226] Running /usr/bin/env [ -f /var/www/skateboxes/releases/20131022135522/config/database.yml ] on 162.243.33.179
DEBUG [04b6e226] Command: [ -f /var/www/skateboxes/releases/20131022135522/config/database.yml ]
DEBUG [04b6e226] Finished in 0.280 seconds with exit status 1 (failed).
How do I figure out what is going on here?
Update #1
I should say that I have gitignored config/database.yml (as was suggested by the capistrano docs). I then added the following to my config/deploy.rb
set :linked_files, %w{config/database.yml}
I then created a file on my VPS at /var/www/skateboxes/shared/config/database.yml.
Am I not understanding how linked_files works?
Update #2
It turns out that the file is actually being linked from shared/conf/database.yml to current/config/database.yml so now I'm confused as to why it's saying failed
Update #3
Here is the entire output of my deploy
DEBUG Uploading /tmp/git-ssh.sh 0.0%
INFO Uploading /tmp/git-ssh.sh 100.0%
INFO [37fffef8] Running /usr/bin/env chmod +x /tmp/git-ssh.sh on 162.243.33.179
DEBUG [37fffef8] Command: ( RAILS_ENV=production /usr/bin/env chmod +x /tmp/git-ssh.sh )
INFO [37fffef8] Finished in 0.282 seconds with exit status 0 (successful).
DEBUG [d8542e52] Running /usr/bin/env git ls-remote git#github.com:kyledecot/skateboxes.git on 162.243.33.179
DEBUG [d8542e52] Command: ( RAILS_ENV=production GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/git-ssh.sh /usr/bin/env git ls-remote git#github.com:kyledecot/skateboxes.git )
DEBUG [d8542e52] Finished in 1.448 seconds with exit status 0 (successful).
DEBUG [d8542e52] e0f96188b9567a84048a0e1238f219abc6351607 HEAD
DEBUG [d8542e52] e0f96188b9567a84048a0e1238f219abc6351607 refs/heads/master
DEBUG [d8542e52] Finished in 1.448 seconds with exit status 0 (successful).
INFO [5a13328b] Running /usr/bin/env mkdir -pv /var/www/skateboxes/shared /var/www/skateboxes/releases on 162.243.33.179
DEBUG [5a13328b] Command: ( RAILS_ENV=production /usr/bin/env mkdir -pv /var/www/skateboxes/shared /var/www/skateboxes/releases )
INFO [5a13328b] Finished in 0.719 seconds with exit status 0 (successful).
INFO [293e065b] Running /usr/bin/env mkdir -pv /var/www/skateboxes/shared/config on 162.243.33.179
DEBUG [293e065b] Command: ( RAILS_ENV=production /usr/bin/env mkdir -pv /var/www/skateboxes/shared/config )
INFO [293e065b] Finished in 0.780 seconds with exit status 0 (successful).
DEBUG [4eb81576] Running /usr/bin/env [ -f /var/www/skateboxes/shared/config/database.yml ] on 162.243.33.179
DEBUG [4eb81576] Command: [ -f /var/www/skateboxes/shared/config/database.yml ]
DEBUG [4eb81576] Finished in 0.744 seconds with exit status 0 (successful).
DEBUG [89a9e1fa] Running /usr/bin/env [ -f /var/www/skateboxes/repo/HEAD ] on 162.243.33.179
DEBUG [89a9e1fa] Command: [ -f /var/www/skateboxes/repo/HEAD ]
DEBUG [89a9e1fa] Finished in 0.734 seconds with exit status 0 (successful).
INFO The repository mirror is at /var/www/skateboxes/repo
DEBUG [3cc4d694] Running /usr/bin/env if test ! -d /var/www/skateboxes/repo; then echo "Directory does not exist '/var/www/skateboxes/repo'" 1>&2; false; fi on 162.243.33.179
DEBUG [3cc4d694] Command: if test ! -d /var/www/skateboxes/repo; then echo "Directory does not exist '/var/www/skateboxes/repo'" 1>&2; false; fi
DEBUG [3cc4d694] Finished in 0.735 seconds with exit status 0 (successful).
INFO [1cb24a84] Running /usr/bin/env git remote update on 162.243.33.179
DEBUG [1cb24a84] Command: cd /var/www/skateboxes/repo && ( RAILS_ENV=production /usr/bin/env git remote update )
DEBUG [1cb24a84] Fetching origin
DEBUG [1cb24a84] remote: Counting objects: 5, done.
remote: Compressing objects: 100% (1/1), done.
DEBUG [1cb24a84] remote: Total 3 (delta 2), reused 3 (delta 2)
DEBUG [1cb24a84] Unpacking objects: 33% (1/3)
DEBUG [1cb24a84] Unpacking objects: 66% (2/3)
Unpacking objects: 100% (3/3), done.jects: 100% (3/3)
DEBUG [1cb24a84] From github.com:kyledecot/skateboxes
DEBUG [1cb24a84] de7f4a1..e0f9618 master -> master
INFO [1cb24a84] Finished in 0.817 seconds with exit status 0 (successful).
DEBUG [edd6c793] Running /usr/bin/env if test ! -d /var/www/skateboxes/repo; then echo "Directory does not exist '/var/www/skateboxes/repo'" 1>&2; false; fi on 162.243.33.179
DEBUG [edd6c793] Command: if test ! -d /var/www/skateboxes/repo; then echo "Directory does not exist '/var/www/skateboxes/repo'" 1>&2; false; fi
DEBUG [edd6c793] Finished in 0.732 seconds with exit status 0 (successful).
INFO [009b81fe] Running /usr/bin/env mkdir -p /var/www/skateboxes/releases/20131022145520 on 162.243.33.179
DEBUG [009b81fe] Command: cd /var/www/skateboxes/repo && ( RAILS_ENV=production GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/git-ssh.sh /usr/bin/env mkdir -p /var/www/skateboxes/releases/20131022145520 )
INFO [009b81fe] Finished in 0.317 seconds with exit status 0 (successful).
INFO [e9554374] Running /usr/bin/env git archive master | tar -x -C /var/www/skateboxes/releases/20131022145520 on 162.243.33.179
DEBUG [e9554374] Command: cd /var/www/skateboxes/repo && ( RAILS_ENV=production GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/git-ssh.sh /usr/bin/env git archive master | tar -x -C /var/www/skateboxes/releases/20131022145520 )
INFO [e9554374] Finished in 0.356 seconds with exit status 0 (successful).
INFO [165a7c40] Running /usr/bin/env mkdir -pv /var/www/skateboxes/releases/20131022145520/config on 162.243.33.179
DEBUG [165a7c40] Command: ( RAILS_ENV=production /usr/bin/env mkdir -pv /var/www/skateboxes/releases/20131022145520/config )
INFO [165a7c40] Finished in 1.174 seconds with exit status 0 (successful).
DEBUG [c2f7de66] Running /usr/bin/env [ -L /var/www/skateboxes/releases/20131022145520/config/database.yml ] on 162.243.33.179
DEBUG [c2f7de66] Command: [ -L /var/www/skateboxes/releases/20131022145520/config/database.yml ]
DEBUG [c2f7de66] Finished in 0.572 seconds with exit status 1 (failed).
DEBUG [09de2f2c] Running /usr/bin/env [ -f /var/www/skateboxes/releases/20131022145520/config/database.yml ] on 162.243.33.179
DEBUG [09de2f2c] Command: [ -f /var/www/skateboxes/releases/20131022145520/config/database.yml ]
DEBUG [09de2f2c] Finished in 0.304 seconds with exit status 1 (failed).
INFO [05570e6e] Running /usr/bin/env ln -s /var/www/skateboxes/shared/config/database.yml /var/www/skateboxes/releases/20131022145520/config/database.yml on 162.243.33.179
DEBUG [05570e6e] Command: ( RAILS_ENV=production /usr/bin/env ln -s /var/www/skateboxes/shared/config/database.yml /var/www/skateboxes/releases/20131022145520/config/database.yml )
INFO [05570e6e] Finished in 0.541 seconds with exit status 0 (successful).
INFO [8499b753] Running /usr/bin/env rm -rf /var/www/skateboxes/current on 162.243.33.179
DEBUG [8499b753] Command: ( RAILS_ENV=production /usr/bin/env rm -rf /var/www/skateboxes/current )
INFO [8499b753] Finished in 0.762 seconds with exit status 0 (successful).
INFO [bddc6793] Running /usr/bin/env ln -s /var/www/skateboxes/releases/20131022145520 /var/www/skateboxes/current on 162.243.33.179
DEBUG [bddc6793] Command: ( RAILS_ENV=production /usr/bin/env ln -s /var/www/skateboxes/releases/20131022145520 /var/www/skateboxes/current )
INFO [bddc6793] Finished in 0.289 seconds with exit status 0 (successful).
DEBUG [38a6b176] Running /usr/bin/env ls -x /var/www/skateboxes/releases on 162.243.33.179
DEBUG [38a6b176] Command: ( RAILS_ENV=production /usr/bin/env ls -x /var/www/skateboxes/releases )
DEBUG [38a6b176] Finished in 0.741 seconds with exit status 0 (successful).
DEBUG [38a6b176] 20131022133912 20131022133939 20131022134435 20131022135522 20131022145350
DEBUG [38a6b176] 20131022145520
DEBUG [38a6b176] Finished in 0.741 seconds with exit status 0 (successful).
INFO Keeping 5 of 6 deployed releases on 162.243.33.179
INFO [7da6047f] Running /usr/bin/env rm -rf /var/www/skateboxes/releases/20131022133912 on 162.243.33.179
DEBUG [7da6047f] Command: ( RAILS_ENV=production /usr/bin/env rm -rf /var/www/skateboxes/releases/20131022133912 )
INFO [7da6047f] Finished in 0.530 seconds with exit status 0 (successful).
DEBUG [7cdd5da9] Running /usr/bin/env if test ! -d /var/www/skateboxes/releases; then echo "Directory does not exist '/var/www/skateboxes/releases'" 1>&2; false; fi on 162.243.33.179
DEBUG [7cdd5da9] Command: if test ! -d /var/www/skateboxes/releases; then echo "Directory does not exist '/var/www/skateboxes/releases'" 1>&2; false; fi
DEBUG [7cdd5da9] Finished in 0.727 seconds with exit status 0 (successful).
INFO [906548e8] Running /usr/bin/env echo "Branch master deployed as release 20131022145520 by kyledecot; " >> /var/www/skateboxes/revisions.log on 162.243.33.179
DEBUG [906548e8] Command: echo "Branch master deployed as release 20131022145520 by kyledecot; " >> /var/www/skateboxes/revisions.log
INFO [906548e8] Finished in 0.279 seconds with exit status 0 (successful).
That's not a failure, see https://github.com/leehambley/sshkit/pull/33.
It says failed because that is not a file, thus the test command ([ aka man (1) test) has exited with status 1.
The command in question is coming out of this code, reproduced below:
desc 'Symlink linked files'
task :linked_files do
next unless any? :linked_files
on roles :app do
execute :mkdir, '-pv', linked_file_dirs(release_path)
fetch(:linked_files).each do |file|
target = release_path.join(file)
source = shared_path.join(file)
unless test "[ -L #{target} ]"
if test "[ -f #{target} ]"
execute :rm, target
end
execute :ln, '-s', source, target
end
end
end
end
desc 'Check files to be linked exist in shared'
task :linked_files do
next unless any? :linked_files
on roles :app do |host|
linked_files(shared_path).each do |file|
unless test "[ -f #{file} ]"
error t(:linked_file_does_not_exist, file: file, host: host)
exit 1
end
end
end
end
The task name says it all, really, if your file is listed in the :linked_files variable, it must exist in shared_path, otherwise it will cause Capistrano to abort when the file does not exist.
You haven't yet said whether or not this is causing your deploy to fail, and since you've posted so little of the log, indicating nothing but normal behaviour, nobody can guess.
You appear to be posting logs from the Symlink linked files task, which is supposed to fail on config/database.yml if it doesn't exist, it has failed to find it, so it does not have to be deleted.