R / CRAN package repositories
Source packages use src/contrib. Windows and macOS use binary directories that depend on the R version. Arka indexes packages from their DESCRIPTION metadata.
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 cran-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 cran-hosted --type hosted --format cran | jq -er .id)
proxy=$(arkactl --json repo create --name cran-proxy --type proxy --format cran \
--upstream-url https://cloud.r-project.org | jq -er .id)
arkactl repo create --name cran-group --type group --format cran --member "$hosted,$proxy"
export WRITE="$ARKA_URL/repository/cran-hosted"
export READ="$ARKA_URL/repository/cran-group"Build and upload a source package
R CMD build acmewidget
curl --fail-with-body -sS -H "Authorization: Bearer $ARKA_WRITE_TOKEN" \
-T acmewidget_1.2.3.tar.gz "$WRITE/src/contrib/acmewidget_1.2.3.tar.gz"Install and authenticate
R can use an anonymous Group or one authenticated by the deployment gateway.
options(repos = c(Arka = "https://packages.example.org/repository/cran-group"))
install.packages("acmewidget", type = "source")
stopifnot(packageVersion("acmewidget") == "1.2.3")To install a known private archive, use an R download interface that can send the token in an HTTP header. Resolve other dependencies through the configured repository and the project’s lockfile.
artifact <- tempfile(fileext = ".tar.gz")
stopifnot(download.file(
paste0(Sys.getenv("READ"), "/src/contrib/acmewidget_1.2.3.tar.gz"),
artifact, method = "libcurl", mode = "wb",
headers = c(Authorization = paste("Bearer", Sys.getenv("ARKA_READ_TOKEN")))
) == 0L)
install.packages(artifact, repos = NULL, type = "source")Export READ to the R process. Set the Proxy to the CRAN mirror’s site root. R adds the platform path. Group serves visible indexes via PACKAGES and PACKAGES.gz.
| Symptom | What to check |
|---|---|
| R falls back during discovery | R may try PACKAGES.rds before PACKAGES.gz or PACKAGES. Inspect the final index response. |
| Package is unavailable for this R version | Check Depends: R, type, the binary directory, and the running R version. |
| Compilation fails | Install the compiler and system dependencies on the consumer. This example uses a source package. |