Private Hex repositories for Elixir
Hosted accepts Hex archives. Arka serves a signed Hex Registry v2 index for Hosted, Proxy, and Group and exposes the /api/packages/<name> JSON endpoint.
Configure signing
Mount an RSA PEM private key of at least 2048 bits. The default is /run/secrets/arka_hex_signing_key; override it with ARKA_HEX_SIGNING_KEY_FILE. Use the same key on all replicas and distribute its public PEM over a trusted channel. Check the active public key at /repository/<repo>/public_key.
Proxy obtains the verification key over HTTPS from the upstream public_key endpoint. Arka recognizes Hex.pm and upstream names in /repos/<name> and /repository/<name>. For custom URLs set ARKA_HEX_UPSTREAMS_JSON, for example {"hex-proxy":{"upstreamRepository":"vendor"}}. Pin a PEM with upstreamPublicKey in the same entry. HTTP upstreams require a pinned key.
Create repositories
Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the endpoint and upstream address. Grant the publisher Hosted write access and the consumer read access to Group and the relevant members. For each identity, sign in and run arkactl --json tokens create --name hex-ci --expires-in-days 30 | jq -er .plaintext. Store each token directly in your secret manager.
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name hex-hosted --type hosted --format hex | jq -er .id)
proxy=$(arkactl --json repo create --name hex-proxy --type proxy --format hex \
--upstream-url https://repo.hex.pm | jq -er .id)
arkactl repo create --name hex-group --type group --format hex --member "$hosted,$proxy"
export WRITE="$ARKA_URL/repository/hex-hosted"
export READ="$ARKA_URL/repository/hex-group"Build and publish
HEX_API_URL="$WRITE/api" HEX_API_KEY="$ARKA_WRITE_TOKEN" mix hex.publish package --yesConfigure consumers
mix hex.repo add hex-group "$READ" --public-key ./trusted-hex-public.pem{:acme_widget, "== 1.2.3", repo: "hex-group"}Use the Arka repository name as the client configuration name. For a private read repository, pass --auth-key "$ARKA_READ_TOKEN" to mix hex.repo add. Direct archive downloads also accept a Bearer token.
curl --fail-with-body -sS -H "Authorization: Bearer $ARKA_READ_TOKEN" \
"$READ/tarballs/acme_widget-1.2.3.tar" -o acme_widget-1.2.3.tar
sha256sum -c acme_widget-1.2.3.tar.sha256Group merges versions in member order and signs the result with its own repository name.
| Symptom | What to check |
|---|---|
| mix deps.get reports a missing package but the archive downloads | Inspect the formats of GET /packages/<name> and GET /names. The Hex client uses binary registry records. |
| Signature verification fails | Check the pinned client public key and whether the configured name matches the Arka repository name. |
| Token rejected | Verify repository access and check HEX_API_KEY for publishing or --auth-key for reading. |