Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

capistrano deploy from one local directory to another

I want to deploy application on my local machine. For example I have my Rails APP in: /home/thesis/dev/myapp but I want to cap deploy:setup to /home/thesis/deploy/. I have tried that but capistrano tries to connect to localhost, but it is not needed at all. How can I solve it?

Here goes my deploy.rb

role :app, "localhost"
role :web, "localhost"
role :db,  "localhost", :primary => true

set(:deploy_to) { "/home/thesis/dev/myapp" }
set :bundle_without,  [:development, :test]
set :use_sudo, false

set :repository, "."
set :scm, :none
set :deploy_via, :copy

set :copy_dir, "/home/thesis/deploy/tmp"
set :copy_remote_dir, "/home/thesis/deploy/tmp"

It drops with:

connection failed for: localhost (Errno::ECONNREFUSED: Connection refused - connect(2))
like image 406
thesis Avatar asked Nov 29 '11 10:11

thesis


1 Answers

The localhost issue is because you're setting this in the role definitions. Since you're doing all this locally, and since Capistrano requires a role, you can set the following:

role :app, ""

I also think you're setting the copy_dir and copy_remote_dir values incorrectly. I'd recommend removing these and letting Capistrano use it's defaults.

Here's a full config which should work for you:

role :app, ""

set :use_sudo, false
set :application, 'thesis'     # you'll need to specify an app name
set :repository, "."
set :scm, :none
set :deploy_to, "/home/thesis/deploy/"   # the destination dir
set :deploy_via, :copy

# override deploy:restart since this isn't a Rails app
namespace :deploy do
  task :restart do
    # no-op
  end
end
like image 189
Olly Avatar answered Oct 20 '22 16:10

Olly