Skip to content

Commit

Permalink
Merge pull request #39 from bbkz/postgres
Browse files Browse the repository at this point in the history
0.1.6-rc.1 Release
  • Loading branch information
bbkz authored Nov 17, 2023
2 parents d5fdedb + 3099384 commit 542695a
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 14 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

Helm charts for wger deployment on Kubernetes


## TL;DR

If you know what you are doing, you can go ahead and run these commands to install wger. Otherwise, keep on reading!
Expand Down Expand Up @@ -197,9 +196,11 @@ The following settings are declared in the groundhog2k Helm charts.
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| `postgres.enabled` | Enable the PostgreSQL chart | Boolean | `True` |
| `postgres.settings.superuser ` | Superuser name | String | `wger` |
| `postgres.settings.superuserPassword` | Password of superuser | String | `wger` |
| `postgres.userDatabase.name` | PostgreSQL database name to use for wger | String | `wger` |
| `postgres.settings.superuser ` | Superuser name | String | `postgres` |
| `postgres.settings.superuserPassword` | Password of superuser | String | `postgres` |
| `postgres.userDatabase.name` | Database name to use for wger | String | `wger` |
| `postgres.userDatabase.user` | Username to use for wger | String | `wger` |
| `postgres.userDatabase.password` | Password for wger user | String | `wger` |
| `postgres.service.port` | PostreSQL service port | Integer | `5432` |
| `postgres.storage.persistentVolumeClaimName` | PVC name when existing storage volume should be used | String | `Nil` |
| `postgres.storage.requestedSize` | Size for new PVC, when no existing PVC is used | Integer | `8Gi` |
Expand Down
35 changes: 35 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## 0.1.6

* get the database credentials from the secret, like the postgres chart does

### Upgrade

#### postgres superuser

The superuser was named `wger`, but this seems to lead to a error in the postgres docker image:

```bash
FATAL: role "postgres" does not exist
```

So you need to manually add a `postgres` superuser:

```bash
kubectl -n wger exec -ti wger-postgres-0 -- bash
psql -U wger

CREATE ROLE postgres WITH LOGIN SUPERUSER PASSWORD 'postgres';
```

As well set the settings in your `values.yaml`:

```yaml
postgres:
settings:
superuser: postgres
superuserPassword: postgres
userDatabase:
name: wger
user: wger
password: wger
```
2 changes: 1 addition & 1 deletion charts/wger/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
apiVersion: v2
version: 0.1.5
version: 0.1.6-rc.1
appVersion: latest
name: wger
description: A Helm chart for Wger installation on Kubernetes
Expand Down
6 changes: 0 additions & 6 deletions charts/wger/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ environment:
value: "True"
- name: DJANGO_DB_ENGINE
value: "django.db.backends.postgresql"
- name: DJANGO_DB_USER
value: {{ .Values.postgres.settings.superuser | quote }}
- name: DJANGO_DB_PASSWORD
value: {{ .Values.postgres.settings.superuserPassword | quote }}
- name: DJANGO_DB_DATABASE
value: {{ .Values.postgres.userDatabase.name | quote }}
- name: DJANGO_DB_HOST
value: "{{ .Release.Name }}-postgres"
- name: DJANGO_DB_PORT
Expand Down
8 changes: 8 additions & 0 deletions charts/wger/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ data:
}
}
{{- end }}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: wger-pg-init
data:
grantSuperuser.sql: |
ALTER USER {{ .Values.postgres.userDatabase.name }} WITH SUPERUSER;
78 changes: 78 additions & 0 deletions charts/wger/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ spec:
secretKeyRef:
name: {{ .Values.app.jwt.secret.name | default "jwt" | quote }}
key: "signing-key"
- name: DJANGO_DB_USER
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_USER"
- name: DJANGO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_PASSWORD"
- name: DJANGO_DB_DATABASE
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "POSTGRES_DB"
{{- if .Values.celery.flower.enabled }}
- name: CELERY_FLOWER_PASSWORD
valueFrom:
Expand Down Expand Up @@ -191,6 +206,21 @@ spec:
secretKeyRef:
name: {{ .Values.app.jwt.secret.name | default "jwt" | quote }}
key: "signing-key"
- name: DJANGO_DB_USER
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_USER"
- name: DJANGO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_PASSWORD"
- name: DJANGO_DB_DATABASE
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "POSTGRES_DB"
{{- if .Values.celery.flower.enabled }}
- name: CELERY_FLOWER_PASSWORD
valueFrom:
Expand Down Expand Up @@ -225,6 +255,21 @@ spec:
secretKeyRef:
name: {{ .Values.app.jwt.secret.name | default "jwt" | quote }}
key: "signing-key"
- name: DJANGO_DB_USER
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_USER"
- name: DJANGO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_PASSWORD"
- name: DJANGO_DB_DATABASE
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "POSTGRES_DB"
- name: CELERY_FLOWER_PASSWORD
valueFrom:
secretKeyRef:
Expand All @@ -239,6 +284,15 @@ spec:
mountPath: /home/wger/src
readOnly: false
{{- end }}
initContainers:
- name: init-container
image: docker.io/busybox:latest
command:
- /bin/sh
- -c
- until nc -zvw10 {{.Release.Name}}-postgres {{ .Values.postgres.service.port }}; do echo "Waiting for postgres service ({{.Release.Name}}-postgres:{{ .Values.postgres.service.port }}) "; sleep 2; done &&
until nc -zvw10 {{.Release.Name}}-redis {{ .Values.redis.service.serverPort }}; do echo "Waiting for redis service ({{.Release.Name}}-redis:{{ .Values.redis.service.serverPort }})"; sleep 2; done &&
until wget --spider http://{{.Release.Name}}-http:8000; do echo "Waiting for wger app service ({{.Release.Name}}-http:8000)"; sleep 2; done
{{- end }}
volumes:
- name: wger-media
Expand Down Expand Up @@ -311,6 +365,21 @@ spec:
secretKeyRef:
name: {{ .Values.app.jwt.secret.name | default "jwt" | quote }}
key: "signing-key"
- name: DJANGO_DB_USER
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_USER"
- name: DJANGO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "USERDB_PASSWORD"
- name: DJANGO_DB_DATABASE
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-postgres"
key: "POSTGRES_DB"
{{- if .Values.celery.flower.enabled }}
- name: CELERY_FLOWER_PASSWORD
valueFrom:
Expand All @@ -328,6 +397,15 @@ spec:
mountPath: /home/wger/src
readOnly: false
{{- end }}
initContainers:
- name: init-container
image: docker.io/busybox:latest
command:
- /bin/sh
- -c
- until nc -zvw10 {{.Release.Name}}-postgres {{ .Values.postgres.service.port }}; do echo "Waiting for postgres service ({{.Release.Name}}-postgres:{{ .Values.postgres.service.port }}) "; sleep 2; done &&
until nc -zvw10 {{.Release.Name}}-redis {{ .Values.redis.service.serverPort }}; do echo "Waiting for redis service ({{.Release.Name}}-redis:{{ .Values.redis.service.serverPort }})"; sleep 2; done &&
until wget --spider http://{{.Release.Name}}-http:8000; do echo "Waiting for wger app service ({{.Release.Name}}-http:8000)"; sleep 2; done
volumes:
- name: wger-media
persistentVolumeClaim:
Expand Down
12 changes: 9 additions & 3 deletions charts/wger/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,19 @@ service:
# PostgreSQL Settings for groundhog2k chart. Only a minimum has been specified below.
# For more options, see https://github.com/groundhog2k/helm-charts/tree/master/charts/postgres
postgres:
# Note: keep these variables present as the chart uses them for the Deployment
# Note: keep these variables present as the wger chart uses them for the deployment
# the superuser and user settings will be saved into a secret
enabled: true
# after the first installation the superuser and userDatabase settings will be ignored
# they will be taken from the secret
settings:
superuser: wger
superuserPassword: wger
superuser: postgres
superuserPassword: postgres
userDatabase:
name: wger
user: wger
password: wger
extraScripts: wger-pg-init
service:
port: 5432
resources:
Expand Down

0 comments on commit 542695a

Please sign in to comment.