Configuring Posit Workbench with an NFS-backed PersistentVolume

This example deploys Posit Workbench with a single PersistentVolume backed by an NFS server.

The PersistentVolume allows setting NFS mountOptions and it creates a StorageClass that Posit Workbench then takes advantage of when it creates its PersistentVolumeClaim.

sharedStorage is not needed in this example as config.server.rserver.conf.server-shared-storage-path is set to put the required shared storage folder in /home

Both the PVC and PV will be left around after the helm release is removed (for manual cleanup) due to the persistentVolumeReclaimPolicy: Retain setting.

To use the example you will need:

  • a license file or key
  • ReadWriteMany POSIX compliant storage class for homeStorage and sharedStorage
  • a PostgreSQL database.
values.yaml
# Using a license file with the helm chart:
# https://github.com/rstudio/helm/tree/main/charts/rstudio-workbench#license-file
# If you would like to use a license key see this documentation:
# https://github.com/rstudio/helm/tree/main/charts/rstudio-workbench#license-key
license:
  file:
    secret: posit-licenses # TODO: Change to the secret name in your cluster
    secretKey: workbench.lic # TODO: Change to the secret key containing your Workbench license

homeStorage:
  create: true
  mount: true
  storageClassName: "nfs-workbench-home-pv" # TODO: Ensure this name matches the name and storageClassName defined in the PV created below in extraObjects.
  requests:
    storage: 100G

# This is evaluated as a template
# TODO: Change the `mountOptions` and `nfs` settings to suite your NFS setup
extraObjects:
  - |
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: nfs-workbench-home-pv
      annotations:
        "helm.sh/resource-policy": keep
    spec:
      capacity:
        storage: {{ .Values.homeStorage.requests.storage }}
      volumeMode: Filesystem
      accessModes:
        - ReadWriteMany
      persistentVolumeReclaimPolicy: Retain
      storageClassName: nfs-workbench-home-pv
      mountOptions:
        - rw
        - lookupcache=pos
        - vers=4
      nfs:
        path: /
        server: nfs.server.example.com

config:
  server:
    rserver.conf:
      server-shared-storage-path: /home/rstudio-shared-storage/
  secret:
    database.conf:
      provider: "postgresql"
      connection-uri: "postgres://<USERNAME>@<HOST>:<PORT>/<DATABASE>?sslmode=require" # TODO: Change this URI to reach your Postgres database.
      password: "<PASSWORD>" # TODO: Remove this line and instead set the password during helm install with --set config.secret.database\.conf.password=<your-postgres-password>.