rvm1-capistrano3
rvm1-capistrano3 copied to clipboard
deploy fails with relative :deploy_to
Hi.
1.2.6
understands relative paths well, but new 1.3.2.2
fails on deploy:check
Somewhere in deployment configuration:
set :deploy_to, '~/rvm1cap3test'
[ivko@thinkpad-e530 rvm1cap3test]$ bundle exec cap staging deploy:check
INFO[fcff978e] Running /usr/bin/env mkdir -p ~/rvm1cap3test/rvm1scripts/ on <server host here>
DEBUG[fcff978e] Command: /usr/bin/env mkdir -p ~/rvm1cap3test/rvm1scripts/
INFO[fcff978e] Finished in 3.512 seconds with exit status 0 (successful).
DEBUGUploading /home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/rvm1-capistrano3-1.3.2.2/script/rvm-auto.sh 0.0%
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host <server host here>: scp: ~/rvm1cap3test/rvm1scripts/rvm-auto.sh: No such file or directory
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-scp-1.2.1/lib/net/scp.rb:398:in `await_response_state'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-scp-1.2.1/lib/net/scp.rb:369:in `block (3 levels) in start_command'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `call'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `process'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `block in preprocess'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `each'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `preprocess'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/net-scp-1.2.1/lib/net/scp.rb:284:in `upload!'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:83:in `block in upload!'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:82:in `upload!'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/rvm1-capistrano3-1.3.2.2/lib/rvm1/tasks/capistrano3.rake:6:in `block (3 levels) in <top (required)>'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/ivko/rvm1cap3test/vendor/bundle/ruby/2.1.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
scp: ~/rvm1cap3test/rvm1scripts/rvm-auto.sh: No such file or directory
full path (/home/someuserhere/rvm1cap3test
) works just great.
this might be bug in sshkit ... I will try to investigate some time later as you got an easy workaround
@mpapis Ok, thank you.
Anyway, I created this issue more to help others who can stumble upon such behavior and to have a place to post a workaround. But it would be great to have it fixed. =)
revert to the old version to fix the issue.
@glacier3 can you provide more details? reverted to old version of sshkit
or rvm1-capistrano3
?
Revert rvm1-capistrano3 to 1.2.2 can fix this issue. When I using the latest 1.3.2.2, there is an issue will happen.
cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as root@aliyun: scp: ~/gjt-site/rvm1scripts/rvm-auto.sh: No such file or directory scp: ~/gjt-site/rvm1scripts/rvm-auto.sh: No such file or directory
@glacier3 the old version uses one cache /tmp
for all applications, this can make collisions, a later version was using /tmp/<user>
- and finally we ended up to using <deploy_to>/tmp
- this way the cache is per application and no collisions are possible - but it ends up in using your ~/...
deploy_to
path, I assume this is not problem in capistrano3
itself so has to be either specially handled in capistrano3
or is a bug in sshkit
@mpapis You are right. It sshkit's bug. After I change the deploy_to path from "~/gjt-site" to absolute path "/root/gjt-site". The issue disappeared. I notice that rvm1-capistrano3 is using sshkit 1.2, do you have any plan to upgrade it? Maybe higher version has already fixed this bug.
the gemspec says:
spec.add_dependency 'sshkit', '>=1.2'
so if you could test with newer version => https://github.com/capistrano/sshkit/releases I would be glad to update the requirement or merge your Pull Request with it.
@mpapis After I did some research and testing, finally I found it's a bug from the net-scp gem. There is a people also encountering such problem, https://github.com/net-ssh/net-scp/issues/9. So, for now, the home folder type ~ maybe is not a good way.
hmm, does it work with $HOME
?
$HOME is not working. It works in this way,
task :set_up_deploy_path do on roles(:app) do set :deploy_to, lambda {capture("echo -n ~/gjt-site")} end end
before 'rvm1:hook', 'set_up_deploy_path'`
then maybe it's worth adding a descriptive warning instead of letting it fail?
I think if our gem can automatically convert '~' to user home folder path is much better. Do you think so?
it would be nice, but the trick with capture works only with one server, it's a lot easier to print a warning then to try to detect server configuration, and still in case of more then one server we need to print the warning
+1 even when I update to rvm1-capistrano3 (= 1.2.2) I still get the: rvm1scripts/rvm-auto.sh: No such file or directory error