Hex upstreams are now generally available

Pull public Elixir and Erlang dependencies from hex.pm through your Cloudsmith repository rather than directly from the internet. Hex upstreams no longer need a support request to enable.

A Cloudsmith upstream can be configured as proxy only, proxy and cache, or cache only. With caching enabled, Cloudsmith keeps a copy of each package it serves, so builds keep working when hex.pm is unreachable. Cached packages are stored as regular packages in the repository, tagged with the upstream’s name, and go through the same vulnerability scanning, policies, and access controls as packages you upload.

Setting up an upstream

A Hex upstream points at a Hex registry: https://repo.hex.pm/ for the public one. You can create a Hex upstream via the Cloudsmith web app, API, CLI, or Terraform provider.

Cloudsmith indexes the upstream ahead of time, so upstream packages can’t be installed until the first index finishes. For details, see Indexing in the Cloudsmith documentation.

Using it from Mix

Mix is Elixir’s build tool. Cloudsmith merges the upstream’s packages into your repository’s own Hex registry and signs every registry response with the repository’s RSA key. Add the repository to Mix once:

mix hex.repo add REPOSITORY https://hex.cloudsmith.io/OWNER/REPOSITORY --auth-key API-KEY --fetch-public-key SHA256:FINGERPRINT

Then name that repository in mix.exs:

{:jason, "~> 1.4", repo: "REPOSITORY"}

With an upstream active, Cloudsmith also points each package’s own dependencies at the same repository, so the whole dependency tree resolves through Cloudsmith rather than hex.pm.

For more details, see Hex repository and Create a Hex upstream in the Cloudsmith documentation.

Keep up to date with our monthly product bulletin