I just deployed an old project using my capistrano and it deployed ok but I need to rollback. When I try to roll back using the command 'cap deploy:rollback' I get this error:
[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was before_update_code)
[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was after_update_code)
* executing `deploy:rollback'
* executing `deploy:rollback:revision'
* executing "ls -x /home/<my user>/<my project>/releases"
servers: ["www.my_webserver.com"]
[www.my_webserver.com] executing command
command finished
* executing "rm /home/<my user>/<my project>/current; ln -s /home/<my user>/<my project>/releases/20121023110110 /home/<my user>/<my project>/current"
servers: ["www.my_webserver.com"]
[www.my_webserver.com] executing command
command finished
triggering after callbacks for `deploy:rollback:revision'
* executing `bundler:install'
* executing "cd /home/<my user>/<my project>/releases/20121023112609 && bundle install"
servers: ["www.my_webserver.com"]
[www.my_webserver.com] executing command
** [out :: www.my_webserver.com] bash: line 0: cd: /home/<my user>/<my project>/releases/20121023112609: No such file or directory
command finished
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.2' -c 'cd /home/<my user>/<my project>/releases/20121023112609 && bundle install'" on www.my_webserver.com
If I start 'cap shell' and have a quick look I cannot find the 20121023112609 directory which it's looking for.
cap> ls -x /home/<my user>/<my project>/releases
** [out :: www.my_webserver.com] 20120418231223 20120419004108 20120421030033 20120422072111 20120422101603
** [out :: www.my_webserver.com] 20120526035027 20120526113216 20120528100439 20120528102509 20120528135335
** [out :: www.my_webserver.com] 20120604090722 20120724142113 20121008114048 20121008114947 20121008125600
** [out :: www.my_webserver.com] 20121015121531 20121015122225 20121023110110 20121023111648
I can see my latest deploy is there but it's called '20121023111648' and the previous deploy which I want to revert back to is called '20121023110110'.
It seems like there is a time difference or something?
Look at your answer here railsless-deploy
cap deploy:rollback
Run the above command for rollback.
Related
Dont know what happened. i have deployed code to my server 3 times today and now i get this error.
* ←[33mexecuting "cd -- /home/deployer/loadmax/releases/20140404020322 && bund
le exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile && cp --
/home/deployer/loadmax/shared/assets/manifest.yml /home/deployer/loadmax/releas
es/20140404020322/assets_manifest.yml"←[0m
servers: ["108.235.52.160"]
[108.235.52.160] executing command
** [out :: 108.235.52.160] rake aborted!
** [out :: 108.235.52.160] /home/deployer/loadmax/releases/20140404020322/app/a
ssets/stylesheets/application.css has already been required
** [out :: 108.235.52.160]
** [out :: 108.235.52.160] Tasks: TOP => assets:precompile:primary
** [out :: 108.235.52.160] (See full trace by running task with --trace)
←[2;37mcommand finished in 51582ms←[0m
*** [←[34mdeploy:update_code←[0m] ←[34mrolling back←[0m
* ←[33mexecuting "rm -rf /home/deployer/loadmax/releases/20140404020322; true"
←[0m
servers: ["108.235.52.160"]
[108.235.52.160] executing command
←[2;37mcommand finished in 838ms←[0m
failed: "sh -c 'cd -- /home/deployer/loadmax/releases/20140404020322 && bundle e
xec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile && cp -- /ho
me/deployer/loadmax/shared/assets/manifest.yml /home/deployer/loadmax/releases/2
0140404020322/assets_manifest.yml'" on 108.235.52.160
Here is the line assets_manifest.yml file
---
application.css: application-cbe5df2fd54e4a120dc4a78c89b723d3.css
Apparently Ruby mines added in several files that it thought i was missing
I am trying to deploy a rails application to the rackspace server via capistrano. I have deployed many Rails application to Rackspace and Linode server and never encountered such weird issue. The capistrano is not deploying the application and below is the log :
executing `deploy:assets:precompile'
* executing "cd /home/deployer/apps/latty39/releases/20121023165957 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["50.56.183.16"]
[50.56.183.16] executing command
** [out :: 50.56.183.16] rake aborted!
** [out :: 50.56.183.16] cannot load such file -- Date
** [out :: 50.56.183.16]
** [out :: 50.56.183.16] (See full trace by running task with --trace)
command finished in 7454ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deployer/apps/latty39/releases/20121023165957; true"
servers: ["50.56.183.16"]
[50.56.183.16] executing command
command finished in 2001ms
failed: "sh -c 'cd /home/deployer/apps/latty39/releases/20121023165957 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on 50.56.183.16
I have no idea why this is failing. I have almost spent 3 hours on this thing and no success so far. Have search stackoverflow and other resources but no help.
Any help to resolve the issue will be highly appreciated
Thanks
I figured it out myself. I was having a custom rake task which was requiring ruby Date Class like:
require 'Date'
Removed it and all fixed. But I do not need to figure out why requiring the date class in production throws error.
I am new to deploying rails websites using capistrano.
I pushed my changes to the git repository successfully without getting any error.
Now I need to push the same changes to the production server using Capistrano.
When I run cap deploy I get the following error:
urjit#urjit-Lenovo:~/workspace/dev$ cap deploy
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote git#github.com:devrepublicrep/devcockpit.git HEAD"
/usr/bin/git
* executing "git clone -q git#github.com:devrepublicrep/devcockpit.git /home/devcockpit/releases/20120820062500 && cd /home/devcockpit/releases/20120820062500 && git checkout -q -b deploy c51262dbb81a66f307127c85add0786552c03cad && (echo c51262dbb81a66f307127c85add0786552c03cad > /home/devcockpit/releases/20120820062500/REVISION)"
servers: ["dev.devrepublic.nl"]
Password:
[dev.devrepublic.nl] executing command
** [dev.devrepublic.nl :: err] error: git-checkout-index: unable to write file public/javascripts/ckeditor/_source/plugins/embed/dialogs/embed.js
** [dev.devrepublic.nl :: err] fatal: cannot create directory at public/javascripts/ckeditor/_source/skins/v2/images
** [dev.devrepublic.nl :: err] fatal: Untracked working tree file '.gitignore' would be overwritten by merge.
command finished
*** [deploy:update_code] rolling back
* executing "rm -rf /home/devcockpit/releases/20120820062500; true"
servers: ["dev.devrepublic.nl"]
[dev.devrepublic.nl] executing command
command finished
failed: "sh -c 'git clone -q git#github.com:devrepublicrep/devcockpit.git /home/devcockpit/releases/20120820062500 && cd /home/devcockpit/releases/20120820062500 && git checkout -q -b deploy c51262dbb81a66f307127c85add0786552c03cad && (echo c51262dbb81a66f307127c85add0786552c03cad > /home/devcockpit/releases/20120820062500/REVISION)'" on dev.devrepublic.nl
Please Help me.
Thanks.
I got the answer need to clean up some space.
so I ran cap deploy:cleanup command.
Deploying an app first time with Capistrano, but having problem running the cap deploy:update task on Rails 3.1.3, Capistrano 2.9.0, RVM 1.8.6 and Ubuntu server 10.10. Should not be a permissions issue as far as I can see. Been banging my head against this now for a while, thankful for any directions.
drphil#mumindalen:~/Rails/testapp$ cap deploy:update
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote git#my_server:~/testapp/ HEAD"
git#23.23.23.23.'s password:
command finished in 8892ms
* executing "git clone -q git#my_server:~/testapp/ /home/deploy/testapp/releases/20111211183654 && cd /home/deploy/testapp/releases/20111211183654 && git checkout -q -b deploy f473e207b15d73d2fa9aa32ab1dbeec98471153d && (echo f473e207b15d73d2fa9aa32ab1dbeec98471153d > /home/deploy/testapp/releases/20111211183654/REVISION)"
servers: ["my_server"]
Password:
[my_server] executing command
command finished in 1695ms
* executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* executing `deploy:assets:symlink'
* executing "rm -rf /home/deploy/testapp/releases/20111211183654/public/assets &&\\\n mkdir -p /home/deploy/testapp/releases/20111211183654/public &&\\\n mkdir -p /home/deploy/testapp/shared/assets &&\\\n ln -s /home/deploy/testapp/shared/assets /home/deploy/testapp/releases/20111211183654/public/assets"
servers: ["my_server"]
[my_server] executing command
command finished in 1117ms
* executing "chmod -R g+w /home/deploy/testapp/releases/20111211183654"
servers: ["my_server"]
[my_server] executing command
command finished in 614ms
* executing "rm -rf /home/deploy/testapp/releases/20111211183654/log /home/deploy/testapp/releases/20111211183654/public/system /home/deploy/testapp/releases/20111211183654/tmp/pids &&\\\n mkdir -p /home/deploy/testapp/releases/20111211183654/public &&\\\n mkdir -p /home/deploy/testapp/releases/20111211183654/tmp &&\\\n ln -s /home/deploy/testapp/shared/log /home/deploy/testapp/releases/20111211183654/log &&\\\n ln -s /home/deploy/testapp/shared/system /home/deploy/testapp/releases/20111211183654/public/system &&\\\n ln -s /home/deploy/testapp/shared/pids /home/deploy/testapp/releases/20111211183654/tmp/pids"
servers: ["my_server"]
[my_server] executing command
command finished in 1022ms
* executing "find /home/deploy/testapp/releases/20111211183654/public/images /home/deploy/testapp/releases/20111211183654/public/stylesheets /home/deploy/testapp/releases/20111211183654/pu## Heading ##blic/javascripts -exec touch -t 201112111837.12 {} ';'; true"
servers: ["my_server"]
[my_server] executing command
*** [err :: my_server] find:
*** [err :: my_server] "/home/deploy/testapp/releases/20111211183654/public/images"
*** [err :: my_server] : Filen eller katalogen finns inte
*** [err :: my_server]
*** [err :: my_server] find:
*** [err :: my_server] "/home/deploy/testapp/releases/20111211183654/public/stylesheets"
*** [err :: my_server] : Filen eller katalogen finns inte
*** [err :: my_server]
*** [err :: my_server] find:
*** [err :: my_server] "/home/deploy/testapp/releases/20111211183654/public/javascripts"
*** [err :: my_server] : Filen eller katalogen finns inte
*** [err :: my_server]
command finished in 1024ms
triggering after callbacks for `deploy:update_code'
* executing `deploy:assets:precompile'
* executing "cd /home/deploy/testapp/releases/20111211183654 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["my_server"]
[my_server] executing command
*** [err :: my_server] sh:
*** [err :: my_server] rake: not found
*** [err :: my_server]
command finished in 1440ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deploy/testapp/releases/20111211183654; true"
servers: ["my_server"]
[my_server] executing command
command finished in 727ms
failed: "sh -c 'cd /home/deploy/testapp/releases/20111211183654 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on my_server
It was an issue with different versions of RVM on the development box and the server and that I had not set up deploy.rb properly to work with RVM. Been digging around for hours thinking it was some kind of bug. Oh well.
Got it working using this in deploy.rb:
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.2-p290'
set :rvm_type, :user
It could't find rake binary.
If you are using RVM, make sure the user which you are deploying as is in rvm group.
Or, most likely (or in combination with the above), you have .bashrc / bashrc / profile environment disabled for non-interactive shells. Thus it doesn't load all configuration (set PATH etc.).
See http://lists.apple.com/archives/macos-x-server/2008/Jun/msg00251.html
Debian (/etc/bashrc):
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
...and so on.
The last line is the problem. It quits processing bashrc for non-interactive shells.
Look for something similar on your system.
UPDATE:
There is an overview of shell scripts that are processed on debian squeeze:
http://www.fam.tuwien.ac.at/~schamane/_/blog:110814_bash_shell_startup_files_in_debian_squeeze
I'm deploying to a Debian 6 server, with Apache, Passenger, Ruby1.9.1
When I run "cap deploy" or "cap deploy:migrations" I get this error:
[out :: ip.address] Could not find multi_json-1.0.3 in any of the sources
** [out :: ip.address] Run `bundle install` to install missing gems.
** [out :: ip.address]
command finished in 1037ms
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/releases/20111208004427; true"
servers: ["ip.address"]
[ip.address] executing command
command finished in 489ms
failed: "sh -c 'cd /var/www/releases/20111208004427 && /usr/bin/rake1.9.1 RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on ip.address
Note the run bundle install to install missing gems and failed sh -c ... part.
I already tried this export PATH=/var/lib/gems/1.9.1/bin:${PATH} and tried many other possible solutions but nothing seems to work.
By the way, NO rvm.
Make sure that your config/deploy.rb file is including Bundler's capistrano tasks with this line:
require 'bundler/capistrano'
This will tell it to run bundle install after updating your code, but before it runs other tasks like rake assets:precompile.
For reference for everybody else getting the same error. Found answer: http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/