How to build a rubygems mirror server?

后端 未结 2 1800
-上瘾入骨i
-上瘾入骨i 2020-12-07 19:32

My workplace has banned us from internet access so we can\'t connect to rubygems.org to install gems remotely.

I can access rubygems.org at home. Is there a simple

相关标签:
2条回答
  • 2020-12-07 19:41

    You can use rubygems-mirror to mirror the gems and Gem in a box to host them.

    Install rubygems-mirror:

    $ gem install rubygems-mirror
    

    Edit ~/.gem/.mirrorrc:

    ---
    - from: http://rubygems.org
      to: ~/.gem/mirror
    

    Create mirror dir:

    $ mkdir ~/.gem/mirror
    

    Start mirroring:

    $ gem mirror
    

    Once mirroring finishes edit ~/.gem/mirror/config.ru:

    require "rubygems"
    require "geminabox"
    
    Geminabox.data = "./"
    run Geminabox
    

    Install Gem in a box:

    $ gem install geminabox
    

    Start gem server:

    $ cd ~/.gem/mirror
    $ rackup
    

    Edit your application's Gemfile to use your gem server:

    source "http://your.servers.ip:9292"
    .
    

    Or add it as a local mirror for rubygems.org, so you don't have to change your Gemfile:

    $ bundle config mirror.https://rubygems.org https://localgems.lan
    $ bundle config mirror.http://rubygems.org http://localgems.lan
    

    From time to time reindex your mirror:

    $ gem generate_index --directory ~/.gem/mirror
    
    0 讨论(0)
  • 2020-12-07 20:00

    I don't think 'gem mirror' continuing from where it left of it very reliable. I ran into following issue https://github.com/rubygems/rubygems-mirror/issues/22 and I waiting hear back from gem owners

    0 讨论(0)
提交回复
热议问题