views:

138

answers:

1

Hi,

I am trying to deploy my rails application for the first time.

Server is running Ubuntu 10.4 server (64bit)
Local machine is running Windows XP.
Repository is at github

I have successfully run

cap deploy:setup

but when I run

cap deploy:cold

I get the following error:

D:\Rails\rails_apps\fx>cap deploy:cold
You are running Ruby 1.8.6, which has a bug in its threading implementation.
You are liable to encounter deadlocks running Capistrano, unless you install
the fastthread library, which is available as a gem:  
   gem install fastthread  
  * executing `deploy:cold'  
  * executing `deploy:update'  
 ** transaction: start  
  * executing `deploy:update_code'  
    updating the cached checkout on all servers  
*** [deploy:update_code] rolling back  
  * executing "rm -rf /var/www/fx/releases/20100818215651; true"  
    servers: ["pragmaticriskmanagement.gotdns.com"]  
    [pragmaticriskmanagement.gotdns.com] executing command  
    command finished  
D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:37:in ``': No such file or directory - git rev-parse master (Errno::ENOENT)
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:37:in `load'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:87:in `with_env'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy.rb:37:in `load'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistran/recipes/deploy/scm/git.rb:154:in `query_revision'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `send'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:63:in `local'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'  
         ... 39 levels...  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/lib/capistrano/cli/execute.rb:14:in `execute'  
        from D:/Rails/ruby/lib/ruby/gems/1.8/gems/capistrano-2.1.0/bin/cap:4 
        from D:/Rails/ruby/bin/cap:19:in `load'  
        from D:/Rails/ruby/bin/cap:19  

Here is my 'deploy.rb' file

set :application, "fx"  #"pragmaticriskmanagement.gotdns.com"
set :repository,  "[email protected]:jmedding/Fx.git"
set :deploy_to, "/var/www/#{application}"

set :git_enable_submodules, 1         # Make sure git submodules are populated

set :location, "pragmaticriskmanagement.gotdns.com"

set :user, "xxxxx"
set :use_sudo, false

set :scm, :git

role :app, location #"your app-server here"
role :web, location #"your web-server here"
role :db,  location,    :primary => true #"your db-server here", :primary => true

namespace :deploy do
    desc "Restart Application"
    task :restart, :roles => :app do
      run "touch #{current_path}/tmp/restart.txt"
    end

    desc "Make symlink for database.yml" 
    task :symlink_dbyaml do
      run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" 
    end

    desc "Create empty database.yml in shared path" 
    task :create_dbyaml do
      run "mkdir -p #{shared_path}/config" 
      put '', "#{shared_path}/config/database.yml" 
    end
end

  after 'deploy:setup', 'deploy:create_dbyaml'
  after 'deploy:update_code', 'deploy:symlink_dbyaml'

  after "deploy", "deploy:cleanup"

and now I'm stuck...

Any help would be greatly appreciated.

Thanks,
Jon

A: 

Ok, I have made some progress.

It seems that the error indicates that the git ls-remote command could not be found on the local system (win xp). As a test, I opened the GIT Bash shell and tried the command - it worked. Next, I tried

cap deploy 

from the GIT Bash shell. Command not found. OK, I added my rails path

D:\Rails\ruby\bin

to the windows 'path' variable. Now, try

cap deploy

from the bash shell. This seems to have solved this problem, which now leads to my next problem

** [xxxxxxxx.com :: out] Cloning into /var/www/fx/shared/cached-copy...
** [xxxxxxxx.com :: err] Permission denied (publickey).
** [xxxxxxxx.com :: err] fatal: The remote end hung up unexpectedly

I can successfully run cap deploy from my linux box with the same public key. Also, I can push to my Github repo from this laptop with this key. Of course, the key in question should be on the server, but if it works when I run 'cap' from the linux box, why wouldn't it run from here?

CHsurfer