Installing Gitlab 6-1 on Cent OS 6 - ruby-on-rails

I'm following this recipe:
https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md
Step Initialize Database and Activate Advanced Features:
bundle exec rake gitlab:setup RAILS_ENV=production
I can't pass that step, tried several ways of getting to work, create a specific gemset, used the default, and I'm still getting the error as it couldn't find any gem, first it asks for Rake, but it's installed. Tried (without bundle exec) rake gitlab:setup RAILS_ENV=production and he asked for another gem, installed the one asked and it asks for another. Tried bundle install, which give me some curious thing, every time I tried it installed all the gems, it didn't show "using gem X (x.x.x)" was "installing gem X (x.x.x)" always.
I'm hoping for someone who passed for such problem installing Gitlab on production and could give me some light how to solve this.
I'm using Ruby 2.0.0. RVM. Cent OS 6.2. Gitlabhq 6-1 branch.

Related

Could not find nokogiri-1.6.7.1 in any of the sources

So I'm a newb (hey at least i found stack overflow right?) and I'm using Michael Hartl's Ruby on Rails Tut. Chapter three has me input:
sudo rails generate controller StaticPages home help
and I get back:
Could not find nokogiri-1.6.7.1 in any of the sources
Run `bundle install` to install missing gems.
When I look at the bundle installer it definitely lists nokogiri 1.6.7.1
AND when I input:
bundle show nokogiri
I get:
/Users/user/.rvm/gems/ruby-2.2.3#rails3tutorial2ndEd/gems/nokogiri-1.6.7.1
I'm using rails v 4.2.5 on my macbook pro os x el capitan v 10.11.1
ANY HELP is supremely appreciated. Maybe I can pay it forward a year or two from now!
Bundler is a tool that makes sure the runtime environment uses the right library and versions. Usually, we prepend commands to do Ruby developments, including Rails:
bundle exec rails generate controller StaticPages home help
bundle exec takes a command and its parameters, and run it into the environment defined in the Gemfile, found in the same folder.
And as #David Grayson mentioned, sudo changes the environment. For security and packaging of your code, it is better to run as your current user (and to avoid the wrath of the deployment team).
Try running that command without sudo. Since sudo runs the command as the root user, it changes your environment and probably makes it so that you are using the wrong version of Ruby, or the version of Ruby you are using cannot see the gems you have installed.
Edit: As Eric Platon points out, try adding bundle exec at the beginning of that command to make sure bundler is loaded and that the right version of Rails will be used.

Why "Rails -v" and "Bundle exec rails -v" is different

I have staging and productions servers through AWS. After a certain point of time(I think it was after I upgraded ruby version to 2.1), my staging/production servers couldn't find rails so I had to ssh in and redownload Rails and Ruby, but now when I run "rails -v" it gives me 2.3.14, but when I run "bundle exec rails -v" I get the proper 3.2.16.
I'm guessing this is because of paths, but not entirely sure how to solve this. Some of the answers I found suggested changing the .bashrc and changing the $PATH variable, but wasn't exactly sure what to change it to.
This is my .bashrc:
#PATH=$PATH:$HOME/.rvm/bin # how it was before
PATH = $PATH:$HOME/.rvm/gems/ruby-2.1.0/bin #edited this just now to see if it works. it didnt..
bundle exec rails will use the rails version defined in your Gemfile. On the other hand, a simple rails will run the latest version available on your computer.
What probably happened is this:
you had a rails version from rvm that was the same as the one used in your Gemfile (3.2.16), so you were not noticing any difference. After upgrading ruby, you have to reinstall all gems you did install on your previous version. Otherwise it will fallback to the latest available, which can be the system version (ie. not from rvm). This may explain why you have such an outdated one.
Note that a proper bundle install will install all the gems required in your Gemfile and then will do the job for you.

Rake 10.0.4 not found in sources

I've just pushed a new Rails app from my local development machine to a server I have that has a few Rails apps already on, bundle installs everything correctly and rake tasks run fine, however when I try and start the app it fails with that message.
I've:
Trashed my Gemfile.lock and reran bundle install
Done gem install rake to get the latest version
Checked rake --version shows 10.0.4.
Checked bundle show rake shows 10.0.4
Restarted the server
Now I'm drawing a blank on what it could be. Using Phusion Passenger, rails 3.2.13, ruby 1.9.2p290. I use rvm for managing the environment, but I've not changed anything with it for a long, long while now. The other Rails apps are all working okay without any issues, with similar gem dependencies.
Self fixed, but not sure why. I ran bundle install rake by accident, forgetting it doesn't do what I think and it created a ./rake folder which solved the issue.
Perhaps your application is being run as the wrong user.

New Gems Not Found in Production with Rails 3, Bundler and RVM

I recently set up a production server for a Rails 3 app.
On the initial deploy everything worked fine. On a subsequent deploy, new gems that were added to the project are not being found. I am getting uninitialized constant and undefined method errors when I reference classes and methods from the newly added gems, respectively.
When I originally set things up I was using a gemset with RVM, but have tried to simplify things by removing the gemset and only using RVM to manage rubies.
When I run bundle list every thing is there. All of the gem are in <app_root>/shared/bundle/ruby/1.9.1/gems/
It seems like maybe it's loading the gems from some other location, like the original gemset, but I have deleted it.
Some other details, I am using Capistrano, of course, Unicorn, my GEM_HOME=/home/deployer/.rvm/gems/ruby-1.9.3-p286
Let me know if there is any other info I can provide.
Thanks.
if you use bundle install --deployment then you also have to prefix commands with bundle exec when you execute the command, like:
bundle exec rake db:migrate
If you use bundler/capistrano integration then it does it for you in capistano but in console you need to use bundle exec manually.
RVM was helping you to avoid it with rubygems-bundler gem - but you changed gemset so the generated wrappers are no more available. You would have to clean <app_root>/shared/bundle/ruby/1.9.1/gems/ and run bundle install again to regenerate the wrappers to avoid typing bundle exec again.
I have similar problems. It turns out Capistrano isn't properly restarting unicorn. SSHing into the server and stopping then starting unicorn did the job. Now to find a fix for Capistrano's shenanigans...

Rails Server Won't Start

I'm trying to start my rails server with "rails server". I am getting the following error.
Could not find rake-0.9.2.2 in any of the sources
Run bundle install to install missing gems.
when I use gems, it say it is updated. Am I missing some type of path?
I am using MAC OSX Lion with the newest version of Ruby, Rake, Rails.
Run bundle install to make sure all the bundled gems are installed and available to the project.
Then try starting the server with bundle exec rails server - it's possible you've got the rake gem installed at the system level at a slightly different version level than what rails want. If you run rails via bundle exec, it'll set everything up for you

Resources