Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation should be clear #24

Open
lemsx1 opened this issue Mar 15, 2016 · 4 comments
Open

Documentation should be clear #24

lemsx1 opened this issue Mar 15, 2016 · 4 comments

Comments

@lemsx1
Copy link

lemsx1 commented Mar 15, 2016

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:

  1. a local machine pulling from Git some branch
  2. tmp/deploy being rsync to remote server (server:/path/to/app/shared/deploy)
  3. 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.

@Bladrak
Copy link
Owner

Bladrak commented Mar 16, 2016

@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 :)

@lemsx1
Copy link
Author

lemsx1 commented Mar 16, 2016

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 😉

@lemsx1
Copy link
Author

lemsx1 commented Mar 16, 2016

Ok, I was able to figure it out. Here is my configuration which might help others reading this issue:

  1. uninstall capistrano-rsync # it confused my installation for some reason
  2. 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
  1. 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 }
  1. 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.

@Bladrak
Copy link
Owner

Bladrak commented Mar 17, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants