Any official mirrors of rubygems.org?

I have been having trouble deploying my application lately due to rubygems.org related errors like:

Fetching gem metadata from http://rubygems.org/
Error Bundler::HTTPError during request to dependency API
Fetching full source index from http://rubygems.org/
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!                                                                        

~/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/http.rb:762:in `initialize'
Connection timed out - connect(2)
Errno::ETIMEDOUT

      

The gem system is great, but I see it as a single point of failure, when it's not available, you can't get the latest fixes, etc. There is a huge network of Debian repositories and a mirror can be selected in a geographic location. Is there something similar for gems? And if there is a mirror, how can I be sure that the packages are not compromised there? (which happened recently with rubygems.org)

Another thing is when I have a local copy of the gems, can the packager transfer them directly to the server without getting it from rubygems.org? This can reduce the load on the servers, and also make sure your deployment will work at all times (I know I can check out the gems in my git repository, but I don't like doing that).

+3


source to share


3 answers


This gem can solve the capistrano-strategy-copy-bundled problem . The usage is pretty simple:

config/deploy.rb:



require 'capistrano-strategy-copy-bundled'
set :deploy_via,    :copy_bundled 

      

All your gems are packaged in a local tar archive, which is then transferred to the server. However, there is one problem: if you want to deploy gems with native extensions (such as database drivers, therubyracer, etc.), you must have the same architecture and versions of dependent libraries (such as glibc) on both machines.

0


source


There may be mirrors of Rubygems.org there, but I haven't tried them and don't know if they have all the gems. But yours Gemfile

has an ad source

where you can tell Bundler to look at another mirror.

There is a gem that can display all gems on your local system called rubygems-mirror

You can install some gems locally in your git using the Bundler command :path

. So if you want to have a local copy of let say devise, you can do



gem 'devise', :path => 'vendor/devise'

      

And then you clone the development repository in your folder vendor/devise

and commit that to Git.

It's really very boring though if you try to do it with all the gems, as there are dozens of gems that are only involved in Rails. You can look at the RVM Gemset for this and there is a way for a binder to get all the gems and link them to your application (sorry, you have to consult the doc for more information as I don't need it yet)

0


source


You can also use github if there is a gem in there. Rubyforge is very popular. As far as I know your gemfile should be declared correctly, see if you have any version conflict with gem / s if you have ruby ​​and / or rail system installed.

0


source







All Articles