Made a large update last night and my site is currently down. I used cap deploy:rollback with no luck. The error logs aren't telling me much. The last error I saw when trying to deploy was:
** [out :: website.com] You are trying to install in deployment mode after changing
** [out :: website.com] your Gemfile. Run `bundle install` elsewhere and add the
** [out :: website.com] updated Gemfile.lock to version control.
** [out :: website.com]
** [out :: website.com] You have deleted from the Gemfile:
** [out :: website.com] * asset_sync
command finished in 934ms
My cap tail just says the following with no errors:
Migrating to AddSessionsTable (20120722094547)
Migrating to AddSlugToUserProjects (20120723204816)
Migrating to AddSlugIndexToUserProjects (20120723205558)
Migrating to CreateFriendlyIdSlugs (20120723210904)
Migrating to AddNameToUsers (20120723221700)
Migrating to AddSlugToUsers (20120723222456)
Migrating to CreateComments (20120724203252)
Any help?
Run bundle install on your development server, then cap deploy. Another possible solution: add asset_sync back to your Gemfile.
As last resort, you can run cap -d deploy. It will run deployment step-by-step, asking you for continue on each step. Login to production server in separate shell and do some adjustments between steps manually.
It looks like the Gemfile change didn't go well. How it was fixed:
logged into server, there were 6 ruby processes that were taking all available things. This is almost certainly the unicorn processes trying to start and couldn't… killall -9 ruby
cd into the app's current directory
RAILS_ENV=production bundle exec rake assets:precompile
service unicorn_whimseybox start
It looks like (in the unicorn.log), the error was:
E, [2012-07-26T17:27:10.552912 #24818] ERROR -- : uninitialized constant AssetSync (NameError)
I had the same error after converting some Gemfile source lines into blocks.
The error was due an old Bundler version on production (1.7.3) vs 1.8.3 on development.
Related
I have a Ruby on Rails web application that I am trying to deploy.
When I try to deploy it, it gets a little ways, and then stops with the following error:
** [out :: rails-rn-dev.sandia.gov] You have requested:
** [out :: rails-rn-dev.sandia.gov] capybara = 2.1.0
** [out :: rails-rn-dev.sandia.gov]
** [out :: rails-rn-dev.sandia.gov] The bundle currently has capybara locked at 2.2.1.
I can't figure out how this is happening. I know that both my Gemfile and my Gemfile.lock files specify capybara version 2.1.0 be used.
So, why is the bundle locking capybara at 2.2.1?
Thanks in advance,
Tim
I'm deploying to a VPS using capistrano, based on the guide at RailsCasts.
http://railscasts.com/episodes/335-deploying-to-a-vps?view=asciicast
It's failing on the deploy:cold command, with a conflict with Ruby. I actually can't see what the problem is, as when I shell into the same user the Ruby version looks correct.
$ cap shell
cap> which ruby
[establishing connection(s) to 192.xxx.xxx.xxx]
** [out :: 192.xxx.xxx.xxx] /home/deployer/.rbenv/shims/ruby
cap> ruby -v
** [out :: 192.xxx.xxx.xxx ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
This is the error:
command finished in 655ms
* 2013-07-01 16:40:39 executing `bundle:install'
* executing "cd /home/deployer/rails/assay/releases/20130701144038 && bundle install -- gemfile /home/deployer/rails/assay/releases/20130701144038/Gemfile --path /home/deployer/rails/assay/shared/bundle --deployment --quiet --without development test"
servers: ["192.xxx.xxx.xxx"]
[192.xxx.xxx.xxx] executing command
** [out :: 192.xxx.xxx.xxx] rbenv: version `1.9.3' is not installed
command finished in 662ms
*** [deploy:update_code] rolling back
My question is: how can I debug this? When I read the deploy.rb file I can't see where it even references the Ruby version. Pretty frustrating, I am about ready to ftp the repo up, which is not ideal obviously.
Well I finally got to the bottom of the issue - a mismatch between ruby versions use by Capistrano and what was actually on the server.
To debug Capistrano run it like this:
cap deploy:cold -d
That was you can step through the commands and access the temporary directories on the remote server before they are deleted.
I just had similar issue, the reason was .ruby-version file pointing at 1.9.3 (file was generated by rails-composer), while there was 1.9.3-p392 installed via rbenv on remote machine.
Debug info of capistrano can be shown by tail -f log/capistrano.log.
I'm getting this error when running this capistrano task (my own - cap deploy:show_pointers):
* executing `deploy:show_pointers'
* executing "cd /home/mydomain/public_html/site_folders/rails/current; rake app:show_pointers"
servers: ["mydomain.net"]
[mydomain.net] executing command
** [out :: mydomain.net] (in /home/mydomain/public_html/site_folders/rails/releases/20120521025150)
** [out :: mydomain.net] Could not find rake-0.9.2 in any of the sources
** [out :: mydomain.net] Try running `bundle install`.
command finished in 1584ms
failed: "sh -c 'cd /home/mydomain/public_html/site_folders/rails/current; rake app:show_pointers'" on mydomain.net
However when I run
sh -c 'cd /home/mydomain/public_html/site_folders/rails/current; rake app:show_pointers
manually from the same dir that capistrano logs into, it works. I have capistrano set to NOT USE sudo, so that shouldn't be the issue, but it sounds like it might be, since the above command fails with sudo. I think this is a user issue, or maybe an environment var issue. Or I'm not sure what.
Any suggestsions. This is a task that is already a rake task, but it will help me not to have to log into the server every time I run it (and about 10 more like it).
Appreciate any help on this.
manually from the same dir that capistrano logs into, it works.
That doesn't say anything, Capistrano creates a non-login tty, which means that your profile, dot-files, etc are not run.
ssh root#example.de -t /bin/sh
This is a more reliable way to compare environments to Capistrano, (although, even this is a little more full-featured than what Capistrano is using.
Given these error messages, I have a couple ideas:
** [out :: mydomain.net] Could not find rake-0.9.2 in any of the sources
** [out :: mydomain.net] Try running `bundle install`.
The app can't find the rake command. Have you tried to run bundle install on the remote machine as its recommending?
Another option might be to change the command to
cd /home/mydomain/public_html/site_folders/rails/current; bundle exec rake app:show_pointers
Using bundle exec might be recommended in front of the command depending on the ruby environment on the remote servers.
#dbra over on stack overflow has pointed out that I need the full path to rake.
I'm new to Capistrano and having trouble debugging an error. Searching suggests this error could be an environment issue of picking up the wrong version of ruby (it's almost certainly not the referenced file as it works fine in test). Using a Capistrano task to dump the ruby version everything looks fine. Running the commands directly on the server works fine, too. I'm using rbenv on the server.
The error:
* executing `deploy:assets:precompile'
* executing "cd /home/deployer/apps/happenate/releases/20120424002545 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["happenate.com"]
[happenate.com] executing command
** [out :: happenate.com] rake aborted!
** [out :: happenate.com] /home/deployer/apps/happenate/releases/20120424002545/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end
** [out :: happenate.com] ...sion_store :cookie_store, key: '_happenate_session'
** [out :: happenate.com] ^
Definitely some sort of ruby environment issue. After cleaning everything up with a proper rbenv environment, the error is gone.
I am running into an issue when trying to run migrations from capistrano (cap deploy:migrate).
latest => /var/www/site/releases/20110108002015
* executing "cd /var/www/site/releases/20110108002015; rake RAILS_ENV=production db:migrate"
servers: ["www.site.com"]
[www.site.com] executing command
** [out :: www.site.com] (in /var/www/site/releases/20110108002015)
** [out :: www.site.com] Could not find treetop-1.4.9 in any of the sources
** [out :: www.site.com] Try running `bundle install`.
command finished
failed: "sh -c 'cd /var/www/site/releases/20110108002015; rake RAILS_ENV=production db:migrate'" on www.site.com
The facts;
Rails 3.0.0
Ruby 1.9.2 via rvm
The treetop gem is installed, and if I ssh into the remote server and run the command that capistrano is attempting manually, it works without issue.
Anyone else run into this or a similar issue?
When you ssh onto the server and run the command, is it using the same user capistrano is deploying as? Often issues like this are due to the deploy users path not including the same folders as your path might.
Try using cap shell to run the command, then you can test it under the same conditions cap is under.