Connect your Mix Client to Artifactory

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

This topic provides details on configuring Hex to work with Artifactory. To get up and running quickly to use Hex see Get Started with Hex.

Pre-requisite: Before connecting your Hex client to Artifactory, you must have an existing Hex repository in Artifactory. For more information, see Create a Hex Repository

Supported Hex Clients

Hex repository supports the following and has been tested. It lists the specific compatible versions to ensure smooth integration and optimal performance when working with Hex Repositories in Artifactory.

  • Hex: Versions 2.1.1 and above

  • Elixir: Versions 1.16 and above

  • Open Telecom Platform (OTP): Versions 26.2.5.6 and above

Note

Supported: Elixir and OTP projects using Mix.

Not Supported: Projects using rebar3.

Logged in vs. Anonymous User: You can work with Artifactory as either a logged in user or as an anonymous user. To work with Artifactory using Anonymous Access. You need to configure that access under Admin | Security | General. For details, refer to Allow Anonymous Access.Allow Anonymous Access

Configure your Hex Client

Prerequisite

Download Public Key to Hex Project Folder

Hex Local Repository

Run the following command in the Hex project directory to add your Artifactory Local repository to the mix client:

mix hex.repo add <REPOSITORY_NAME> https://[JFrogPlatformURL]/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem

Note

Make sure that the publickey.pem key is pointing to the correct location in your project.

Where:

  • <REPOSITORY_NAME>: Name of the repository/repository key

  • <JFrogPlatformURL>: URL of your JPD

  • <TOKEN>: Your JPD access token

For example:

mix hex.repo add hex-local https://company.jfrog.io/artifactory/api/hex/hex-local --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Hex Remote Repository

Run the following command in the Hex project directory to add your Artifactory Remote repository to the mix client:

Hex.pm - Hosted

Connect your Mix client to the public registry or a private organization within hex.pm.

mix hex.repo set hexpm --url https://[JFrogPlatformURL]/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem

For example:

mix hex.repo set hexpm --url https://company.jfrog.io/artifactory/api/hex/hex-remote --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem

Hex Server - Self-hosted

Connect your Mix client to a private organization within hex.pm.

mix hex.repo add <REPOSITORY_NAME> https://[JFrogPlatformURL]/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem

For example:

mix hex.repo add hex-remote https://company.jfrog.io/artifactory/api/hex/hex-remote --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem

Hex Virtual Repository

Run the following command in the Hex project directory to add your Artifactory Remote repository to the mix client:

mix hex.repo set hexpm --url https://[JFrogPlatformURL]/artifactory/api/hex/<REPOSITORY_NAME> --auth-key "Bearer <TOKEN>" --public-key ./publickey.pem

For example:

mix hex.repo set hexpm --url https://company.jfrog.io/artifactory/api/hex/hex-virtual --auth-key "Bearer cmVmdGtuOjAxOjEMTGJqNDZKSG5ETEJi" --public-key ./publickey.pem

Next Steps: