Skip to content

Commit

Permalink
Merge pull request #514 from rstudio/tn-workbench-database-env
Browse files Browse the repository at this point in the history
workbench: Add database config and pass as env variable to README
  • Loading branch information
tnederlof committed May 22, 2024
2 parents 11b4dff + b6e684e commit cf9447d
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/rstudio-workbench/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: rstudio-workbench
description: Official Helm chart for Posit Workbench
version: 0.7.4
version: 0.7.5
apiVersion: v2
appVersion: 2024.04.0
icon: https://rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-Flat.png
Expand Down
4 changes: 4 additions & 0 deletions charts/rstudio-workbench/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.7.5

- Add documentation about PostgreSQL database configuration and mounting passwords from secrets as env variables

## 0.7.4

- Documentation site updates
Expand Down
46 changes: 43 additions & 3 deletions charts/rstudio-workbench/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Posit Workbench

![Version: 0.7.4](https://img.shields.io/badge/Version-0.7.4-informational?style=flat-square) ![AppVersion: 2024.04.0](https://img.shields.io/badge/AppVersion-2024.04.0-informational?style=flat-square)
![Version: 0.7.5](https://img.shields.io/badge/Version-0.7.5-informational?style=flat-square) ![AppVersion: 2024.04.0](https://img.shields.io/badge/AppVersion-2024.04.0-informational?style=flat-square)

#### _Official Helm chart for Posit Workbench_

Expand All @@ -24,11 +24,11 @@ To ensure a stable production deployment:

## Installing the chart

To install the chart with the release name `my-release` at version 0.7.4:
To install the chart with the release name `my-release` at version 0.7.5:

```{.bash}
helm repo add rstudio https://helm.rstudio.com
helm upgrade --install my-release rstudio/rstudio-workbench --version=0.7.4
helm upgrade --install my-release rstudio/rstudio-workbench --version=0.7.5
```

To explore other chart versions, look at:
Expand Down Expand Up @@ -105,6 +105,46 @@ Alternatively, license files can be set during `helm install` with the following
--set-file license.file.contents=licenses/rstudio-workbench.lic
```

## Database

Workbench requires a PostgreSQL database when running in Kubernetes. You must configure a [valid connection URI and a password](https://docs.posit.co/ide/server-pro/database/configuration.html#postgresql) for the product to function correctly. Both the connection URI and password may be specified in the `config` section of `values.yaml`. However, we recommend only adding the connection URI and putting the database password in a Kubernetes `Secret`, which can be [automatically set as an environment variable](#database-password).

### Database configuration

Add the following to your `values.yaml`, replacing the `connection-uri` with your database details.

```yaml
config:
secret:
database.conf:
provider: "postgresql"
connection-uri: "postgres://<USERNAME>@<HOST>:<PORT>/<DATABASE>?sslmode=allow"
```

### Database password

First, create a `Secret` declaratively with YAML or imperatively using the following command (replacing with your actual password):

```bash
kubectl create secret generic rstudio-workbench-database --from-literal=password=YOURPASSWORDHERE
```

Second, specify the following in your `values.yaml`:

```yaml
pod:
env:
- name: WORKBENCH_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: rstudio-workbench-database
key: password
```

Alternatively, database passwords may be set during `helm install` with the following argument:

`--set config.secret.'database\.conf'.password="<YOUR_PASSWORD_HERE>"`

## General principles

- In most places, we opt to pass Helm values directly into ConfigMaps. We automatically translate these into the
Expand Down
40 changes: 40 additions & 0 deletions charts/rstudio-workbench/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,46 @@ To function, this chart requires the following:
```
{{ template "rstudio.licensing" . }}

## Database

Workbench requires a PostgreSQL database when running in Kubernetes. You must configure a [valid connection URI and a password](https://docs.posit.co/ide/server-pro/database/configuration.html#postgresql) for the product to function correctly. Both the connection URI and password may be specified in the `config` section of `values.yaml`. However, we recommend only adding the connection URI and putting the database password in a Kubernetes `Secret`, which can be [automatically set as an environment variable](#database-password).

### Database configuration

Add the following to your `values.yaml`, replacing the `connection-uri` with your database details.

```yaml
config:
secret:
database.conf:
provider: "postgresql"
connection-uri: "postgres://<USERNAME>@<HOST>:<PORT>/<DATABASE>?sslmode=allow"
```

### Database password

First, create a `Secret` declaratively with YAML or imperatively using the following command (replacing with your actual password):

```bash
kubectl create secret generic {{ .Name }}-database --from-literal=password=YOURPASSWORDHERE
```

Second, specify the following in your `values.yaml`:

```yaml
pod:
env:
- name: WORKBENCH_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Name }}-database
key: password
```

Alternatively, database passwords may be set during `helm install` with the following argument:

`--set config.secret.'database\.conf'.password="<YOUR_PASSWORD_HERE>"`

## General principles

- In most places, we opt to pass Helm values directly into ConfigMaps. We automatically translate these into the
Expand Down

0 comments on commit cf9447d

Please sign in to comment.