Error in cap deploy command

Hello to all!

I am getting following error while running cap deploy in terminal.

$ cap deploy

  • executing `deploy’
  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
    executing locally: “git ls-remote [email protected]:megha55/mysite.git
    master”
    command finished in 4912ms
  • executing “git clone -q [email protected]:megha55/mysite.git
    /u/apps/mysite/releases/20121008150536 && cd
    /u/apps/mysite/releases/20121008150536 && git checkout -q -b deploy
    d8c68e8142039f19b36669692144825715bc129a && (echo
    d8c68e8142039f19b36669692144825715bc129a >
    /u/apps/mysite/releases/20121008150536/REVISION)”
    servers: [“simak”]
    Password:
    [simak] executing command
    ** [simak :: out] fatal: could not create work tree dir
    ‘/u/apps/mysite/releases/20121008150536’.: Permission denied
    command finished in 240ms
    *** [deploy:update_code] rolling back
  • executing “rm -rf /u/apps/mysite/releases/20121008150536; true”
    servers: [“simak”]
    [simak] executing command
    command finished in 9ms
    failed: “sh -c ‘git clone -q [email protected]:megha55/mysite.git
    /u/apps/mysite/releases/20121008150536 && cd
    /u/apps/mysite/releases/20121008150536 && git checkout -q -b deploy
    d8c68e8142039f19b36669692144825715bc129a && (echo
    d8c68e8142039f19b36669692144825715bc129a >
    /u/apps/mysite/releases/20121008150536/REVISION)’” on simak

I also gave permissions to this application but still having same error.
Please help me to solve this error.


Mandeep K.

It cannot create /u/apps/mysite/releases/20121008150536 because the
permissions are wrong. Start at /u/apps/mysite and work down checking
the permissions

On Mon, Oct 8, 2012 at 8:52 PM, Peter H.
[email protected] wrote:

It cannot create /u/apps/mysite/releases/20121008150536 because the
permissions are wrong. Start at /u/apps/mysite and work down checking
the permissions

Ok.

Now I am getting following error:

$ cap deploy

  • executing `deploy’
  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
    updating the cached checkout on all servers
    executing locally: “git ls-remote [email protected]:megha55/mysite.git
    master”
    command finished in 7283ms
  • executing “if [ -d ~/public_html/mysite/shared/cached-copy ]; then
    cd ~/public_html/mysite/shared/cached-copy && git fetch -q origin &&
    git fetch --tags -q origin && git reset -q --hard
    d8c68e8142039f19b36669692144825715bc129a && git clean -q -d -x -f;
    else git clone -q [email protected]:megha55/mysite.git
    ~/public_html/mysite/shared/cached-copy && cd
    ~/public_html/mysite/shared/cached-copy && git checkout -q -b deploy
    d8c68e8142039f19b36669692144825715bc129a; fi”
    servers: [“simak”]
    Password:
    [simak] executing command
    ** [simak :: out] Permission denied (publickey).
    ** fatal: The remote end hung up unexpectedly
    command finished in 3211ms
    *** [deploy:update_code] rolling back
  • executing “rm -rf ~/public_html/mysite/releases/20121008152314;
    true”
    servers: [“simak”]
    [simak] executing command
    command finished in 10ms
    failed: “sh -c ‘if [ -d ~/public_html/mysite/shared/cached-copy ];
    then cd ~/public_html/mysite/shared/cached-copy && git fetch -q origin
    && git fetch --tags -q origin && git reset -q --hard
    d8c68e8142039f19b36669692144825715bc129a && git clean -q -d -x -f;
    else git clone -q [email protected]:megha55/mysite.git
    ~/public_html/mysite/shared/cached-copy && cd
    ~/public_html/mysite/shared/cached-copy && git checkout -q -b deploy
    d8c68e8142039f19b36669692144825715bc129a; fi’” on simak

And Cap deploy:setup works without any error. Check its result:

cap deploy:setup

  • executing `deploy:setup’
  • executing “mkdir -p ~/public_html/mysite
    ~/public_html/mysite/releases ~/public_html/mysite/shared
    ~/public_html/mysite/shared/system ~/public_html/mysite/shared/log
    ~/public_html/mysite/shared/pids”
    servers: [“simak”]
    Password:
    [simak] executing command
    command finished in 237ms
  • executing “chmod g+w ~/public_html/mysite
    ~/public_html/mysite/releases ~/public_html/mysite/shared
    ~/public_html/mysite/shared/system ~/public_html/mysite/shared/log
    ~/public_html/mysite/shared/pids”
    servers: [“simak”]
    [simak] executing command
    command finished in 10ms


Mandeep K.

On Mon, Oct 8, 2012 at 8:58 PM, Ilia B. [email protected] wrote:

Try this in your deploy.rb

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

Now it give result without error. Check its o/p below signature.

But my application is not started. I got following error when I open
domain(simak) in browser.
Is there any step to start rails app with capistrano which i was
missing?


Mandeep K.


$ cap deploy

  • executing `deploy’
  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
    updating the cached checkout on all servers
    executing locally: “git ls-remote [email protected]:megha55/mysite.git
    master”
    command finished in 5377ms
  • executing “if [ -d ~/public_html/mysite/shared/cached-copy ]; then
    cd ~/public_html/mysite/shared/cached-copy && git fetch -q origin &&
    git fetch --tags -q origin && git reset -q --hard
    d8c68e8142039f19b36669692144825715bc129a && git clean -q -d -x -f;
    else git clone -q [email protected]:megha55/mysite.git
    ~/public_html/mysite/shared/cached-copy && cd
    ~/public_html/mysite/shared/cached-copy && git checkout -q -b deploy
    d8c68e8142039f19b36669692144825715bc129a; fi”
    servers: [“simak”]
    Password:
    [simak] executing command
    command finished in 6903ms
    copying the cached version to
    ~/public_html/mysite/releases/20121008153222
  • executing “cp -RPp ~/public_html/mysite/shared/cached-copy
    ~/public_html/mysite/releases/20121008153222 && (echo
    d8c68e8142039f19b36669692144825715bc129a >
    ~/public_html/mysite/releases/20121008153222/REVISION)”
    servers: [“simak”]
    [simak] executing command
    command finished in 24ms
  • executing `deploy:finalize_update’
  • executing “chmod -R g+w
    ~/public_html/mysite/releases/20121008153222”
    servers: [“simak”]
    [simak] executing command
    command finished in 12ms
  • executing “rm -rf
    ~/public_html/mysite/releases/20121008153222/public/system && mkdir -p
    ~/public_html/mysite/releases/20121008153222/public/”
    servers: [“simak”]
    [simak] executing command
    command finished in 11ms
  • executing “ln -s ~/public_html/mysite/shared/system
    ~/public_html/mysite/releases/20121008153222/public/system”
    servers: [“simak”]
    [simak] executing command
    command finished in 9ms
  • executing “rm -rf ~/public_html/mysite/releases/20121008153222/log”
    servers: [“simak”]
    [simak] executing command
    command finished in 10ms
  • executing “ln -s ~/public_html/mysite/shared/log
    ~/public_html/mysite/releases/20121008153222/log”
    servers: [“simak”]
    [simak] executing command
    command finished in 9ms
  • executing “rm -rf
    ~/public_html/mysite/releases/20121008153222/tmp/pids && mkdir -p
    ~/public_html/mysite/releases/20121008153222/tmp/”
    servers: [“simak”]
    [simak] executing command
    command finished in 11ms
  • executing “ln -s ~/public_html/mysite/shared/pids
    ~/public_html/mysite/releases/20121008153222/tmp/pids”
    servers: [“simak”]
    [simak] executing command
    command finished in 9ms
  • executing “find
    ~/public_html/mysite/releases/20121008153222/public/images
    ~/public_html/mysite/releases/20121008153222/public/stylesheets
    ~/public_html/mysite/releases/20121008153222/public/javascripts -exec
    touch -t 201210081532.22 {} ‘;’; true”
    servers: [“simak”]
    [simak] executing command
    ** [out :: simak] find:
    /home/mandy/public_html/mysite/releases/20121008153222/public/images': No such file or directory ** [out :: simak] find: /home/mandy/public_html/mysite/releases/20121008153222/public/stylesheets’:
    No such file or directory
    ** [out :: simak] find:
    `/home/mandy/public_html/mysite/releases/20121008153222/public/javascripts’:
    No such file or directory
    command finished in 13ms
  • executing `deploy:create_symlink’
  • executing “rm -f ~/public_html/mysite/current && ln -s
    ~/public_html/mysite/releases/20121008153222
    ~/public_html/mysite/current”
    servers: [“simak”]
    [simak] executing command
    command finished in 11ms
    ** transaction: commit
  • executing `deploy:restart’

Try this in your deploy.rb

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

, 8 2012 ., 18:18:39 UTC+3 Mandy :

As you can see, your task deploy:restart is empty. You should restart
your web server (like unicorn or passenger) in this task. You can define
it
like this

namespace :deploy do
desc “Restart Unicorn”
task :restart do
run “if [ -f #{unicorn_pid} ] && [ -e /proc/$(cat #{unicorn_pid}) ];
then kill -USR2 cat #{unicorn_pid}; else cd #{release_path} && bundle
exec unicorn_rails -c #{unicorn_conf} -E #{rails_env} -D; fi”
end
end

Or just try to find this recipe in google :slight_smile:

, 8 2012 ., 18:18:39 UTC+3 Mandy :

This page means error in rails. Look at your log/production.log.

, 8 2012 ., 18:18:39 UTC+3 Mandy :

On Mon, Oct 8, 2012 at 9:24 PM, Ilia B. [email protected] wrote:

end
end

I have used passenger and write namespace for that but still having
same result in browser.
“We’re sorry, but something went wrong.”


Mandeep K.

On Mon, Oct 8, 2012 at 9:58 PM, Mandeep K. [email protected]
wrote:

rake RAILS_ENV=production db:migrate’" on simak

I have also tried to login to mysql and it works. database.yml file
was also correct.
Now please tell me where’s the problem.


Mandeep K.

On Mon, Oct 8, 2012 at 10:22 PM, Mandeep K. [email protected]
wrote:

On Mon, Oct 8, 2012 at 9:58 PM, Mandeep K. [email protected] wrote:

On Mon, Oct 8, 2012 at 9:51 PM, Ilia B. [email protected] wrote:

This page means error in rails. Look at your log/production.log.

this file has following error;
Mysql2::Error (Access denied for user ‘root’@‘localhost’ (using password: NO)):

Now cap deploy:migrations command works fine.
but still browser shows same message.

and production.log has mysql error.


Mandeep K.

On Mon, Oct 8, 2012 at 9:51 PM, Ilia B. [email protected] wrote:

This page means error in rails. Look at your log/production.log.

this file has following error;
Mysql2::Error (Access denied for user ‘root’@‘localhost’ (using
password: NO)):

And when i run cap deploy:migrations the i got following error:

failed: “sh -c ‘cd ~/public_html/mysite/releases/20121008162802 &&
rake RAILS_ENV=production db:migrate’” on simak

Now what i have to do?


Mandeep K.

Thanks to all for helping me. Problem Solved : ).


Mandeep K.