Error in cap deploy command

35 views
Skip to first unread message

Mandeep Kaur

unread,
Oct 8, 2012, 11:17:35 AM10/8/12
to rubyonra...@googlegroups.com
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 g...@github.com:megha55/mysite.git master"
command finished in 4912ms
* executing "git clone -q g...@github.com: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 g...@github.com: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 Kaur
http://mandeepsimak.wordpress.com/

Peter Hickman

unread,
Oct 8, 2012, 11:22:12 AM10/8/12
to rubyonra...@googlegroups.com
It cannot create /u/apps/mysite/releases/20121008150536 because the
permissions are wrong. Start at /u/apps/mysite and work down checking
the permissions

Mandeep Kaur

unread,
Oct 8, 2012, 11:26:39 AM10/8/12
to rubyonra...@googlegroups.com
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 g...@github.com: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 g...@github.com: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 g...@github.com: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

Ilia Bylich

unread,
Oct 8, 2012, 11:28:58 AM10/8/12
to rubyonra...@googlegroups.com
Try this in your deploy.rb

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

понедельник, 8 октября 2012 г., 18:18:39 UTC+3 пользователь Mandy написал:

Mandeep Kaur

unread,
Oct 8, 2012, 11:37:26 AM10/8/12
to rubyonra...@googlegroups.com
On Mon, Oct 8, 2012 at 8:58 PM, Ilia Bylich <iby...@gmail.com> 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?
----------------------------------------------------------------------------------

$ 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 g...@github.com: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 g...@github.com: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'

Ilia Bylich

unread,
Oct 8, 2012, 11:54:21 AM10/8/12
to rubyonra...@googlegroups.com
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 :)

понедельник, 8 октября 2012 г., 18:18:39 UTC+3 пользователь Mandy написал:
Hello to all!

Mandeep Kaur

unread,
Oct 8, 2012, 12:16:00 PM10/8/12
to rubyonra...@googlegroups.com
On Mon, Oct 8, 2012 at 9:24 PM, Ilia Bylich <iby...@gmail.com> wrote:
> 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

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

Ilia Bylich

unread,
Oct 8, 2012, 12:21:17 PM10/8/12
to rubyonra...@googlegroups.com
This page means error in rails. Look at your log/production.log.


понедельник, 8 октября 2012 г., 18:18:39 UTC+3 пользователь Mandy написал:
Hello to all!

Mandeep Kaur

unread,
Oct 8, 2012, 12:28:33 PM10/8/12
to rubyonra...@googlegroups.com
On Mon, Oct 8, 2012 at 9:51 PM, Ilia Bylich <iby...@gmail.com> 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 Kaur

unread,
Oct 8, 2012, 12:52:46 PM10/8/12
to rubyonra...@googlegroups.com
On Mon, Oct 8, 2012 at 9:58 PM, Mandeep Kaur <megha...@gmail.com> wrote:
> On Mon, Oct 8, 2012 at 9:51 PM, Ilia Bylich <iby...@gmail.com> 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
>

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 Kaur

unread,
Oct 8, 2012, 1:20:25 PM10/8/12
to rubyonra...@googlegroups.com
On Mon, Oct 8, 2012 at 10:22 PM, Mandeep Kaur <megha...@gmail.com> wrote:
> On Mon, Oct 8, 2012 at 9:58 PM, Mandeep Kaur <megha...@gmail.com> wrote:
>> On Mon, Oct 8, 2012 at 9:51 PM, Ilia Bylich <iby...@gmail.com> 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 Kaur

unread,
Oct 11, 2012, 10:00:22 PM10/11/12
to rubyonra...@googlegroups.com
Thanks to all for helping me. Problem Solved : ).
Reply all
Reply to author
Forward
0 new messages