Installation of a gem file with a large number of dependencies fails to get installed due to rubygems.org responding to the request with 422 when rubygems.org is used as a source.
In Artifactory, the following message is logged:
In this example, aws-sdk has a runtime dependency of [aws-sdk-resources |https://rubygems.org/gems/aws-sdk-resources]that has over 200 dependencies. Note that Artifactory turns the 422 from rugygems.org into 500 (this has been changed in newer Artifactory to 422)
- Setup rubygems.org as remote repo in Artifactory 6.19.1 (or above)
- setup gem client (tested with v3.1.2) to use the remote repo
- gem install aws-sdk
1 Create a virtual ruby gems repo with both rubygems.org remote and a local gems repo
2 In a client machine where the gem install fails, create a file named GemFile that is consumed by the bundler install command as below (replace the source with your from the gems repo Set Me Up)
With [--full-index|https://bundler.io/v2.0/man/bundle-install.1.html], Bundler will not call Rubygems' API endpoint (default) but download and cache a (currently big) index file of all gems. Performance can be improved for large bundles that seldom change by enabling this option.
<If bundle install is not a good solution for all users, then an admin may perform the following steps>
1 Daily run the command above to cache any new artifacts using the bundle install (automate it if needed)
2 Copy all aws related gems from rubygems.org-cache repo to the local gems repo. Only the gems inside the gems folder need to be copied. Here is a [user-plugin|https://github.com/jfrog/artifactory-user-plugins/tree/master/storage/remoteBackup] that may be referenced to automate this
3 In artifactory log, confirm that the metadata calculation finishes. E.g.
4 Update .gemrc file so it points to the gem virtual repo
5 Now the install works via the virtual as Artifactory allows requesting large dependencies