Question

I'm trying to deploy a Rails application from my local machine to the VPS through Capistrano. I've installed Capistrano by including it in the Gemfile and running 'bundle'. Then I ran 'capify .' and added the ff to the Capfile.

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.2-p136@foobar'

Now, I'm stuck with the deploy.rb, I'm not sure what values should I put into the file. If I don't host my code in Github or other online repositories, what should I place in the set :repository option? And what exactly is set :domain? Should I use the ip address of my VPS machine here? Btw, I'm following the tutorial from http://infinite-sushi.com/2011/01/deploying-a-rails-app-to-a-linode-box/, and here's the sample deploy.rb.

set :user, 'deploy'
set :domain, 'foo.bar.us'
set :application, "my_web_app"

set :repository, "git@github.com:foo/repo.git"  # Your clone URL
set :scm, "git"
set :branch, "master"
set :scm_verbose, true
set :deploy_via, :remote_cache
set :scm_passphrase, "password"  # The deploy user's password
set :deploy_to, "/home/#{user}/#{domain}"
set :use_sudo, false

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

role :web, domain                         # Your HTTP server, Apache/etc
role :app, domain                          # This may be the same as your `Web` server
role :db,  domain, :primary => true # This is where Rails migrations will run

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end
Was it helpful?

Solution

set :scm, :none
set :deploy_via, :rsync_with_remote_cache

You can also try :deploy_via, :copy. As for the :domain option, the example you followed is using that for both naming as well as for accessing the server. I'd suggest just hardcoding the ip addresses with the servers for now. I know it's not DRY, but if your cluster grows in size, you'll want to change these values (or just set the ip to a variable for now -- it doesn't really matter):

set :deploy_to, "/home/#{user}/#{application}"
role :web, "1.2.3.4"
role :app, ["1.2.3.5", "1.2.3.6"]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top