Speed Run Installation
Cheat to Win - Things I did ahead of time
Set up the Kubernetes cluster (Amazon EKS)
Set environment variables: RStudio Connect License Key and PostgreSQL Database Password (of my choosing)
Have
kubectl
andhelm
installed
Install all the things - “A Love Letter to Helm”
Helm helps you to:
- Achieve a simple (one command) and repeatable deployment
- Update/rollback and test application deployments
Pull the helm charts and update the helm repo:
# RStudio Connect
helm repo add rstudio https://helm.rstudio.com
# Postgres (optional)
helm repo add bitnami https://charts.bitnami.com/bitnami
# NFS (optional)
helm repo add kvaps https://kvaps.github.io/charts
# Pull the latest versions of the helm charts
helm repo update
Create a namespace for RStudio Connect
(guide assumes rstudio-connect
)
# Create the new namespace
kubectl create namespace rstudio-connect
# Switch to the new namespace in your current context
kubectl config set-context --current --namespace=rstudio-connect
Install PostgreSQL with Helm
Just an example – You can bring your own:
helm upgrade --install rsc-db bitnami/postgresql \
\
--version 11.6.16 "rsc_k8s" \
--set auth.database="connect" \
--set auth.username="${RSC_POSTGRES_PASS}" --set auth.password=
Install NFS with Helm
BYO: The StorageClass
must support ReadWriteMany
and symlinks
helm upgrade --install rsc-nfs kvaps/nfs-server-provisioner \
\
--version 1.4.0 \
--set persistence.enabled=true "100Gi" \
--set persistence.size="rsc-nfs" --set storageClass.name=
Create a values.yaml
file for your Connect installation
Overrides defaults specified in the Helm chart.
View the Helm chart’s entire set of default values:
helm show values rstudio/rstudio-connect
Check what will be generated with helm template
:
helm template rstudio/rstudio-connect -f values.yaml | less
Use values.yaml
to manage the Connect .gcfg
configuration file:
# The config section overwrites values in RStudio Connect's main .gcfg configuration file.
config:
# Configures the Postgres connection for RStudio Connect.
Database:
Provider: "Postgres"
Postgres:
URL: "postgres://connect@rsc-db-postgresql.rstudio-connect.svc.cluster.local:5432/rsc_k8s?sslmode=disable"
# While it is possible to set a Postgres password here in the values file, we recommend providing
# the password at runtime using helm install's --set argument instead
# (e.g. --set config.Postgres.Password=<your-postgres-database-password>)
Launcher:
# Configures the job launcher to use Connect's data dir PVC when launching content jobs
# This has the same value as `sharedStorage.name` above
DataDirPVCName: rsc-pvc
Helm Install RStudio Connect!
(remember I’ve already set the license key and postges password as environment variables)
helm upgrade --install rstudio-connect-prod rstudio/rstudio-connect \
--set license.key="${RSC_LICENSE}" \
--set config.Postgres.Password="${RSC_POSTGRES_PASS}" \
--values values.yaml
- Watch Connect get started:
kubectl get events --watch
- Verify everything is running
kubectl get pods
Access RStudio Connect!
- Test locally with manual port forwarding
- (In AWS Cloud9 use
kube-proxy
to “Preview” the application)