Skip to content
New issue

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

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

Already on GitHub? # to your account

Example? #1

Closed
webflo opened this issue Oct 29, 2013 · 15 comments
Closed

Example? #1

webflo opened this issue Oct 29, 2013 · 15 comments
Labels

Comments

@webflo
Copy link

webflo commented Oct 29, 2013

I have read the documentation but still can not get to work? Can you create a sample configuration?

Thanks!

@moll
Copy link
Owner

moll commented Oct 29, 2013

Hey,

Sorry to hear you're having troubles. Sure, I can do that when I get behind a computer, but till then, have far did you get to?

@moll
Copy link
Owner

moll commented Oct 29, 2013

I copied this Capfile from an app of mine. Please let me know if that helps:

require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/rsync"

set :application, "foo"
set :stage, :production
set :deploy_to, "/var/www/foo"
set :repo_url, "."

role :app, "user@foo"

set :rsync_options, %w[--recursive --delete --delete-excluded  --exclude .git*]

@rromerogar
Copy link

Hi @moll ,

I have read the documentation but still can not get to work too

On my Capfile

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rsync'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

On my deploy.rb:

set :application, 'IRMAP'

set :scm, :rsync
set :rsync_options, %w[--recursive --delete --delete-excluded --exclude .git*]
set :deploy_to, '/home/campus/rubyHome/apps/IRMAP'


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

  after :finishing, 'deploy:cleanup'
end

it makes a tmp/deploy git clone at local machine but seems that doesn't do a rsync from this tmp/deploy to /home/campus/rubyHome/apps/IRMAP/shared/deploy in remote mechine.... any suggestion?

@moll
Copy link
Owner

moll commented Oct 31, 2013

I might have a feeling it's related to the scm line. You could try setting it to :git or removing it as it'll default to :git anyways.

@rromerogar
Copy link

Thanks @moll

If I put :git on :scm line, when I do a cap deploy, Capistrano tries to make a git clone on server side, that's what I want to avoid (I haven't git on server).

@webflo
Copy link
Author

webflo commented Oct 31, 2013

@moll thanks for your example. Have not tried it yet. But i had the same problem as @rromerogar ...

@rromerogar
Copy link

If I set :scm to git, then execute: cap test rsync , It's make shared/deploy on remote server. Then, change :scm to rsync, and then execute cap test deploy, and...works... 😑

@moll
Copy link
Owner

moll commented Oct 31, 2013

Thanks for the feedback, fellows, and sorry for the troubles! I'll take a deeper look at everything tonight.

webflo added a commit to webflo/capistrano-rsync that referenced this issue Nov 1, 2013
@webflo
Copy link
Author

webflo commented Nov 1, 2013

@rromerogar Please look at my pull request and try it out ...

@garthenweb
Copy link

I had the same Problems. The pull request ist working for me, please merge into master!

@estahn
Copy link

estahn commented May 12, 2014

Is this gem working for anyone?

capistrano (3.2.1)
capistrano-rsync (1.0.2)

@fazy
Copy link

fazy commented Jun 9, 2014

@estahn it didn't work for me without some changes. The following Capfile seems to be the minimum config (note, for testing purposes I only have this Capfile and be sure to clean out the tmp/ directory while debugging):

# Capfile

require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/rsync"

set :application, "foo"
set :stage, :production
set :deploy_to, "/var/www/foo"
set :repo_url, "git@foo:foo/foo.git"
set :keep_releases, 5
set :branch, "master"

role :app, "deploy@foo"

set :rsync_options, %w[--recursive --delete --delete-excluded  --exclude .git*]

set :scm, :rsync

namespace :rsync do
  task :set_current_revision do
    # nothing
  end
end

Regarding the set_current_revision: this seems to be needed now, but I didn't manage to make a working implementation that populates it properly. See Capistrano's git.rake if you want to try this.

muratayusuke pushed a commit to BEST10developers/capistrano-rsync that referenced this issue Jun 28, 2014
Resolving issue with set_current_revision not declared
@yourtallness
Copy link

Personally I can't get a rails application to deploy fully.

Firstly, the script does not create a shared/config/deploy on the target machine and fails, so I had to create it manually.

Secondly, rsync does not copy over many folders and directories, including /app, the Gemfile, etc. It only copies /vendor and some other stuff.

I have no idea why it just does not copy the entire cached repo...

@mtchavez
Copy link

It appears this gem is not being updated anymore and that a handful of people trying to use it are unable to get it to work. I browsed through the forks and found this one https://github.com/nifty/capistrano-rsync to be comprehensive and is better integrated with Capistrano 3. I thought I would share here in case people are banging their heads trying to get things working. Hope this helps.

ezekg pushed a commit to ezekg/capistrano-rsync that referenced this issue Dec 31, 2015
ToMoCoop pushed a commit to BuildEmpire/capistrano-rsync that referenced this issue Apr 22, 2016
@webflo
Copy link
Author

webflo commented Nov 25, 2016

Thanks all, i use https://github.com/Bladrak/capistrano-rsync these days.

@webflo webflo closed this as completed Nov 25, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants