# Configuring Capistrano For Local To Remote Deployment

**URL:** <https://www.ruby-forum.com/t/configuring-capistrano-for-local-to-remote-deployment/60460>\
**Category:** Rails\
**Created:** [May 14, 2006, 4:16am UTC](https://www.ruby-forum.com/t/configuring-capistrano-for-local-to-remote-deployment/60460 "2006-05-14T04:16:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![conz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@conz](https://www.ruby-forum.com/u/conz)\
**Post date:** [May 14, 2006, 4:16am UTC](https://www.ruby-forum.com/t/configuring-capistrano-for-local-to-remote-deployment/60460/1 "2006-05-14T04:16:02Z")

</div>

How does one configure capistrano for moving local file to your remote  
server? In the docs it says that one cannot use file:// so what’s the  
configuration step for resolving this issue?

Thanks in advance,

-Conrad

---

<div class="post-metadata">

**Author:** ![conz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@conz](https://www.ruby-forum.com/u/conz)\
**Post date:** [May 15, 2006, 6:51am UTC](https://www.ruby-forum.com/t/configuring-capistrano-for-local-to-remote-deployment/60460/2 "2006-05-15T06:51:42Z")

</div>

Conrad T. wrote:

> How does one configure capistrano for moving local file to your remote  
> server? In the docs it says that one cannot use file:// so what’s the  
> configuration step for resolving this issue?

Assuming your local machine (where your svn repo lives and you are  
running rake deploy) is linux and the machine has SSH enabled. I don’t  
see any reason you cant use the svn+ssh URI to access your local SVN  
repository. You can typically access any file:/// URI svn repo by using  
the svn+ssh://localhost/path/to/svn URI. (NOTE: this probably won’t  
work if your local machine is not a live internet host, it will depend  
on where the svn checkout is performed … probably on the target  
servers, thus your local computer would have to be accessible by the  
target servers via the URI provided. So sitting in a coffee shop  
working on your laptop wont cut it.)

So I would suggest you set that as your :repository in your deploy.rb.  
Let me know if this works.

---

<div class="post-metadata">

**Author:** ![conz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@conz](https://www.ruby-forum.com/u/conz)\
**Post date:** [May 15, 2006, 6:57am UTC](https://www.ruby-forum.com/t/configuring-capistrano-for-local-to-remote-deployment/60460/3 "2006-05-15T06:57:55Z")

</div>

I posted a recipe for doing this a while back…

[http://www.nabble.com/a-switchtower-recipe-to-copy-rather-than-checkout-t1187330.html#a3127795](http://www.nabble.com/a-switchtower-recipe-to-copy-rather-than-checkout-t1187330.html#a3127795)

Here are the basic details…

desc “fix up database and .htaccess”  
task :after\_update\_code do  
run “cp #{release\_path}/config/database.yml.templ  
#{release\_path}/config/database.yml”  
run “cp #{release\_path}/public/dot.htaccess.deploy  
#{release\_path}/public/.htaccess”  
end

desc \<\<DESC  
Update all servers with the latest release of the source code.  
This is a modified version that copies a local copy to the remote site  
DESC

task :update\_code, :roles =\> [:app, :db, :web] do  
on\_rollback { delete release\_path, :recursive =\> true }

```
#puts "doing my update_code"
temp_dest= "tmp_code"

#puts "...get a local copy of the code into #{temp_dest} from local 

```

svn"  
# but this could also just be your local development folder  
system(“svn export -q #{configuration.repository} #{temp\_dest}”)

```
#puts "...tar the folder"
# you could exclude files here that you don't want on your 

```

production server  
system(“tar -C #{temp\_dest} -c -z -f code\_update.tar.gz .”)

```
#puts "...Sending tar file to remote server"
put(File.read("code_update.tar.gz"), "code_update.tar.gz")

#puts "...detar code on server"
run <<-CMD
    mkdir -p #{release_path} &&
    tar -C #{release_path} -x -z -f code_update.tar.gz &&
    rm -rf code_update.tar.gz &&
    rm -rf #{release_path}/log #{release_path}/public/system &&
    ln -nfs #{shared_path}/log #{release_path}/log &&
    ln -nfs #{shared_path}/system #{release_path}/public/system
CMD

#puts "...cleanup"
system("rm -rf #{temp_dest} code_update.tar.gz")

```

end

---

<div class="post-metadata">

**Author:** ![conz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@conz](https://www.ruby-forum.com/u/conz)\
**Post date:** [May 15, 2006, 7:31am UTC](https://www.ruby-forum.com/t/configuring-capistrano-for-local-to-remote-deployment/60460/4 "2006-05-15T07:31:34Z")

</div>

Hi ALL, thanks for responding to my post. I’ll experiment with both  
to see if it works for me. BTW, I’m working on a Mac OS X. Gotta go  
and thanks again.

Peace,

-Conrad
