Skip to content

fix: use HTTPS CRAN mirror and fix CA cert trust for R package installs - #14

Open
dhaley wants to merge 7 commits into
developfrom
fix/r-packages-install-remotes
Open

fix: use HTTPS CRAN mirror and fix CA cert trust for R package installs#14
dhaley wants to merge 7 commits into
developfrom
fix/r-packages-install-remotes

Conversation

@dhaley

@dhaley dhaley commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

R package installation fails in CodeBuild with:

Error in library("remotes") : there is no package called 'remotes'

The root cause is that install_r_packages.R used an HTTP CRAN mirror which silently fails. Additionally, the NLR CA certs copied into the Docker image were not registered with the system cert store, so R's libcurl did not trust the certificate chain.

Fix

  • Use HTTPS CRAN mirror (https://cloud.r-project.org)
  • Run update-ca-certificates after copying NLR certs in Dockerfile.rocker
  • Set CURL_CA_BUNDLE and SSL_CERT_FILE env vars for R's libcurl
  • Add explicit verification that remotes installed before calling library()
  • Add CI workflow for Dockerfile.rocker builds
  • Add docker-compose.ci.yml for local smoke testing

ECR Pull-Through Cache

  • Use ROCKER_REGISTRY build arg to pull Docker Hub images via ECR pull-through cache
  • When ROCKER_REGISTRY is set (e.g. 991404956194.dkr.ecr.us-west-2.amazonaws.com/docker-hub), base images are pulled from the ECR cache, avoiding Docker Hub rate limits and transient 502 outages
  • When unset (local dev), falls back to Docker Hub directly
  • The CodeBuild project already passes ROCKER_REGISTRY as a build arg (configured in doeseed-seedweb terraform)

- install_r_packages.R: use https://cloud.r-project.org (was HTTP)
- install_r_packages.R: add verification that remotes installed before
  calling library('remotes') - gives clear error message on failure
- Dockerfile.rocker: run update-ca-certificates after copying NLR certs
- Dockerfile.rocker: set CURL_CA_BUNDLE and SSL_CERT_FILE env vars so
  R's libcurl uses the system cert store
- Add docker-compose.ci.yml for smoke testing Dockerfile.rocker
- Add .github/workflows/ci-rocker.yml to test Dockerfile.rocker on PR
@dhaley
dhaley requested review from kflemin and nllong July 15, 2026 23:27
Damon Haley added 6 commits July 15, 2026 17:46
When ROCKER_REGISTRY is set (e.g. to the ECR pull-through cache prefix),
Docker Hub images are pulled via the cache, avoiding rate limits and
transient Docker Hub outages.

When ROCKER_REGISTRY is unset (local dev), falls back to pulling
directly from Docker Hub.
The node stage downloads NLR CA certs from raw.github.nrel.gov which is
only reachable from internal networks (CodeBuild VPC). On public GitHub
Actions runners this fails with DNS resolution error.

Add --connect-timeout 5 and || true so the build continues without the
certs when running outside the internal network. The certs are only
needed for production deployments (handled by CodeBuild).
The node stage is a lightweight cert-fetching helper. Official Docker Hub
images (node, alpine, etc.) require the library/ namespace prefix in ECR
pull-through cache (docker-hub/library/node), but third-party images like
rocker/r-ver work directly (docker-hub/rocker/r-ver).

Keep node pulling from Docker Hub directly - it's small, rarely rate-limited,
and the cert download is already non-fatal.
@nllong

nllong commented Jul 28, 2026

Copy link
Copy Markdown
Member

Hey @dhaley -- just wanted to confirm that we want to deploy NLR's root cert to the public docker container? Is that right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants