Capistarno deployment issues

Hi guys,

I’ve just started using capistrano so forgive me if I’ve done something
moronic. I’ve run capify and cap deploy:setup which all worked fine. But
when I try to deploy my app I get the following error:


F:\personal\app>cap deploy

  • executing `deploy’
  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
  • executing “svn export -q -r6 http://www.app.com/svn/app
    /home/app/releases/20070906161047 && (echo 6 > /ho
    me/app/releases/20070906161047/REVISION)”
    servers: [“app.com”]
    Password:
    [app.com] executing command
    ** [out] svn: Unrecognized URL scheme for ‘http://www.app.com/svn/app
    command finished
    *** [deploy:update_code] rolling back
  • executing “rm -rf /home/app/releases/20070906161047; true”
    servers: [“app.com”]
    [app.com] executing command
    command finished
    command “svn export -q -r6 http://www.app.com/svn/app
    /home/app/releases/20070906161047 && (echo 6 > /home/fap
    box/releases/20070906161047/REVISION)” failed on app.com

Anyone have any ideas?

Cheers,

Jim

Wierd:

svn: Unrecognized URL scheme for ‘http://www.app.com/svn/app

That’s the error that is being reported. I’m assuming
http://www.app.com/svn/app” is not your real SVN repository URL;
please double- and triple-check your actual SVN repository URL to make
sure you typed it correctly.

  • Jamis

Hi Jamis,

The SVN repos isn’t the one listed but I’ve checked it several times and
it’s definately the right place.

If you log into your remote server and type:

svn info http://www.app.com/svn/app

(using your real url, of course), does it give an error?

It’s got to be something configured weird with svn. Does
$HOME/.subversion/config have anything in it (aside from the default
boilerplate text)?

  • Jamis

I’ve setup my deploy recipe. Although I might have missed some important
steps as I’m new to all this jazz. Anyway here’s my deploy.rb:


set :application, “fapbox”
set :repository, “http://www.fapbox.com/svn/fapbox/
set :deploy_to, “/home/fapbox/”
set :user, “root”
set :svn_username, “kjimn”
set :svn_password, “mypassword”

role :app, “fapbox.com
role :web, “fapbox.com
role :db, “fapbox.com”, :primary => true

I think I’ve found the problem. I didn’t have neon installed. Just
installed it now and everything seems to work brilliantly.

You have not configured your deployment recipe. Edit config/
deploy.rb.

Here’s a fleshed-out example (for cap 1.4), invoked as:

cap TASK ACTION

e.g.

cap production deploy

Capistrano deployment


acting user

this is the login/username for your remote machines, svn repos, etc

set :user, “FOOUSER”

svn repository config… note usage of svn+ssh, alter as necessary

default deploy is trunk

to specify a tag or branch:

cap staging deploy -Sbranch=candidate-1.2.3

cap production deploy -Stag=release-1.2.3

set :base_repository, “svn+ssh://svn.FOOBAR.com/usr/local/repos/FOOBAR/
site”
if variables[:tag]
set :repository, “#{base_repository}/tags/#{variables[:tag]}”
elsif variables[:branch]
set :repository, “#{base_repository}/branches/
#{variables[:branch]}”
else
set :repository, “#{base_repository}/trunk”
end

ssh options

ssh_options[:keys] = %w(/path/to/my/key /path/to/another/key)

ssh_options[:port] = 25


production and dev/staging tagets; this is how you handle

differences in paths etc…

exa: the dev machine is a linux box, the production target is

multiple solaris zones

hosted at joyent/textdrive

production

task :production do
set :application, “FOOBAR”
set :deploy_to, “/opt/csw/yb/#{application}/”
set :mongrel_conf, “/opt/csw/yb/#{application}/shared/config/
mongrel_cluster.yml”
set :svn, “/opt/csw/bin/svn”
set :sudo, “/opt/csw/bin/sudo”

    set :mongrel_rails, "/opt/csw/bin/mongrel_rails"

    role :web, "FOOBAR.com"
    role :app, "FOOBAR.com", "w1.FOOBAR.com", "w2.FOOBAR.com",

w3.FOOBAR.com”, “w4.FOOBAR.com”, “w5.FOOBAR.com”, “w6.FOOBAR.com”,
w7.FOOBAR.com
role :db, “FOOBAR.com”, :primary => true, :no_release => true
end

dev/staging

task :stage do
set :application, “FOOBAR”
set :deploy_to, “/var/rails/#{application}/”
set :mongrel_conf, “/var/rails/#{application}/shared/config/
mongrel_cluster.yml”
set :svn, “/usr/local/bin/svn”
set :sudo, “/usr/bin/sudo”
set :mongrel_rails, “/usr/local/bin/mongrel_rails”

    role :web, "dev.FOOBAR.com"
    role :app, "dev.FOOBAR.com"
    role :db, "dev.FOOBAR.com", :primary =>

true, :no_release=>true
end


desc “things to do after the initial setup”
task :after_setup do
run “mkdir #{shared_path}/images”
run “mkdir #{shared_path}/config”
end

desc “”
task :before_update_code, :role => :app do
ENV[‘REASON’] = “scheduled maintenance”
ENV[‘UNTIL’] = (Time.now + 600).to_s
end

desc “things to do after the code update, before a migration and/or
restart”
task :after_update_code, :role => :app do

upon first depoyment, these will not exist in shared, so we copy

them if not present in shared
unless File.exist? “#{shared_path}/config/backgroundrb.yml”
run “cp #{release_path}/config/backgroundrb.yml
#{shared_path}/config/backgroundrb.yml”
end
unless File.exist? “#{shared_path}/config/database.yml”
run “cp #{release_path}/config/database.yml #{shared_path}/
config/database.yml”
end
unless File.exist? “#{shared_path}/config/mongrel_cluster.yml”
run “cp #{release_path}/config/mongrel_cluster.yml
#{shared_path}/config/mongrel_cluster.yml”
end
end

desc “”
task :before_symlink, :role => :app do

solaris ln oddity(?) – subsequent symlinks wind up IN current,

not replacing it
run “rm -f #{deploy_to}/current”
end

desc “after the release/current symlink is set, restore links to
shared config files”
task :after_symlink, :role => :app do
run “rm -f #{deploy_to}/current/config/backgroundrb.yml”
run “ln -s #{shared_path}/config/backgroundrb.yml #{deploy_to}/
current/config/backgroundrb.yml”

run “rm -f #{deploy_to}/current/config/mongrel_cluster.yml”
run “ln -s #{shared_path}/config/mongrel_cluster.yml #{deploy_to}/
current/config/mongrel_cluster.yml”

run “rm -f #{deploy_to}/current/config/database.yml”
run “ln -s #{shared_path}/config/database.yml #{deploy_to}/current/
config/database.yml”

end

desc “update code from svn w/o creating a new deployment… migrate
and restart”
task :soft_deploy do
transaction do
run “cd #{deploy_to}/current/app; #{svn} up”
run “cd #{deploy_to}/current/script; #{svn} up”
run “cd #{deploy_to}/current/public; #{svn} up”
run “cd #{deploy_to}/current/vendor; #{svn} up”
run “cd #{deploy_to}/current/lib; #{svn} up”
run “cd #{deploy_to}/current/db; #{svn} up”
run “cd #{deploy_to}/current/test; #{svn} up”
run “cd #{deploy_to}/current/config/; #{svn} up environment.rb”
run “cd #{deploy_to}/current/config/environments; #{svn} up
production.rb”

migrate

end
restart
end

On Sep 6, 9:22 am, Jim N. [email protected]