feat: add docs website

This commit is contained in:
Patrick Schratz 2025-01-02 23:40:10 +01:00
commit 576125d377
Signed by: pat-s
GPG key ID: 3C6318841EF78925
17 changed files with 683 additions and 3 deletions

1
docs/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.quarto/

49
docs/_brand.yaml Normal file
View file

@ -0,0 +1,49 @@
color:
palette:
dark: "#1d262f"
orange: "#FF9B00"
links: "#15428c"
# background: blue
# foreground: dark-grey
primary: '#1d262f' # hyperlinks, active states, primary action buttons, etc.
tertiary: "#FF9B00" # hover states, accents, and wells.
logo:
medium:
light: logo.png
dark: logo.png
defaults:
bootstrap:
defaults:
navbar-fg: "#1d262f"
navbar-bg: "#ffffff"
typography:
fonts:
- family: Jura
source: google
- family: Inter Variable
source: google
- family: Montserrat Alternates
source: google
base:
family: Inter Variable
headings: Montserrat
link:
decoration: underline
color: links
monospace:
color: primary
background-color: "#f0f1f3"
size: 0.8rem
# decoration:
meta:
link:
home: https://www.devxy.io
gitlab: https://gitlab.com/devxy
bluesky: https://bsky.app/profile/devxy.bsky.social
linkedin: https://www.linkedin.com/company/105100347
description: Where Data Science and DevOps meet 🤝️
founded: 2024

68
docs/_quarto.yml Normal file
View file

@ -0,0 +1,68 @@
project:
type: website
website:
title: "CRAN R Package Binaries"
reader-mode: false
favicon: favicon.ico
back-to-top-navigation: true
navbar:
right:
- icon: gitlab
href: https://gitlab.com/devxy
- icon: browser-safari
href: https://www.devxy.io
- icon: bluesky
href: https://www.devxy.io
sidebar:
logo: ""
style: "docked"
collapse-level: 4
search: true
border: true
pinned: true
contents:
- text: 'Introduction'
file: index.qmd
- text: "---"
- text: 'Configuration'
file: configuration/index.qmd
- section: "**Use Cases**"
contents:
- text: "CI/CD"
file: cicd/index.qmd
- text: "R Development Environments"
file: r-dev-environments/index.qmd
- text: "Containers"
file: containers/index.qmd
# - section: "**Technical Background**"
# contents:
# - text: "Infrastructure"
# file: 031-infrastructure.qmd
# - text: "Continuous Updates"
# file: 032-continuous-updates.qmd
# - section: "**Miscellaneous**"
# contents:
# - text: "Private Mirror"
# file: 040-private-mirror.qmd
# - text: "Fair Usage"
# file: 041-fair-usage.qmd
- text: "---"
- text: 'Contributing & Help'
file: "contributing/index.qmd"
search:
location: sidebar
type: "textbox"
limit: 5
copy-button: true
collapse-after: 2
format:
html:
theme: cosmo
css: styles.css
fontsize: 1rem
toc: true
grid:
sidebar-width: 300px

82
docs/cicd/index.qmd Normal file
View file

@ -0,0 +1,82 @@
---
title: CI/CD
---
Continuous Integration / continous delivery (CI/CD) is a basic tool in todays Data Science toolstack to automate processes and execute repetite tasks on schedule.
Running tasks in CI/CD should be fast and reliable, no matter the language, architecture or computing environment at hand.
As CI/CD requires installing many packages over and over again, having binaries and optimized distributions helps to reduce runtime.
This page presents snippets for well and lesser known CI/CD engines to help getting started with the R package binaries of this project.
::: {.callout-note}
The presented snippets rely on external projects and libraries which get updated regurarly.
There is no guarantee to work out-of-the box at all times.
If you found an error, please open a pull request in the linked repo.
:::
## GitHub Actions
### VM
GitHub Actions can be run directly on a VM or in a containered context.
The available VM images can be found [here](https://github.com/actions/runner-images#available-images).
The only Linux distribution available is Ubuntu.
For VM workflows, [r-lib/actions](https://github.com/r-lib/actions/blob/v2/examples) provides many examples for different use cases.
To use package binaries from this project, use the following config for `r-lib/actions/setup-r@v2`:
```yaml
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
Ncpus: 2
cran: 'https://cran.devxy.io/amd64/noble/latest'
```
(`Ncpus: 2` has been set to allow for parallel installations.)
### Container
An alternative is to run Actions in a containerized context.
This spins up a container of the selected image in the VM and allows running on other distributions than Ubuntu, e.g. on Alpine.
To avoid having to install R first and configure a custom repository every time, [specialized images](https://hub.docker.com/r/devxygmbh/r-alpine) are provided which already have everything in place:
```yaml
jobs:
container:
runs-on: ubuntu-latest
container: devxygmbh:r-alpine
steps:
- run: |
R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/devel/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
R -q -e 'getOption("repos")'
R -q -e 'options(Ncpus = 2); pak::local_install_dev_deps()'
```
::: {.callout-note}
When running in a containerized context, the predefined actions from `r-lib/actions` cannot be used.
Shell/R commands must be used directly.
:::
::: {.callout-note}
Running containerized in Alpine should be substantially faster than running in a VM context.
:::
::: {.callout-tip}
(91 packages)
- Containerized: **1m 21s**
- VM: 2m 11s
Both runs are based on the assumption that caching is not used. With caching enabled, the performance of both approaches should be roughly comparable.
Source: [pat-s/workflow-compare](https://github.com/pat-s/workflow-compare)
:::
## GitLab Runner
WIP

View file

@ -0,0 +1,66 @@
---
title: Configuration
---
In R on Linux, packages are downloaded from CRAN as source packages.
The default CRAN mirror is `https://cloud.r-project.org`.
The default repository URL needs to be **actively changed** to one providing binaries for the respective Linux distribution.
This can be done either for all users of the system, on a project level or for specific users only.
All options will be shown in the following.
## URL Scheme
The URL scheme for this project is the same for all operating systems and only differs in the OS and architecture identifiers.
::: {.callout-note icon=false}
## URL scheme
`https://cran.devxy.io/<architecture>/<os>/latest`
:::
For example, the URL for Alpine Linux 3.21 for `arm64` would be `https://cran.devxy.io/arm64/alpine321/latest`.
The architecture identifiers are:
- `arm64`
- `amd64`
The OS identifiers are:
- `jammy` (Ubuntu 22.04)
- `noble` (Ubuntu 24.04)
- `rhel8` (RedHat Enterprise Linux 8)
- `rhel9` (RedHat Enterprise Linux 9)
- `alpine320` (Alpine Linux 3.20)
- `alpine321` (Alpine Linux 3.21)
## Repository Configuration
### System-wide
To configure the default R repository for all users of a system, create/edit `$R_HOME/etc/Rprofile.site`.
The location of this file depends on how R has been installed.
To find its location, execute `R -q -e "paste0(Sys.getenv('R_HOME'),'/etc/Rprofile.site')"`.
**At the bottom** of the file, add the following:
```r
options(repos = structure(c(CRAN = "<URL>")))
```
The name "CRAN" is optional.
It is the canonical default and in some cases also used for special actions (e.g. in Posit Workbench and [{pak}](https://github.com/r-lib/pak)).
Unless you have a good reason, it is advisable to stick with that name.
### User-wide
To change the default repository option for a specific *user*, add the line from above to `~/.Rprofile`.
### Project-wide
To change the default repository option for a specific *project*, add the line from above to `.Rprofile` in the project root directory in which R is started.
## Verification
When starting R, execute `getOption("repos")` to verify the repository is correctly configured.

24
docs/containers/index.qmd Normal file
View file

@ -0,0 +1,24 @@
---
title: Containers
---
The [rocker](https://hub.docker.com/u/rocker) project provides container images for R since several years.
Since recently, the images are multi-arch, i.e. `arm64` is supported alongside `amd64`.
Yet, other distributions than Ubuntu are missing and don't use the devXY binaries out of the box.
To simplify running containers that make use of the devXY R binaries implicitly, the following images are provided:
- [devxygmbh/r-alpine](https://hub.docker.com/r/devxygmbh/r-alpine)
- [devxygmbh/r-ubuntu](https://hub.docker.com/r/devxygmbh/r-ubuntu)
These have the devXY repositories configured by default and can be used efficiently without further configuration changes.
In contrast to the minimal `rocker/r-ver` images, the `r-ubuntu` images contain a few additional system libraries which are essential for troublefree R usage.
The following screencast shows how quickly the `r-alpine` image can be used to install the full {tidyverse} package universe in just under 30s:
<div style="padding:59.12% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/1035389676?badge=0&amp;autopause=0&amp;player_id=0&amp;app_id=58479" frameborder="0" allow="autoplay; fullscreen; picture-in-picture; clipboard-write" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="Alpine package binaries: Install tidyverse"></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
::: {.callout-note}
The performance of this screencast (and your local experience) depends on a few factors: local download speed, cached binaries in the CDN, proximity to a local edge node of the CDN and your CPU performance and finally the `Ncpus` option in R, defining how many installations are performed in parallel (by default 1).
:::

View file

@ -0,0 +1 @@
WIP

View file

@ -0,0 +1,15 @@
---
title: Contributing & Help
---
Contributions are welcome.
The project is open-source and GPL licensed.
The most helpful tasks are to investigate in detail why specific packages failed to build a binary.
It usually comes down to a missing system dependency (which is either not declared in the package's DESCRIPTION file or exotic and must be installed from source) or a C code compile issue.
Please open an issue in the [`r-package-binaries/support`](https://gitlab.com/devxy/r-package-binaries/support) repo.
::: {.callout-note}
The actual repo executing the builds ([devxy/build-binaries](https://git.devxy.io/devxy/build-binaries)) is hosted in a private git instance to be able to use specific private CI runners and is not easily usable for creating public issues, hence the dedicated repo on GitLab.
:::

View file

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

24
docs/index.qmd Normal file
View file

@ -0,0 +1,24 @@
---
title: "CRAN R Package Binaries"
---
This project provides R package binaries for various Linux distributions and architectures.
While it provides binaries for [CRAN packages](https://cran.r-project.org/), it is not affiliated with CRAN in any way.
Binaries are distributed to the community for free with a monthly download cap of **50 Terrabyte**.
::: {.callout-note}
If you represent a for-profit company and plan to make extensive use of these binaries, please get in touch. We offer the option to obtain a private mirror with unlimited access.
:::
While we strive to build binaries for all CRAN packages, there are various reasons why building binaries for a package might fail.
(The most common reason is a missing (exotic) external system dependency which the project links against.)
The [R package binary dashboard](https://app.devxy.io/app/r-package-binaries-dashboard) provides global coverage information for each for each operating system and which packages are currently missing.
## Motivation
The project was established to offer extensive R CRAN package support for common Linux distributions.
Since CRAN does not build binaries for Linux, Posit began providing binaries in 2020.
However, their efforts were limited to the amd64 architecture and excluded Alpine Linux, which is among the most popular distributions for container-based workflows.
This project aims to make R a first-class citizien for CI/CD and containers using a community-driven open-source approach.

View file

@ -0,0 +1 @@
WIP

BIN
docs/logo-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
docs/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

View file

@ -0,0 +1,32 @@
An R development environment is a shared Linux VM or Kubernetes Cluster that runs an Integrated Development Environment (IDE), e.g. Posit Workbench or RStudio Server, and other related applications, such as Posit Connect or ShinyProxy.
In such an environment, multiple users can share the available resources and configurations can be set centrally for all users[^1].
Using package binaries in shared development environments is a crucial component for the overall success and efficiency of each individual user.
## Fast Package Downloads
Besides using R package binaries in the first place, a fast download speed further improves the quality of such an environment.
The binaries of this project are 5-10 times faster in download compared to other available binaries*.
::: {.callout-note}
The exact timing depends on the location from where the download is initiated.
The closer it is to static cache node of the distributing CDN, the faster.
:::
## Reduced Costs Through arm64 Servers
Besides accelerating downloads, this project enabled using `arm64` machines for such environments.
These server types are substantially cheaper than their `amd64` counterparts, allowing for significant cost savings without any negative drawbacks.
The following example shows the on-demand prices of a 2 CPU 16 GB VM on Azure (2025/01):
- amd64: 0.1640/h (Standard_E2ds_v6, eastus)
- arm64: 0.1150/h (Standard_E2ps_v6, eastus)
-> 29.88% savings
::: {.callout-note}
Servers with the same specifications but from different generations can have significant price variations. For this comparison, an effort was made to use the latest configurations of both architectures to ensure a reasonably fair evaluation.
:::
[^1]: For more information about managed R environments, see ["Posit Software Installation for Enterprises" offer from devXY](https://www.devxy.io/posit-enterprise/).

31
docs/styles.css Normal file
View file

@ -0,0 +1,31 @@
/* css styles */
div.sourceCode {
border-radius: 6px;
}
p code:not(.sourceCode),
li code:not(.sourceCode),
kbd,
pre:not(.sourceCode),
samp {
background-color: #f6f6f6 !important;
padding: 0.25em;
border-radius: 6px !important;
}
/* sidebar */
.sidebar-navigation li a {
line-height: 1.2rem;
font-size: 0.8rem;
}
.navbar {
border-bottom: 1px solid #e5e5e6;
max-height: 50px;
}
.navbar-logo {
max-height: 30px;
}