Welcome Guest | Login

git and capistrano on shared account

Hi!

I have followed the following tutorial:http://www.hostingrails.com/forums/wiki_thread/59

in deploy.rb I had to comment out to make it work:

default_run_options[:pty] = true

and set the domain to ip I got in my mail.

set :domain, "74.63.***"

but still, when I make the last step:

cap deploy:cold

it produces errors.

here is what I get:

_______________

cap deploy:cold
 * executing `deploy:cold'
 * executing `deploy:update'
** transaction: start
 * executing `deploy:update_code'
my_account_name@74.63***'s password:
 * executing "git clone -q --depth 1 my_account_name@74.63***:/home/my_account_name/git/my_app /home/my_account_name/apps/my_app/releases/20080815062754 && cd /home/my_account_name/apps/my_app/releases/20080815062754 && git checkout -q -b deploy 0d0f5f39dca159cbe325d7a8ee15d8999e767732 && (echo 0d0f5f39dca159cbe325d7a8ee15d8999e767732 > /home/my_account_name/apps/my_app/releases/20080815062754/REVISION)"
   servers: ["74.63***"]
Password:
   [74.63***] executing command
** [74.63*** :: err] Permission denied, please try again.
** [74.63*** :: err] Permission denied, please try again.
** [74.63*** :: err] Permission denied (publickey,gssapi-with-mic,password).
** [74.63*** :: err] fatal: The remote end hung up unexpectedly
** [74.63*** :: err] fetch-pack from 'my_account_name@74.63***:/home/my_account_name/git/my_app' failed.
   command finished
 * executing `deploy:finalize_update'
 * executing "chmod -R g+w /home/my_account_name/apps/my_app/releases/20080815062754"
   servers: ["74.63***"]
   [74.63***] executing command
*** [err :: 74.63***] chmod: cannot access `/home/my_account_name/apps/my_app/releases/20080815062754': No such file or directory
   command finished
....

__________________

Seems like it does not allow me to access /home/my_account_name/git/my_app on the server.
But if I ssh to the server I am able to ssh again from the server the same server.



2008-08-15 01:57 AM

Hi

Are you suing any ssh keys ? If so, could you try after removing it ?

2008-08-15 04:26 AM

At first I had no luck.
After that I ssh-ed from the server to the same server and it produced a ssh-key for me, but deploying was no luck anyway.

2008-08-15 04:38 AM

Could you check again?

2008-08-15 04:52 AM

Password:
   [74.63.***] executing command
** [74.63.*** :: err] Host key verification failed.
** [74.63.*** :: err] fatal: The remote end hung up unexpectedly
** [74.63.*** :: err] fetch-pack from 'my_name@74.63.***:/home/my_name/git/my_app' failed.
   command finished

:(

2008-08-15 05:31 AM

Hi Shilin,

Please give a try after creating the ssh keys again.
Also make sure that your config/deploy.rb file contains the following line

===
ssh_options[:keys] = %w(/Path/To/id_rsa)
===

Here "/Path/To/id_rsa" is the location of the location of the public key saved on the server.

Are you facing any issues to cap deploy without using ssh keys? If you don't want to use ssh keys then you  have to remove the private key saved on your local machine and public key saved on server.

Ps: Remove the entry "ssh_options[:keys] = %w(/Path/To/id_rsa)" from config/deploy.rb file while trying to cap deploy without using ssh keys.  

2008-08-15 08:56 AM

74.63.*** - is the server ip on hostingrails. It was given to me in the email I received after signing up a shared account.

here is my deploy.rb:
__________________________________
set :application, "my_app"
set :domain, "74.63.***"
set :user, "my_user_name"
set :repository,  "#{user}@#{domain}:/home/#{user}/git/#{application}"
ssh_options[:keys] = %w(/home/my_user_name/.ssh)
set :scm, :git
set :scm_username, user
set :runner, user
set :use_sudo, false
set :branch, "master"
set :deploy_via, :checkout
set :git_shallow_clone, 1
set :deploy_to, "/home/#{user}/apps/#{application}"
set :chmod755, "app config db lib public vendor script script/* public/disp*"
set :mongrel_port, "4088"
set :mongrel_nodes, "1"
#default_run_options[:pty] = true
role :app, domain
role :web, domain
role :db,  domain, :primary => true
________________________________________

my git repository on the server 74.63.*** is at /home/my_user_name/git/my_app

I git push to that repository from my local one.

When I try to deploy from my local box without 'ssh_options[:keys]= ...' and clearing up ~/.ssh/known_hosts on the server (no other files in that directory) here is what I get

__________________________
Password:
   [74.63.***] executing command
** [74.63.*** :: err] Host key verification failed.
** [74.63.*** :: err] fatal: The remote end hung up unexpectedly
** [74.63.*** :: err] fetch-pack from 'my_user_name@74.63***:/home/my_user_name/git/my_app' failed.
____________________________

When I ssh to 74.63.*** and being there ssh again to 74.63.*** it populates ~/.ssh/known_hosts and lets me ssh to 74.63.*** while being on the same 74.63.***

After that, if I try to deploy from my local box the terminal spits out
______________
** [74.63*** :: err] Permission denied, please try again.
** [74.63*** :: err] Permission denied, please try again.
** [74.63*** :: err] Permission denied (publickey,gssapi-with-mic,password).
_____________________

At the moment I think that capistrano tries to use ssh and I don't know how to make it use the repository which is on the same server, there is no need tu use ssh, just take it from the file system.

Another thought is that capistrano needs some ssh keys located on the server. But only thing I can do is to populate known_hosts with
________
74.63.*** ssh-rsa AAAAB3NzaC1yc2EAAAABI......
________

Maybe I have to generate some keys on the server, I am confused.

2008-08-19 12:12 AM

I could see that you have not generated any SSH keys. For generating SSH keys proceed as follows on your server.

----------------------
user@<yourdomain.com> [~]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_dsa):     # Press 'enter' here
Enter passphrase (empty for no passphrase):     # Press 'enter' here
Enter same passphrase again:     # Press 'enter' here
Your identification has been saved in /home/user/.ssh/id_dsa.
Your public key has been saved in /home/user/.ssh/id_dsa.pub.
The key fingerprint is:
6f:c3:cb:50:e6:e9:90:f0:0f:68:d2:10:56:eb:1d:91

user@<yourdomain.com> [~]# ssh-copy-id -i ~/.ssh/id_dsa.pub user@'74.63.***'
----------------------

Once the above mentioned steps are done you'll be able to ssh to server from the server without using the password.

2008-08-19 02:29 AM

Thank you, Santhi! All is working now :)

My server repository is at /home/my_user_name/git/my_app.git

I push to that directory from my local repository.

Here is my deploy.rb for those experiencing the same deploy problems.

________________________________
set :application, "my_app"
set :domain, "74.63.**"
set :user, "my_user_name"

set :repository,  "file:///home/#{user}/git/#{application}"
set :local_repository, "#{user}@#{domain}:/home/#{user}/git/#{application}.git"

set :scm, :git
set :scm_username, user
set :runner, user
set :use_sudo, false
set :branch, "master"
set :deploy_via, :checkout
set :git_shallow_clone, 1
set :deploy_to, "/home/#{user}/apps/#{application}"
set :chmod755, "app config db lib public vendor script script/* public/disp*"
set :mongrel_port, "4088"
set :mongrel_nodes, "1"
default_run_options[:pty] = true
role :app, domain
role :web, domain
role :db,  domain, :primary => true
_________________________________________

2008-08-20 12:42 AM

Glad that its sorted out. Thank you for pasting the deploy.rb here.

2008-08-20 12:57 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.