I'm on a shared application environment and there's several ruby versions and gemsets installed (managed via RVM). I need to validate both the Capistrano gem version and ruby version on my deploy since, for example, there's incompatibilities with the 2.14.1 version of Capistrano and ree-1.8.7.
Is there any simple or even hacky way of doing this? I'm executing the call cap _2.13.5_ production deploy to deploy, but I wanted to quit execution with a message back to user if the environment is not correctly set. Seems overkill, but it's a client requirement.
Thanks.
If you're asking what version of capistrano will run
when you run capistrano, then run "cap -v":
Capistrano Version: 3.10.0 (Rake Version: 12.3.0)
add capistrano to Gemfile and execute using bundle exec cap production deploy
as for production - put your server configuration into the production task/stage and capistrano will fail to deploy because o the missing server.
Related
I'm trying to deploy a site using bundler and capistrano.
I updated to the latest version of Ruby (I was using 1.9.3 and now using 2.3.0)
I updated bundler to 1.10.6.
Before these updates when I ran this command "bundle exec cap production deploy" it would work, now when I run that command there is NO output whatsoever.
I haven't been able to find anything online that deals with this issue.
Any help is appreciated!
Jason
I have a box with 3 Rails apps on it. I wan't to upgrade one of the apps so that it uses Ruby 2.0.0, while leaving the others running on 1.9.3-p394. I have both those Rubies installed via Rvm.
I'm trying to control the Ruby version that each app uses via it's Gemfile.
# Gemfile
ruby '2.0.0'
So, I changed the version number in the Gemfile locally, made sure it all worked, committed and now I'm trying to deploy the change to the server.
However, the cap deploy fails at this point
bundle install --gemfile [path to release Gemfile] --path [path to app bundle] --deployment --quiet --without development test
because
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
This is correct technically, my Gemfile does specify 2.0.0 and the app is currently running on 1.9.3. I'm trying to make it change versions before bundling though. How do I do that?
Your PATH is not set up correctly. You probably don't have bin: as the first entry in your path. That would lead to this error.
Even if you're not using Heroku it's worth reading this page on troubleshooting that issue: https://devcenter.heroku.com/articles/ruby-versions
Here is a link to an answer which will explain how to change your PATH on the server: Capistrano: Can I set an environment variable for the whole cap session?
If you have rvm maybe you can try to do
rvm use 2.0.0
before your bundler call.
If you're using rvm set the default to ruby 2.0.0 on your server
rvm --default use 2.0.0
Resolved the problem for me deploying to an AWS server from my mac - but I guess if I need to update my older sites I'll have to set the default back to 1.9.3 before deploying.
I'm totally lost with the working of capistrano and bundler together. I've just started using capistrano for my deployment, and when I'm trying to run "bundle install" on my local development machine, bundler is actually creating a "capistrano" folder and installing the gems there. Ideally before capifying my project, "bundle install" would just pick up the system gems and worked like a charm.
This has been bothering my for some time, and I want to understand why this is happening, and how to prevent it (atleast on my local development machine). I understand that this might be useful when actually doing a "cap deploy" on the production server, but why in development ??
Help..point in the right direction someone please..
Thanks
I'm sure you are doing this
bundle install capistrano
Just,
bundle install
should be enough if you have included capistrano to your Gemfile
Does every gem have its own rake? Because I was doing android development and I created app using the z$ rhogen app z. and then i did $rake run:android and the android emulator came up. But when I create an app using $rhosync app <appname> then migrate to the root of the app folder and do $rake:dtach install then the rake uses my older version of Ruby 1.8 where as my new and active Ruby version is Ruby 1.9.2. I dont know where to change the config file of the app or gem I am not sure to make Ruby 1.9.2 as my default ruby when I do $rake dtach:install.
As Alex said, rake tasks are not needed in order to have a gem.
What environment are you working on? RVM is a nice way to manage you ruby environments and manage multiple versions of ruby on unix based systems (OS X/ubuntu/debian). Have a look here http://beginrescueend.com/
No, not all gems have rake tasks.
Can not update gems on production server.
I've tried bundle install --deployment and bundle install --without development test
But keep getting:
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
If this is a development machine, remove the Gemfile freeze
by running `bundle install --no-deployment
EDIT
I don't know if this is correct, but needed a quick fix. I ran bundle install --no-deployment then bundle update then ran bundle install --deployment again
The instructions are probably a bit confusing. It's saying that you've modified your Gemfile on your development machine and just pushed those changes rather than running bundle install BEFORE committing the changes.
By running bundle install you will update your Gemfile.lock file. This should be pushed to your server as it's more important than Gemfile. Consider the Gemfile the plans for the Gemfile.lock file.
Always remember to:
Run bundle install if you change your Gemfile, even just to make sure. If it's too slow, pass --local through which forces it to only use local gems to resolve its dependencies.
Commit both the Gemfile and Gemfile.lock file to your repository
Deploy both the Gemfile and Gemfile.lock to your production servers to ensure that they're running the exact same dependencies as your development environment.
Running bundle update by itself can be construed as dangerous that will update all the dependencies of your application. It's mainly dangerous if you don't have solid version numbers specified in the Gemfile. I wrote about it here.
FWIW I had this problem and fixed it by removing some conditional statements from my Gemfile (conditionals on OS) and rerunning bundle.
FYI: You can also get this error if you use source blocks like this:
source 'https://rails-assets.org' do
gem 'rails-assets-jquery'
end
You'll see an exclamation point in the Gemfile.lock for this gem:
rails-assets-jquery!
Just define the additional source normally, i.e.
source 'https://rails-assets.org'
gem 'rails-assets-jquery'
(BTW cf. here about using multiple gem sources.)
This can be caused by an old version of the bundler gem on the server you're deploying to (in this case production). Logging into the server and running a gem update bundler resolved the issue for me. The server I was deploying to was running version 1.7.4 and the current version was 1.9.
I had an issue with my production server still using an old version of a gem, even though the Gemfile.lock showed the correct, updated version. My production server was running on Unicorn - and shutting down / starting it back up again fixed the issue - instead of sending the HUP signal, which did jack all to fix the issue.
bundle install failed on my "development" machine because of the mysql-gem on osx...
I also needed a quick fix. So I cloned the repo to a new folder on the production machine, ran "bundle install" there and committed the Gemfile.lock to the repo.
I have had this problem (Ubuntu 12.10 & 12.04, one of which behind a proxy server).
My problem was that I had some git:// protocols in the Gemfile. Changing this to http:// helped me get it all working.