Documentation should be clear
I noticed that although this is a recent fork of capistrano-rsync, the documentation seems to not have been updated much.
I'm trying to wrap my head around how this is working and since I don't know much about capistrano, it seems to be extra hard especially since the documentation provided does not provide a working system.
Please update the documentation so it produces a working example of:
- a local machine pulling from Git some branch
- tmp/deploy being rsync to remote server (server:/path/to/app/shared/deploy)
- a new release ready
With the current configuration in README, #1 and #3 are done, only if I manually do: rsync -a tmp/deploy server:/path/to/shared/. This is the whole point of using capistrano-rsync-* so I dunno why it doesn't do just that.
@lemsx1 you're right, the documentation is a bit lacking. I'll try to update on that whenever I get some time. However, if you'd like to see things speed up a bit, feel free to make some suggestions through a pull request :)
Yes, I know. I've tried to get the sync from tmp/deploy to shared/deploy to work. I read the source and still can't figure it out. This feels like black magic to me since I've never used Capistrano and it has way too many triggers. Even the debug trace doesn't show the "rsync" task ever being called. I figure I'd open an issue while I keep trying 😉
Ok, I was able to figure it out. Here is my configuration which might help others reading this issue:
- uninstall capistrano-rsync # it confused my installation for some reason
- edit Gemfile
group :development do
# Deploy with Capistrano
gem 'capistrano', '~> 3.4'
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano-passenger'
gem 'capistrano-rsync-bladrak'
end
- edit Capfile
require 'capistrano/setup' # this loads capistrano/rsync.rb automatically because of: set :scm, :rsync
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/passenger'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
- edit config/deploy.rb
set :application, 'myapp'
set :rsync_options, %w[
--recursive --delete --delete-excluded
--exclude .git*
--exclude /config/database.yml
--exclude /test/***
]
set :repo_url, 'ssh://server/git/myapp'
unless ENV['RAILS_ENV'] == 'production'
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
end
set :deploy_to, '/srv/apps/myapp'
set :scm, :rsync
namespace :deploy do
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, 'tmp:create'
execute :rake, 'tmp:clear'
end
end
end
# ...
end
I hope this helps somebody...
Please update the documentation with this working example.
Thanks for your report @lemsx1 :) I'll update the documentation accordingly when I get some time. I'm guessing most of your issues came from the existing capistrano-rsync install; I'll add a mention about uninstalling it first, and a reference to your issue as well.