Fix and upgrade postgres/redis across the line

Still need to move all postgres installs onto version 11 of the chart,
and ensure redis works with the latest available version as well

Replaces: !35 !36 !37
Fixes: #11 #22
This commit is contained in:
Alexander Olofsson 2022-06-03 11:59:49 +02:00
parent b7c32dd631
commit 5b9bfdff7d
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
14 changed files with 100 additions and 89 deletions

View file

@ -1,4 +1,4 @@
{{- $m_homeserver := (dict "base_url" (required "Must specify a default homeserver" .Values.defaultServer.url) "server_name" (required "Must specify a default server name" .Values.defaultServer.name)) -}}
{{- $m_homeserver := (dict "base_url" (required "Must specify a defaultServer.url for a homeserver" .Values.defaultServer.url) "server_name" (required "Must specify a defaultServer.name for the homeserver" .Values.defaultServer.name)) -}}
{{- $m_identity_server := (dict "base_url" (.Values.defaultServer.identity_url | default "https://vector.im")) -}}
{{- $default_server_config := dict "default_server_config" (dict "m.homeserver" $m_homeserver "m.identity_server" $m_identity_server) -}}
---

View file

@ -4,14 +4,14 @@ appVersion: "1.2.3"
description: A social platform to enjoy and share music
icon: https://funkwhale.audio/favicon.png
name: funkwhale
version: 0.4.7
version: 0.5.0
dependencies:
- name: redis
version: ~10.6.10
version: ^15.7.0
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
- name: postgresql
version: ~10.9.4
version: ^10.9.4
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled

View file

@ -6,13 +6,18 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "funkwhale.postgresql.host" -}}
{{- $name := .Values.postgresql.nameOverride | default "postgresql" -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "funkwhale.dbUrl" -}}
{{- if .Values.database -}}
{{ fail "You are using the old database config key - please update your values to the new postgresql config key" }}
{{- else if and .Values.postgresql.enabled .Values.postgresql.host -}}
{{ fail "Both postgresql.enabled and postgresql.host have been specified - you may want to set postgresql.enabled=false if you want to use an external database" }}
{{- else if .Values.postgresql.enabled -}}
postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ template "funkwhale.fullname" . }}-postgresql:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }}
postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ template "funkwhale.postgresql.host" . }}:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }}
{{- else if .Values.postgresql.host -}}
postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ .Values.postgresql.host }}:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }}
{{- else -}}
@ -52,13 +57,18 @@ Create the correct image tag name
{{- .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{- define "funkwhale.redis.host" -}}
{{- $name := .Values.redis.nameOverride | default "redis" -}}
{{- printf "%s-%s-%s" .Release.Name $name "master" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "funkwhale.redisUrl" -}}
{{- if and .Values.redis.enabled .Values.redis.host -}}
{{ fail "Setting both redis.enabled and redis.host will deploy an internal Redis service and attempt to use an external one - please set only one of the two!" }}
{{ fail "Setting both redis.enabled and redis.host would deploy an internal Redis service and attempt to use an external one - please set only one of the two!" }}
{{- else if .Values.redis.enabled -}}
redis://:{{ .Values.redis.password }}@{{ template "funkwhale.fullname" . }}-redis-master:{{ .Values.redis.redisPort }}/0
redis://:{{ .Values.redis.auth.password }}@{{ template "funkwhale.redis.host" . }}:{{ .Values.redis.master.service.port | default 6379 }}/0
{{- else if .Values.redis.host -}}
redis://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ .Values.redis.redisPort }}/0
redis://:{{ .Values.redis.auth.password }}@{{ .Values.redis.host }}:{{ .Values.redis.master.service.port | default 6379 }}/0
{{- else -}}
{{ fail "Either redis.enabled or redis.host are required!" }}
{{- end -}}

View file

@ -80,14 +80,17 @@ redis:
## External Redis hostname or IP
# host: redis.example.com
redisPort: 6379
password: funkwhale
cluster:
enabled: false
auth:
enabled: true
password: funkwhale
architecture: standalone
master:
persistence:
enabled: false
service:
port: 6379
slave:
persistence:
enabled: false

View file

@ -5,17 +5,17 @@ description: Matrix media repository with multi-domain in mind.
appVersion: 1.2.12
type: application
version: 1.0.8
version: 1.1.0
maintainers:
- name: Alexander Olofsson
email: ace@haxalot.com
dependencies:
- name: postgresql
version: ~8.9.4
version: ^10.9.4
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: redis
version: ~10.6.10
version: ^15.7.0
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled

View file

@ -74,7 +74,8 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "matrix-media-repo.postgresql.fullname" -}}
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
{{- $name := .Values.postgresql.nameOverride | default "postgresql" -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
@ -104,11 +105,7 @@ Set postgres port
*/}}
{{- define "matrix-media-repo.postgresql.port" -}}
{{- if .Values.postgresql.enabled -}}
{{- if .Values.postgresql.service -}}
{{- default 5432 .Values.postgresql.service.port }}
{{- else -}}
5432
{{- end -}}
{{- .Values.postgresql.service.port | default 5432 }}
{{- else -}}
{{- required "A valid externalPostgresql.port is required" .Values.externalPostgresql.port -}}
{{- end -}}
@ -119,7 +116,7 @@ Set postgresql username
*/}}
{{- define "matrix-media-repo.postgresql.username" -}}
{{- if .Values.postgresql.enabled -}}
{{- default "postgres" .Values.postgresql.postgresqlUsername }}
{{- .Values.postgresql.postgresqlUsername | default "postgres" }}
{{- else -}}
{{ required "A valid externalPostgresql.username is required" .Values.externalPostgresql.username }}
{{- end -}}
@ -130,7 +127,7 @@ Set postgresql password
*/}}
{{- define "matrix-media-repo.postgresql.password" -}}
{{- if .Values.postgresql.enabled -}}
{{- default "" .Values.postgresql.postgresqlPassword }}
{{- .Values.postgresql.postgresqlPassword | default "" }}
{{- else -}}
{{ required "A valid externalPostgresql.password is required" .Values.externalPostgresql.password }}
{{- end -}}
@ -141,7 +138,7 @@ Set postgresql database
*/}}
{{- define "matrix-media-repo.postgresql.database" -}}
{{- if .Values.postgresql.enabled -}}
{{- default "synapse" .Values.postgresql.postgresqlDatabase }}
{{- .Values.postgresql.postgresqlDatabase | default "synapse" }}
{{- else -}}
{{ required "A valid externalPostgresql.database is required" .Values.externalPostgresql.database }}
{{- end -}}
@ -153,7 +150,8 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "matrix-media-repo.redis.fullname" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- $name := .Values.redis.nameOverride | default "redis" -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
@ -161,7 +159,7 @@ Set redis host
*/}}
{{- define "matrix-media-repo.redis.host" -}}
{{- if .Values.redis.enabled -}}
{{- template "matrix-media-repo.redis.fullname" . -}}-master
{{- printf "%s-%s" (include "matrix-media-repo.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{ required "A valid externalRedis.host is required" .Values.externalRedis.host }}
{{- end -}}
@ -172,7 +170,11 @@ Set redis secret
*/}}
{{- define "matrix-media-repo.redis.secret" -}}
{{- if .Values.redis.enabled -}}
{{- if .Values.redis.auth.existingSecret -}}
{{ .Values.redis.auth.existingSecret }}
{{- else -}}
{{- template "matrix-media-repo.redis.fullname" . -}}
{{- end -}}
{{- else -}}
{{- template "matrix-media-repo.fullname" . -}}
{{- end -}}
@ -183,23 +185,12 @@ Set redis port
*/}}
{{- define "matrix-media-repo.redis.port" -}}
{{- if .Values.redis.enabled -}}
{{- default 6379 .Values.redis.redisPort }}
{{- .Values.redis.master.service.port | default 6379 }}
{{- else -}}
{{ required "A valid externalRedis.port is required" .Values.externalRedis.port }}
{{- end -}}
{{- end -}}
{{/*
Set redis password
*/}}
{{- define "matrix-media-repo.redis.user" -}}
{{- if .Values.redis.enabled -}}
{{ .Values.redis.user }}
{{- else if .Values.externalRedis.user -}}
{{ .Values.externalRedis.user }}
{{- end -}}
{{- end -}}
{{/*
Set redis password
*/}}

View file

@ -72,6 +72,9 @@ spec:
name: secrets
- mountPath: /media
name: data
{{- with .Values.extraVolumeMounts }}
{{- . | toYaml | nindent 12 }}
{{- end }}
volumes:
- name: empty-combined
emptyDir: {}
@ -88,6 +91,9 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.extraVolumes }}
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}

View file

@ -20,29 +20,27 @@ stringData:
databaseNumber: 0
shards:
{{- $redisHost := include "matrix-media-repo.redis.host" . }}
{{- $redisPort := include "matrix-media-repo.redis.port" . }}
{{- if .Values.redis.usePassword }}
{{- $redisUser := include "matrix-media-repo.redis.usr" . }}
{{- $redisPort := include "matrix-media-repo.redis.master.service.port" . }}
{{- if .Values.redis.auth.enabled }}
{{- $redisPass := include "matrix-media-repo.redis.password" . }}
- name: k8s
addr: "redis://{{ $redisUser }}:{{ $redisPass}}@{{ $redisHost }}:{{ $redisPort }}/0"
addr: "redis://:{{ $redisPass }}@{{ $redisHost }}:{{ $redisPort }}/0"
{{- else }}
- name: k8s
addr: "{{ $redisHost }}:{{ $redisPass }}"
addr: "{{ $redisHost }}:{{ $redisPort }}"
{{- end }}
{{- else if .Values.externalRedis.host }}
enabled: {{ .Values.externalRedis.host }}
enabled: true
databaseNumber: {{ .Values.externalRedis.database | default 0 }}
shards:
{{- $redisHost := include "matrix-media-repo.redis.host" . }}
{{- $redisPort := include "matrix-media-repo.redis.port" . }}
{{- $redisUser := include "matrix-media-repo.redis.usr" . }}
{{- $redisPass := include "matrix-media-repo.redis.password" . }}
- name: external
{{- if (or $redisUser $redisPass) }}
addr: "redis://{{ $redisUser }}:{{ $redisPass}}@{{ $redisHost }}:{{ $redisPort }}/0"
{{- if $redisPass }}
addr: "redis://:{{ $redisPass}}@{{ $redisHost }}:{{ $redisPort }}/{{ .Values.externalRedis.database | default 0 }}"
{{- else }}
addr: {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }}
addr: "{{ $redisHost }}:{{ $redisPort }}"
{{- end }}
{{- else }}
enabled: false

View file

@ -54,6 +54,10 @@ config:
extraRepo: {}
# useForwardedHost: false
extraVolumes: []
extraVolumeMounts: []
## Per-domain configuration.
## Ref: https://github.com/turt2live/matrix-media-repo/blob/master/docs/config.md
##
@ -103,23 +107,20 @@ externalPostgresql:
redis:
enabled: false
usePassword: true
# XXX Change me!
password: media-repo
auth:
enabled: true
# XXX Change me!
password: media-repo
## Or use existing secret with "redis-password" key
## instead of static password
##
# existingSecret: redis-secret
cluster:
enabled: false
architecture: standalone
master:
persistence:
## Note that Synapse only uses redis as a synchronization utility, so no
## data will ever need to be persisted.
##
enabled: false
service:
port: 6379
statefulset:
updateStrategy: RollingUpdate
@ -128,7 +129,6 @@ redis:
externalRedis:
# host: redis
port: 6379
# user: media-repo
# password: media-repo
# database: 0

View file

@ -6,17 +6,17 @@ icon: https://matrix.org/images/matrix-logo.svg
appVersion: 1.60.0
type: application
version: 2.1.39
version: 2.2.0
maintainers:
- name: Alexander Olofsson
email: ace@haxalot.com
dependencies:
- name: postgresql
version: ~8.9.4
version: ^10.9.4
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: redis
version: ~16.1.0
version: ^16.1.0
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled

View file

@ -3,7 +3,7 @@
Expand the name of the chart.
*/}}
{{- define "matrix-synapse.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- .Values.nameOverride | default .Chart.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
@ -15,7 +15,7 @@ If release name contains chart name it will be used as a full name.
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- $name := .Values.nameOverride | default .Chart.Name -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
@ -108,14 +108,6 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "matrix-synapse.redis.fullname" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Set postgres host
*/}}
@ -144,7 +136,7 @@ Set postgres port
{{- define "matrix-synapse.postgresql.port" -}}
{{- if .Values.postgresql.enabled -}}
{{- if .Values.postgresql.service -}}
{{- default 5432 .Values.postgresql.service.port }}
{{- .Values.postgresql.service.port | default 5432 }}
{{- else -}}
5432
{{- end -}}
@ -158,7 +150,7 @@ Set postgresql username
*/}}
{{- define "matrix-synapse.postgresql.username" -}}
{{- if .Values.postgresql.enabled -}}
{{- default "postgres" .Values.postgresql.postgresqlUsername }}
{{- .Values.postgresql.postgresqlUsername | default "postgres" }}
{{- else -}}
{{ required "A valid externalPostgresql.username is required" .Values.externalPostgresql.username }}
{{- end -}}
@ -169,7 +161,7 @@ Set postgresql password
*/}}
{{- define "matrix-synapse.postgresql.password" -}}
{{- if .Values.postgresql.enabled -}}
{{- default "" .Values.postgresql.postgresqlPassword }}
{{- .Values.postgresql.postgresqlPassword | default "" }}
{{- else if not (and .Values.externalPostgresql.existingSecret .Values.externalPostgresql.existingSecretPasswordKey) -}}
{{ required "A valid externalPostgresql.password is required" .Values.externalPostgresql.password }}
{{- end -}}
@ -180,7 +172,7 @@ Set postgresql database
*/}}
{{- define "matrix-synapse.postgresql.database" -}}
{{- if .Values.postgresql.enabled -}}
{{- default "synapse" .Values.postgresql.postgresqlDatabase }}
{{- .Values.postgresql.postgresqlDatabase | default "synapse" }}
{{- else -}}
{{ required "A valid externalPostgresql.database is required" .Values.externalPostgresql.database }}
{{- end -}}
@ -191,9 +183,9 @@ Set postgresql sslmode
*/}}
{{- define "matrix-synapse.postgresql.sslmode" -}}
{{- if .Values.postgresql.enabled -}}
{{- default "prefer" .Values.postgresql.sslmode }}
{{- .Values.postgresql.sslmode | default "prefer" }}
{{- else -}}
{{- default "prefer" .Values.externalPostgresql.sslmode }}
{{- .Values.externalPostgresql.sslmode | default "prefer" }}
{{- end -}}
{{- end -}}
@ -216,12 +208,20 @@ for a list of options that can be passed.
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "matrix-synapse.redis.fullname" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Set redis host
*/}}
{{- define "matrix-synapse.redis.host" -}}
{{- if .Values.redis.enabled -}}
{{- template "matrix-synapse.redis.fullname" . -}}-master
{{- printf "%s-%s" (include "matrix-synapse.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{ required "A valid externalRedis.host is required" .Values.externalRedis.host }}
{{- end -}}
@ -243,7 +243,7 @@ Set redis port
*/}}
{{- define "matrix-synapse.redis.port" -}}
{{- if .Values.redis.enabled -}}
{{- default 6379 .Values.redis.redisPort }}
{{- .Values.redis.master.service.port | default 6379 }}
{{- else -}}
{{ required "A valid externalRedis.port is required" .Values.externalRedis.port }}
{{- end -}}

View file

@ -654,6 +654,7 @@ redis:
enabled: true
auth:
enabled: true
# XXX Change me!
password: synapse
@ -669,6 +670,8 @@ redis:
## data will ever need to be persisted.
##
enabled: false
service:
port: 6379
statefulset:
updateStrategy: RollingUpdate

View file

@ -10,16 +10,16 @@ icon: https://raw.githubusercontent.com/digitalocean/netbox/develop/netbox/proje
appVersion: 3.1.0
type: application
version: 4.1.0
version: 4.2.0
maintainers:
- name: Alexander Olofsson
email: ace@haxalot.com
dependencies:
- name: postgresql
version: '> 8, < 11'
version: ^10.6.0
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: redis
version: ~15
version: ^15.7.0
repository: https://charts.bitnami.com/bitnami

View file

@ -6,10 +6,6 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "netbox.redisHost" -}}
{{ template "netbox.fullname" . }}-redis-master
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
@ -46,7 +42,7 @@ Get the correct image tag name
Get the installed postgresql fullname
*/}}
{{- define "netbox.postgresql.fullname" -}}
{{- $name := default "postgresql" .Values.postgresql.nameOverride -}}
{{- $name := .Values.postgresql.nameOverride | default "postgresql" -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@ -54,6 +50,10 @@ Get the installed postgresql fullname
Get the installed redis fullname
*/}}
{{- define "netbox.redis.fullname" -}}
{{- $name := default "redis" .Values.redis.nameOverride -}}
{{- $name := .Values.redis.nameOverride | default "redis" -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "netbox.redisHost" -}}
{{- printf "%s-%s" (include "netbox.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}}
{{- end -}}