capistrano-rsync
capistrano-rsync copied to clipboard
Doesn't work with Capistrano 3.0.1
Capistrano 3.0.1
Here's deploy.rb:
require "capistrano/rsync"
set :application, 'auth-backend'
set :repo_url, 'git@red:omg-auth-backend.git'
set :branch, 'master'
set :deploy_to, '/home/cpc-system/apps/auth-backend'
set :scm, :git
set :keep_releases, 5
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :finishing, 'deploy:cleanup'
end
production.rb is the following:
set :stage, :production
server 'cpc-server', user: 'cpc-system', roles: %w{web app db}
set :rsync_options, %w[--recursive --delete --delete-excluded --exclude .git*]
On a cold deployment outputs the following:
$ be cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Invoke rsync:hook_scm (first_time)
** Execute rsync:hook_scm
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO [162b1537] Running /usr/bin/env mkdir -p /tmp/auth-backend/ on cpc-server
DEBUG [162b1537] Command: /usr/bin/env mkdir -p /tmp/auth-backend/
INFO [162b1537] Finished in 1.023 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/auth-backend/git-ssh.sh 0.0%
INFO Uploading /tmp/auth-backend/git-ssh.sh 100.0%
INFO [0648d87e] Running /usr/bin/env chmod +x /tmp/auth-backend/git-ssh.sh on cpc-server
DEBUG [0648d87e] Command: /usr/bin/env chmod +x /tmp/auth-backend/git-ssh.sh
INFO [0648d87e] Finished in 0.149 seconds with exit status 0 (successful).
** Execute git:check
DEBUG [bc78532f] Running /usr/bin/env git ls-remote git@red:omg-auth-backend.git on cpc-server
DEBUG [bc78532f] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/auth-backend/git-ssh.sh /usr/bin/env git ls-remote git@red:omg-auth-backend.git )
DEBUG [bc78532f] Permission denied (publickey,password).
DEBUG [bc78532f] fatal: The remote end hung up unexpectedly
DEBUG [bc78532f] Finished in 0.368 seconds with exit status 128 (failed).
It seems like it's trying to do git stuff on a server, which it is not supposed to be doing.
@SkyWriter it could be due to the default options problem highlighted in https://github.com/moll/capistrano-rsync/pull/2
@moll Can you look at my pull request or at least @webflo's pull request soon to narrow down the scope of possible errors? The pull requests are not that complex to review and aim to solve basic problems that a new user will encounter when trying this gem. We can always refactor the code later after the basic needs are met. Right now without the patches to a new user this nice little gem seems unusable.
@seantan Thanks for you comment. I'll gladly try to apply your patch to Capistrano 3, see if it works and give some feedback.
But my honest opinion is that there's been a few changes in Capistrano for the past 3 months, so this gem might as well just lag behind a little bit.
@SkyWriter Thanks for trying the PRs. Will appreciate your feedback. :)
@seantan, nope, unfortunately it exercises exactly the same behavior after applying your patch.
@SkyWriter try setting the following
set :scm, :rsync
set :rsync_scm, :git
Tons of gratitude to you!
Now these were two secret ingredients:
- Setting :scm to :rsync, and :rsync_scm to :git, necessity of which somehow fell out of my sight.
- Appying pull request #6.
That have made working almost out of the box.
It's only that I've had to create shared/deploy directory by hand on a cold deployment.
Glad to be of help :)
I agree pt. 1 should be stated in the README to make it obvious.
I didn't notice the need to manually create the rsync_cache though. Not sure whether it's a side effect of me using capistrano-bundler gem.
For me, doing
bundle exec cap production deploy
created everything.