Configuring Capistrano For Local To Remote Deployment


#1

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


#2

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.


#3

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

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


#4

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