Okay,
I'm running into some weird issue with our deployment no longer working anymore. I cannot track everything that changed, but I'm hoping someone can help me out with debugging this issue and find out what is going wrong.
deploy.rb
# config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'app_name'
set :repo_url, 'github_url'
set :deploy_to, '/home/user/path'
# Source Control Configuration
set :scm, :git
# Produces: Please enter the name of the branch. (develop):
set(:branch, ask('the name of the branch.', 'develop'))
# Ask whether we want to perform a backup.
# Produces: Please enter whether to perform a backup of the database? (Y):
set(:backup, ask('whether to perform a backup of the database?', 'Y'))
puts("setting branch to: #{fetch(:branch)}")
set :user, 'my_user'
set :assets_roles, [:web, :app, :vm]
set :keep_assets, 2
set :linked_files, fetch(:linked_files, []).push('.chamber.pem', 'Procfile', '.env')
set :linked_dirs, fetch(:linked_dirs, []).push('data', 'tmp', 'log', 'uploads')
set :keep_releases, 10
set :bundle_path, nil
set :bundle_binstubs, nil
set :bundle_flags, '--system'
set :rvm1_map_bins, fetch(:rvm1_map_bins, []).push('honeybadger')
# Slack integration options
set :slack_via_slackbot, Settings.slack.via_slackbot
set :slack_team, Settings.slack.team
set :slack_token, Settings.slack.token
set :slack_icon_emoji, -> { Settings.slack.icon_emoji }
set :slack_channel, -> { Settings.slack.channel }
set :slack_username, -> { Settings.slack.username }
set :slack_run_starting, -> { Settings.slack.run_starting }
set :slack_run_finished, -> { Settings.slack.run_finished }
set :slack_run_failed, -> { Settings.slack.run_failed }
set :slack_msg_finished, -> { "#channel #{ENV['USER'] || ENV['USERNAME']} has deployed branch *#{fetch :branch}* of #{fetch :application} to *#{fetch :rails_env}*." }
set :slack_msg_failed, -> { "#{ENV['USER'] || ENV['USERNAME']} failed to deploy branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}." }
# Rake config
SSHKit.config.command_map[:rake] = 'bundle exec rake'
before 'deploy:started', 'deploy:rm:stop'
after 'deploy:rm:stop', 'deploy:rm:backup'
after 'deploy:finished', 'deploy:rm:start'
after 'deploy:migrate', 'deploy:rm:seed
Capfile
# Load DSL and set up stages
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'rvm1/capistrano3' # Do not use capistrano/bundler
require 'whenever/capistrano'
require 'capistrano/honeybadger'
require 'slackistrano/capistrano'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
require 'net/ssh/proxy/command'
def vm(tunnel:, tunnel_user: fetch(:user), vm_user: fetch(:user))
server "#{fetch(:stage)}-vm01", {
roles: [:vm],
# The user on the VM
user: vm_user,
ssh_options: {
# The user on the machine we're tunneling through
proxy: Net::SSH::Proxy::Command.new("ssh #{tunnel_user}##{tunnel} -W %h:%p"),
}
}
end
So I can run the cap command locally, and it does part of the work. Had some issues first with the new sprockets, but now it's complaining about the following when it needs to precompile the assets:
INFO [21eca199] Running bundle exec rake assets:precompile as riskmethods#playground.riskmethods.net DEBUG [21eca199] Command: cd /home/riskmethods/riskmethods/releases/20160212152030 && ( export RAILS_ENV="playground" ; bundle exec rake assets:precompile )
DEBUG [2eac7a5b] Finished in 0.078 seconds with exit status 0 (successful).
INFO [4b29f0c4] Running bundle exec rake assets:precompile as riskmethods#playground-vm01
DEBUG [4b29f0c4] Command: cd /home/riskmethods/riskmethods/releases/20160212152030 && ( export RAILS_ENV="playground" ; bundle exec rake assets:precompile )
DEBUG [21eca199] bash: bundle: command not found
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as riskmethods#playground.riskmethods.net: rake exit status: 127
rake stdout: Nothing written
rake stderr: bash: bundle: command not found
SSHKit::Command::Failed:
rake exit status: 127
rake stdout: Nothing written
rake stderr: bash: bundle: command not found
Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error:
Exception while executing as riskmethods#playground.riskmethods.net:
rake exit status: 127
rake stdout: Nothing written
rake stderr: bash: bundle: command not found
DEBUG [4b29f0c4] bash: bundle: command not found
As your error message saying bash: bundle: command not found
It seems you dont have the gem bundler installed on the server
install bundler gem on server by running the following command that should do the trick
gem install bundler
Related
i find out for days for this error but really stuck and the error capistrano gave were not rellay clear what's wrong:
when the capistrano run this:
$HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as myapp#myIP
it only said:
Caused by:
SSHKit::Command::Failed: rake exit status: 1
SSHKit::Runner::ExecuteError: Exception while executing as myapp#myIP: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
does anything had this ?
i already put on Capfile
require 'capistrano/rails'
and deploy.rb:
set :conditionally_migrate, true
set :migration_servers, -> { primary(fetch(:migration_role)) }
set :rails_assets_groups, :assets
set :migration_role, :app
set :assets_prefix, 'prepackaged-assets'
set :normalize_asset_timestamps, %w{public/images public/javascripts public/stylesheets}
I think I have set up Capistrano3 correctly on my machine and that it should be connecting to my server. When I run cap production deploy (on my machine) I receive the following error messenger:
DEBUG [2959f403] Running /usr/bin/env [ -d ~/.rbenv/versions/2.1.2 ] as [user#myIP]
DEBUG [2959f403] Command: [ -d ~/.rbenv/versions/2.1.2 ]
DEBUG [2959f403] Finished in 0.420 seconds with exit status 1 (failed).
ERROR rbenv: 2.1.2 is not installed or not found in ~/.rbenv/versions/2.1.2
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [user#myIP]: exit
SystemExit: exit
Tasks: TOP => rbenv:validate
(See full trace by running task with --trace)
On my machine (iMac):
$ ruby -v
ruby 2.1.2p95
$ rbenv -v
rbenv 0.4.0
$ which rebind
/usr/local/bin/rbenv
On my server (ubuntu)
$ ruby -v
ruby 2.1.2p95
$ rbenv -v
rbenv 0.4.0-151-g83ac0fb
$ which rebind
/home/[user]/.rbenv/bin/rbenv
Any ideas how to fix this?
** More Info From Comments **
deploy.rb
# config valid only for current version of Capistrano
lock '3.4.0'
set :application, [app name]
set :repo_url, [repo location]
set :repository, [repo location]
set :scm, :git
set :deploy_user, [user]
set :user, [user]
set :use_sudo, false
set :rails_env, "production"
set :deploy_via, :copy
# setup rvm.
# how many old releases do we want to keep
set :keep_releases, 5
# files we want symlinking to specific entries in shared.
set :linked_files, %w{config/database.yml config/application.yml}
# dirs we want symlinking to shared
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# what specs should be run before deployment is allowed to
# continue, see lib/capistrano/tasks/run_tests.cap
set :tests, []
# which config files should be copied by deploy:setup_config
# see documentation in lib/capistrano/tasks/setup_config.cap
# for details of operations
set(:config_files, %w(
nginx.conf
database.example.yml
log_rotation
monit
unicorn.rb
unicorn_init.sh
))
# which config files should be made executable after copying
# by deploy:setup_config
set(:executable_config_files, %w(
unicorn_init.sh
))
# files which need to be symlinked to other parts of the
# filesystem. For example nginx virtualhosts, log rotation
# init scripts etc.
set(:symlinks, [
{
source: "nginx.conf",
link: "/etc/nginx/sites-enabled/#{fetch(:full_app_name)}"
},
{
source: "unicorn_init.sh",
link: "/etc/init.d/unicorn_#{fetch(:full_app_name)}"
},
{
source: "log_rotation",
link: "/etc/logrotate.d/#{fetch(:full_app_name)}"
},
{
source: "monit",
link: "/etc/monit/conf.d/#{fetch(:full_app_name)}.conf"
}
])
namespace :deploy do
# make sure we're deploying what we think we're deploying
before :deploy, "deploy:check_revision"
# only allow a deploy with passing tests to deployed
before :deploy, "deploy:run_tests"
# compile assets locally then rsync
after :finishing, 'deploy:cleanup'
after 'deploy:publishing', 'deploy:restart'
end
Server
$ ls /home/[user]/.rbenv/versions/
[blank... ]
$
If /home/[user]/.rbenv/versions is an empty directory on the server, then you have no versions of ruby installed.
Try running rbenv install 2.1.2 on the server. You may need to install the ruby-build plugin first.
I'm trying to set up Capistrano deployment for the first time and I wanted to test it on my development directory before attempting it on production. Normally I wouldn't even bother with Capistrano in the dev environment, but I'm having issues when deploying. It seems that Capistrano wants to:
A) run the bundle command: bundle --without development test
and
B) run rake assets:precompile in the development environment. I don't want that. Why would I? Maybe in the 'staging' environment if I ever wanted to do that, but certainly not in development mode.
The biggest hurdle at the moment is the fact that it bundles thinking it's in production mode and thus skips over gems which are required when it DOES correctly use the development environment when precompiling assets.
EDIT: Here's a sample of two scripts which are run - the first scripts run bundler as if we're in the production environment, and the last runs it in development environment (RAILS_ENV=development). We of course get the error because BetterErrors is a gem that's loaded only in the development environment and so it can't find BetterErrors because the call to bundle was in the production environment.
INFO [9797fc64] Running ~/.rvm/bin/rvm default do bundle install --binstubs /home/vps_user/rails_deployments/dev.www/shared/bin --path /home/vps_user/rails_deployments/dev.www/shared/bundle --without development test --deployment --quiet on localhost
DEBUG [9797fc64] Command: cd /home/vps_user/rails_deployments/dev.www/releases/20140217224858 && ~/.rvm/bin/rvm default do bundle install --binstubs /home/vps_user/rails_deployments/dev.www/shared/bin --path /home/vps_user/rails_deployments/dev.www/shared/bundle --without development test --deployment --quiet
INFO [9797fc64] Finished in 1.883 seconds with exit status 0 (successful).
DEBUG [da905ff7] Running /usr/bin/env if test ! -d /home/vps_user/rails_deployments/dev.www/releases/20140217224858; then echo "Directory does not exist '/home/vps_user/rails_deployments/dev.www/releases/20140217224858'" 1>&2; false; fi on localhost
DEBUG [da905ff7] Command: if test ! -d /home/sprvps_userucewo/rails_deployments/dev.www/releases/20140217224858; then echo "Directory does not exist '/home/vps_user/rails_deployments/dev.www/releases/20140217224858'" 1>&2; false; fi
DEBUG [da905ff7] Finished in 0.044 seconds with exit status 0 (successful).
INFO [0562438c] Running ~/.rvm/bin/rvm default do bundle exec rake assets:precompile on localhost
DEBUG [0562438c] Command: cd /home/vps_user/rails_deployments/dev.www/releases/20140217224858 && ( RAILS_ENV=development ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )
DEBUG [0562438c] rake aborted!
DEBUG [0562438c] uninitialized constant BetterErrors
Is there something wrong with my setup? I'm using Capistrano v3+, with Ruby v2.1.0 inside rvm.
Gemfile:
if RUBY_PLATFORM !~ /mingw/
gem 'capistrano-rails'
gem 'capistrano-rvm'
gem 'capistrano-bundler'
end
Capfile:
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
deploy.rb:
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'website'
set :repo_url, 'git#bitbucket.org:MyUserName/website.git'
set :user, 'vps_user'
set :tmp_dir, '/home/vps_user/tmp'
# Default value for keep_releases is 5
set :keep_releases, 3
SSHKit.config.command_map[:rake] = "bundle exec rake"
SSHKit.config.command_map[:rails] = "bundle exec rails"
# Common directories (usually assets)
set :linked_dirs, %w{ public/assets/emails public/assets/events public/assets/photographs public/assets/updates public/assets/video public/assets/wines }
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
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
deploy/development.rb
set :branch, :develop
set :stage, :development
set :rails_env, 'development'
set :deploy_to, '/home/vps_user/rails_deployments/dev.www'
server 'localhost', user: 'vps_user', roles: %w{web app}
deploy/production.rb
set :branch, :master
set :stage, :production
set :rails_env, 'production'
set :deploy_to, '/home/vps_user/rails_deployments/www'
server 'localhost', user: 'vps_user', roles: %w{web app}
And I run the deploy command as such: bundle exec cap development deploy
OK so looking at Capistrano::Bundler under 'Usage' I saw an option in there called :bundle_without and it looked promising. So I put set :bundle_without, 'production' inside of my development.rb deploy script and it worked!
This doesn't solve the issue that Capistrano keeps trying to generate precompiled assets but I'm sure there's a solution out there like overriding the rake task or something.
I'm trying to deploy with Capistrano and RVM and even though when running cap bundler:install_bundler which is supposed to install bundler, and succeeds. After, when running cap deploy it fails with an error that bundler is not installed.
** [out :: victorstan.com] ERROR: Gem bundler is not installed, run `gem install bundler` first.
Any ideas why it installs bundler, but then can't find it, or installs it in the wrong place (i guess?). Thanks!
here is part of my deploy.rb script:
set :application, "dinner"
set :domain, "victorstan.com"
set :repository, "ssh://#{domain}/~/#{application}.git"
set :use_sudo, false
set :user, "victorstan" # The server's user for deploys
set :scm, :git
set :scm_username, "passenger"
set :deploy_to, "/srv/www/#{application}"
set :keep_releases, 2
set :branch, "master"
set :deploy_via, :copy # won't make cap prompt for password when deploying
set :scm_verbose, true
set :rvm_ruby_string, 'ruby-2.0.0-p195#dinner'
set :rvm_type, :user
set :rvm_install_type, :stable
set :whenever_command, "bundle exec whenever"
require "bundler/capistrano"
require "rvm/capistrano"
require "whenever/capistrano"
If I try to use cap to install bundler, it works:
cap bundler:install_bundler
* 2013-06-08 15:33:54 executing `bundler:install_bundler'
* executing "gem install bundler"
servers: ["victorstan.com"]
[victorstan.com] executing command
** [out :: victorstan.com] Successfully installed bundler-1.3.5
** [out :: victorstan.com] 1 gem installed
command finished in 1373ms
And here is the output when running cap deploy:
Switched to a new branch 'deploy'
command finished in 984ms
* Compressing /var/folders/w4/_6g_9lqd491_6cmhzb0kcmzh0000gn/T/20130608192600 to /var/folders/w4/_6g_9lqd491_6cmhzb0kcmzh0000gn/T/20130608192600.tar.gz
executing locally: tar czf 20130608192600.tar.gz 20130608192600
command finished in 53ms
servers: ["victorstan.com"]
** sftp upload /var/folders/w4/_6g_9lqd491_6cmhzb0kcmzh0000gn/T/20130608192600.tar.gz -> /tmp/20130608192600.tar.gz
[victorstan.com] /tmp/20130608192600.tar.gz
[victorstan.com] done
* sftp upload complete
* executing "cd /srv/www/dinner/releases && tar xzf /tmp/20130608192600.tar.gz && rm /tmp/20130608192600.tar.gz"
servers: ["victorstan.com"]
[victorstan.com] executing command
command finished in 467ms
* 2013-06-08 15:26:05 executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* 2013-06-08 15:26:05 executing `bundle:install'
* executing "cd /srv/www/dinner/releases/20130608192600 && bundle install --gemfile /srv/www/dinner/releases/20130608192600/Gemfile --path /srv/www/dinner/shared/bundle --deployment --quiet --without development test"
servers: ["victorstan.com"]
[victorstan.com] executing command
** [out :: victorstan.com] ERROR: Gem bundler is not installed, run `gem install bundler` first.
command finished in 598ms
*** [deploy:update_code] rolling back
* executing "rm -rf /srv/www/dinner/releases/20130608192600; true"
servers: ["victorstan.com"]
[victorstan.com] executing command
command finished in 513ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-2.0.0-p195#dinner' -c 'cd /srv/www/dinner/releases/20130608192600 && bundle install --gemfile /srv/www/dinner/releases/20130608192600/Gemfile --path /srv/www/dinner/shared/bundle --deployment --quiet --without development test'" on victorstan.com
is ruby-2.0.0-p195#dinner installed / created on the server?
you can ensure it is with adding:
before 'deploy:setup', 'rvm:install_ruby'
more details on using rvm-capistrano can be found here: https://github.com/wayneeseguin/rvm-capistrano#readme
I have read some more examples on setting up deploy script and i've re-arranged the order of elements of my deploy script, as well as ena
set :application, "dinner"
set :domain, "victorstan.com"
set :repository, "ssh://#{domain}/~/#{application}.git"
set :use_sudo, false
set :user, "victorstan" # The server's user for deploys
set :scm, :git
set :scm_username, "passenger"
set :scm_passphrase, "*********" # The deploy user's password
set :deploy_to, "/srv/www/#{application}"
set :keep_releases, 2
set :branch, "master"
set :deploy_via, :copy # won't make cap prompt for password when deploying
set :scm_verbose, true
set :rvm_ruby_string, :local
set :rvm_type, :user
set :rvm_install_type, :stable
set :default_shell, :bash
set :whenever_command, "bundle exec whenever"
default_run_options[:pty] = true
# before 'deploy', 'rvm:install_ruby'
before 'deploy:setup', 'rvm:install_ruby'
require "rvm/capistrano"
require "bundler/capistrano"
require "whenever/capistrano"
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
Some notable elements that have changed:
set :rvm_ruby_string set to :local instead of explicitly naming it: 'ruby-2.0.0-p195#dinner', not sure if this has any implication on the issue though, seems unlikely.
set :default_shell, :bash was another parameter I added.
And, as I mentioned, the ordering or the different DSL types might make a difference: set comes first, then before hooks, then require and then role after which comes the rest of the deploy script. Perhaps this can help someone in a similar situation.
Note, when I first tested this script I had before 'deploy', 'rvm:install_ruby' enabled, but I have since disabled it and the script continues to work...
Good day! I'll try to be very specific with this. I'm sorry, but I've had experience a lot of troubles while trying to deploy my application. I'm totally new at rails, so I followed the Agile Web Development with Rails 4th Edition and I'm trapped on the segment of deploy with capistrano I've tried the exact code on the book, didn't work, and take some advices from this and others forums that prove to be helpful, but I'm still can't deploy correctly my deploy.rb goes like this:
require 'bundler/capistrano'
set :user, 'user_created_for_this_example'
set :domain, 'IPADDRESS'
set :application, 'depot'
# file paths
set :repository, "#{user}##{domain}:depot.git"
set :deploy_to, "/home/#{user}/#{domain}"
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess
based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
#roles server
role :web, domain
role :app, domain
role :db, domain, :primary => true
#deploy config
set :deploy_to, "/home/#{user}/#{domain}"
set :deploy_via, :copy
set :scm, 'git'
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
after "deploy:update_code", :bundle_install
desc "install the necesary prerequisites"
task :bundle_install, :roles => :app do
run "cd #{release_path} && bundle install"
end
When i run the cap deploy:setup and cap deploy:check all seems to be working fine:
~/rails_projects/depot$ cap deploy:setup
* 2012-11-13 10:37:35 executing `deploy:setup'
* executing "mkdir -p /home/git/xx.xx.xx.xx /home/git/xx.xx.xx.xx/releases /home/git
/xx.xx.xx.xx/shared /home/git/xx.xx.xx.xx/shared/system /home/git/xx.xx.xx.xx/shared/log
/home/git/xx.xx.xx.xx/shared/pids"
servers: ["xx.xx.xx.xx"]
[xx.xx.xx.xx] executing command
command finished in 158ms
* executing "chmod g+w /home/git/xx.xx.xx.xx /home/git/xx.xx.xx.xx/releases /home/git/xx.xx.xx.xx/shared /home/git/xx.xx.xx.xx/shared/system /home/git/xx.xx.xx.xx/shared/log /home/git/xx.xx.xx.xx/shared/pids"
servers: ["xx.xx.xx.xx"]
[xx.xx.xx.xx] executing command
command finished in 7ms
~/rails_projects/depot$ cap deploy:check
* 2012-11-13 10:37:39 executing `deploy:check'
* executing "test -d /home/git/xx.xx.xx.xx/releases"
servers: ["xx.xx.xx.xx"]
[xx.xx.xx.xx] executing command
command finished in 152ms
* executing "test -w /home/git/xx.xx.xx.xx"
servers: ["xx.xx.xx.xx"]
[xx.xx.xx.xx] executing command
command finished in 5ms
* executing "test -w /home/git/xx.xx.xx.xx/releases"
servers: ["xx.xx.xx.xx"]
[xx.xx.xx.xx] executing command
command finished in 5ms
* executing "which tar"
servers: ["xx.xx.xx.xx"]
[xx.xx.xx.xx] executing command
command finished in 6ms
You appear to have all necessary dependencies installed
But when the cap deploy:migrations, cap deploy or cap deploy:cold command comes the next pops up:
~/rails_projects/depot$ cap deploy:migrations
* 2012-11-13 10:37:42 executing `deploy:migrations'
* 2012-11-13 10:37:42 executing `deploy:update_code'
executing locally: "git ls-remote git#xx.xx.xx.xx:depot.git master"
command finished in 241ms
* getting (via checkout) revision c3f88ca97e5868dd476f20e9a044b7dad800274a to /tmp/20121113173743
executing locally: git clone git#xx.xx.xx.xx:depot.git /tmp/20121113173743 && cd /tmp/20121113173743 && git checkout -b deploy c3f8
8ca97e5868dd476f20e9a044b7dad800274a
Cloning into '/tmp/20121113173743'...
remote: Counting objects: 392, done.
remote: Compressing objects: 100% (257/257), done.
remote: Total 392 (delta 111), reused 392 (delta 111)
Receiving objects: 100% (392/392), 8.59 MiB, done.
Resolving deltas: 100% (111/111), done.
Switched to a new branch 'deploy'
command finished in 769ms
* Compressing /tmp/20121113173743 to /tmp/20121113173743.tar.gz
executing locally: tar czf 20121113173743.tar.gz 20121113173743
command finished in 652ms
servers: ["xx.xx.xx.xx"]
** sftp upload /tmp/20121113173743.tar.gz -> /tmp/20121113173743.tar.gz
[xx.xx.xx.xx] /tmp/20121113173743.tar.gz
*** upload via sftp failed on xx.xx.xx.xx: Net::SFTP::StatusException
(Net::SFTP::StatusException open /tmp/20121113173743.tar.gz (3, "permission denied"))
upload via sftp failed on xx.xx.xx.xx: Net::SFTP::StatusException (Net::SFTP::StatusException open /tmp/20121113173743.tar.gz (3, "permission denied"))
I'm sorry if this is some dummy issue, an easy-fix or an already posted one, but I don't know what else to try, again I'm just starting with this stuff and I'm truly lost. I'm running all from the same machine and all the xx.xx.xx.xx stands for my ip address. Any suggestions will be really appreciated. I've tried to be specific as possible, but if something is missing I'll post it. Thanks beforehand for your time and help.
Your problem here is that your source and destination locations for sftp are the same:
** sftp upload /tmp/20121113173743.tar.gz -> /tmp/20121113173743.tar.gz
in order to fix the issue you may specify parameter copy_dir in your config/deploy.rb file, something like this:
set :copy_dir, "/tmp/sftp"
no need to create that folder manually then.
Try adding this line to your deploy.rb configuration file:
default_run_options[:pty] = true
We changed the Capfile from
set :deploy_via, :copy
to
set :deploy_via, :remote_cache
and this worked for us. We did not add the below line
default_run_options[:pty] = true