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 git@github.com:megha55/mysite.git master"
command finished in 4912ms
* executing "git clone -q git@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 git@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.
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 git@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 git@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 git@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
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?
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
I have used passenger and write namespace for that but still having
same result in browser.
"We're sorry, but something went wrong."
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?
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.
Now cap deploy:migrations command works fine.
but still browser shows same message.
and production.log has mysql error.
Thanks to all for helping me. Problem Solved : ).