RubyGems publishing, downloads, and Bundler sources
Publishers send the .gem archive as the Hosted request body. Consumers use the RubyGems index to discover gems and platforms, then download the archive.
Create repositories
Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the example address with your HTTPS endpoint. Publish to Hosted. Group looks in Hosted first, then in Proxy. Grant the publishing account write access to Hosted and the consuming account read access to Group and the relevant members.
For each consuming or publishing identity, sign in with its profile and run arkactl --json tokens create --name rubygems-ci --expires-in-days 30 | jq -er .plaintext. Send the output directly to the CI secret store. Use a separate read and write token for the examples below.
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name rubygems-hosted --type hosted --format rubygems | jq -er .id)
proxy=$(arkactl --json repo create --name rubygems-proxy --type proxy --format rubygems \
--upstream-url https://rubygems.org | jq -er .id)
arkactl repo create --name rubygems-group --type group --format rubygems --member "$hosted,$proxy"
WRITE="$ARKA_URL/repository/rubygems-hosted"
READ="$ARKA_URL/repository/rubygems-group"Publish and fetch
gem build widget.gemspec
GEM_HOST_API_KEY="$ARKA_WRITE_TOKEN" gem push --host "$WRITE" widget-1.2.3.gem
mkdir pulled
(cd pulled && gem fetch widget --version 1.2.3 --clear-sources --source "$READ/")
cmp widget-1.2.3.gem pulled/widget-1.2.3.gemOmit the trailing slash from --host. RubyGems appends /api/v1/gems and sends the API key directly in Authorization. With older RubyGems, add :arka: arkat_… to ~/.gem/credentials, set mode 0600, and pass --key arka. The read command above assumes the Group permits anonymous access for that client.
Configure private dependencies
Configure download sources in ~/.gemrc. Use TLS and supply the consumer’s username and read-only token with Basic authentication. If the credentials must be in the URL, encode both values separately and have CI create a temporary mode-0600 configuration file.
---
:sources:
- https://packages.example.org/repository/rubygems-group/
:update_sources: trueIn the Bundler project’s Gemfile, use source "https://packages.example.org/repository/rubygems-group/". For a private source, inject BUNDLE_PACKAGES__EXAMPLE__ORG="$ARKA_USER:$ARKA_READ_TOKEN" in CI and run bundle install. Use server-side repository permissions to control reads for different paths on the same domain. Commit Gemfile.lock with the platform requirements.
| Symptom | What to check |
|---|---|
| push returns permanent redirect | Check --host. A double slash triggers a redirect. Check whether the write succeeded before retrying. |
| fetch works but install fails | Check the platform with gem specification widget-1.2.3.gem platform, plus the Ruby version, native build tools, and transitive dependencies in Group. |
| Reads return 401 | GEM_HOST_API_KEY is for writes. Check Basic credentials, source URL, and Group member permissions for reads. |