funkwhale: Clean up and drop UNIX-socketification

To bring the chart up to scratch for a 0.major bump
If things work out well then this will be what's promoted to a 1.0
This commit is contained in:
Alexander "Ace" Olofsson 2021-09-26 21:57:52 +02:00
parent 7036770f81
commit 221330626f
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
6 changed files with 61 additions and 54 deletions

View file

@ -7,8 +7,10 @@ Expand the name of the chart.
{{- end -}} {{- end -}}
{{- define "funkwhale.dbUrl" -}} {{- define "funkwhale.dbUrl" -}}
{{- if and .Values.postgresql.enabled .Values.postgresql.host -}} {{- if .Values.database -}}
{{ fail "Setting both postgresql.enabled and postgresql.host will deploy an internal Postgres service and attempt to use an external one - please set only one of the two!" }} {{ 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 -}} {{- 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.fullname" . }}-postgresql:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }}
{{- else if .Values.postgresql.host -}} {{- else if .Values.postgresql.host -}}
@ -18,10 +20,6 @@ postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.pos
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if .Values.database.user -}}
{{ fail "You are using the old database config key - please migrate to the new postgresql config key" }}
{{- end -}}
{{/* {{/*
Create a default fully qualified app name. 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). We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).

View file

@ -12,7 +12,7 @@ metadata:
data: data:
nginx.conf: | nginx.conf: |
upstream funkwhale-api { upstream funkwhale-api {
server unix:/run/funkwhale/funkwhale.sock; server localhost:5000;
} }
map $http_upgrade $connection_upgrade { map $http_upgrade $connection_upgrade {

View file

@ -5,10 +5,10 @@ metadata:
name: {{ include "funkwhale.fullname" . }}-beat name: {{ include "funkwhale.fullname" . }}-beat
labels: labels:
app.kubernetes.io/name: {{ include "funkwhale.name" . }} app.kubernetes.io/name: {{ include "funkwhale.name" . }}
helm.sh/chart: {{ include "funkwhale.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
audio.funkwhale/component: celery-beat audio.funkwhale/component: celery-beat
helm.sh/chart: {{ include "funkwhale.chart" . }}
spec: spec:
replicas: 1 replicas: 1
selector: selector:

View file

@ -5,10 +5,10 @@ metadata:
name: {{ include "funkwhale.fullname" . }}-worker name: {{ include "funkwhale.fullname" . }}-worker
labels: labels:
app.kubernetes.io/name: {{ include "funkwhale.name" . }} app.kubernetes.io/name: {{ include "funkwhale.name" . }}
helm.sh/chart: {{ include "funkwhale.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
audio.funkwhale/component: celery-worker audio.funkwhale/component: celery-worker
helm.sh/chart: {{ include "funkwhale.chart" . }}
spec: spec:
replicas: {{ .Values.celery.worker.replicaCount }} replicas: {{ .Values.celery.worker.replicaCount }}
selector: selector:

View file

@ -1,3 +1,6 @@
{{- if .Values.api.readinessProbe.exec -}}
{{ fail "Your values are still using the old readinessProbe values, this will no longer work as expected" }}
{{- end -}}
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
@ -5,10 +8,10 @@ metadata:
name: {{ include "funkwhale.fullname" . }} name: {{ include "funkwhale.fullname" . }}
labels: labels:
app.kubernetes.io/name: {{ include "funkwhale.name" . }} app.kubernetes.io/name: {{ include "funkwhale.name" . }}
helm.sh/chart: {{ include "funkwhale.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
audio.funkwhale/component: app audio.funkwhale/component: app
helm.sh/chart: {{ include "funkwhale.chart" . }}
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
selector: selector:
@ -34,20 +37,15 @@ spec:
- sh - sh
- -c - -c
- |- - |-
set -x
# Copy frontend files for the front pod # Copy frontend files for the front pod
cp -r frontend/* /srv/funkwhale/frontend/ cp -r frontend/* /srv/funkwhale/frontend/
# Apply any waiting migrations # Apply any waiting migrations
/app/manage.py migrate /app/manage.py migrate
# Make the server bind to a unix socket
if [ -e compose/django/daphne.sh ]; then if [ -e compose/django/daphne.sh ]; then
sed -e 's!-b 0.0.0.0 -p 5000!-u /run/funkwhale/funkwhale.sock!' -i compose/django/daphne.sh
compose/django/entrypoint.sh compose/django/daphne.sh compose/django/entrypoint.sh compose/django/daphne.sh
else else
sed -e 's!0.0.0.0:5000!unix:/run/funkwhale/funkwhale.sock!' -i compose/django/server.sh
compose/django/entrypoint.sh compose/django/server.sh compose/django/entrypoint.sh compose/django/server.sh
fi fi
readinessProbe: readinessProbe:
@ -62,8 +60,6 @@ spec:
- secretRef: - secretRef:
name: {{ include "funkwhale.fullname" . }} name: {{ include "funkwhale.fullname" . }}
volumeMounts: volumeMounts:
- mountPath: /run/funkwhale
name: funkwhale-sock
- mountPath: /srv/funkwhale/data/static/ - mountPath: /srv/funkwhale/data/static/
name: static name: static
- mountPath: /srv/funkwhale/frontend - mountPath: /srv/funkwhale/frontend
@ -73,6 +69,10 @@ spec:
{{- with .Values.api.extraVolumeMounts }} {{- with .Values.api.extraVolumeMounts }}
{{ toYaml . | nindent 12 }} {{ toYaml . | nindent 12 }}
{{- end }} {{- end }}
ports:
- name: api
containerPort: 5000
protocol: TCP
resources: resources:
{{- toYaml .Values.api.resources | nindent 12 }} {{- toYaml .Values.api.resources | nindent 12 }}
- name: nginx - name: nginx
@ -104,8 +104,6 @@ spec:
startupProbe: startupProbe:
{{ toYaml .Values.front.startupProbe | nindent 12 }} {{ toYaml .Values.front.startupProbe | nindent 12 }}
volumeMounts: volumeMounts:
- mountPath: /run/funkwhale
name: funkwhale-sock
- mountPath: /srv/funkwhale/data - mountPath: /srv/funkwhale/data
name: data name: data
- mountPath: /frontend - mountPath: /frontend
@ -135,8 +133,6 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes:
- name: funkwhale-sock
emptyDir: {}
- name: frontend - name: frontend
emptyDir: {} emptyDir: {}
- name: static - name: static

View file

@ -31,15 +31,15 @@ ingress:
# - chart-example.local # - chart-example.local
postgresql: postgresql:
# If you already have a Postgresql service you'd like to use, set ## If you already have a Postgresql service you'd like to use, set
# this to false and adjust the host to use your existing service. ## this to false and adjust the host to use your existing service.
enabled: true enabled: true
## Database host ## External Postgresql hostname or IP
host: "" # host: postgresql.example.com
## Database user ## Database user
postgresqlUsername: postgres postgresqlUsername: funkwhale
## Database password ## Database password
postgresqlPassword: funkwhale postgresqlPassword: funkwhale
@ -51,19 +51,21 @@ postgresql:
service: service:
port: 5432 port: 5432
## Database storage configuration
persistence: persistence:
enabled: true enabled: true
# storageClass: "" # storageClass: ""
# size: 8Gi # size: 8Gi
redis: redis:
# If you already have a Redis service you'd like to use, set ## If you already have a Redis service you'd like to use, set
# this to false and adjust the host to use your existing service. ## this to false and adjust the host to use your existing service.
enabled: true enabled: true
host: '' ## External Redis hostname or IP
# host: redis.example.com
redisPort: 6379 redisPort: 6379
password: 'funkwhale' password: funkwhale
cluster: cluster:
enabled: false enabled: false
@ -74,8 +76,10 @@ redis:
persistence: persistence:
enabled: false enabled: false
## Django secret to use for encoding cookies/macaroons
djangoSecret: '' djangoSecret: ''
## Additional environment variables to set
extraEnv: {} extraEnv: {}
# LDAP_ENABLED: "True" # LDAP_ENABLED: "True"
# LDAP_ROOT_DN: dc=example,dc=com # LDAP_ROOT_DN: dc=example,dc=com
@ -84,23 +88,26 @@ extraEnv: {}
# LDAP_START_TLS: "True" # LDAP_START_TLS: "True"
# MEDIA_ROOT: /srv/funkwhale/data/media # MEDIA_ROOT: /srv/funkwhale/data/media
## Additional secret environment variables to set
extraSecret: {} extraSecret: {}
# EMAIL_CONFIG: smtp:// # EMAIL_CONFIG: smtp://
# DEFAULT_FROM_EMAIL: funkwhale@example.com # DEFAULT_FROM_EMAIL: funkwhale@example.com
## PVC-based data storage configuration
persistence: persistence:
enabled: false enabled: false
# existingClaim: netbox-data # existingClaim: netbox-data
# storageClass: "-" # storageClass: "-"
# Note; Using ReadWriteOnce for persistence will require the addition of ## Note; Using ReadWriteOnce for persistence will require the addition of
# a required affinity for the celery worker, as well as the use of only a ## a required affinity for the celery worker, as well as the use of only a
# single api replica. ## single api replica.
# ##
# An example is provided for the worker affinity ## An example is provided for the worker affinity
accessMode: ReadWriteMany accessMode: ReadWriteMany
size: 1Gi size: 1Gi
## S3-based data storage configuration
s3: s3:
enabled: false enabled: false
proxy: true proxy: true
@ -112,13 +119,16 @@ s3:
# location: /funkwhale # location: /funkwhale
# url: http://s3.example.com # url: http://s3.example.com
## API server configuration
api: api:
# Additional mounts to add to the API container ## Additional mounts to add to the API container
## If using an external media mount it needs to be attached to both API and Front
extraVolumeMounts: [] extraVolumeMounts: []
# - name: extra-music-data # - name: extra-music-data
# mountPath: /srv/funkwhale/data/music # mountPath: /srv/funkwhale/data/music
# readOnly: true # readOnly: true
## Additional volumes to add to the API container
extraVolumes: [] extraVolumes: []
# - name: extra-music-data # - name: extra-music-data
# persistentVolumeClaim: # persistentVolumeClaim:
@ -137,36 +147,37 @@ api:
tolerations: [] tolerations: []
affinity: {} affinity: {}
readinessProbe: readinessProbe:
exec: httpGet:
command: path: /
- stat port: api
- /run/funkwhale/funkwhale.sock scheme: HTTP
livenessProbe: livenessProbe:
exec: httpGet:
command: path: /
- stat port: api
- /run/funkwhale/funkwhale.sock scheme: HTTP
startupProbe: startupProbe:
exec: tcpSocket:
command: port: api
- stat
- /run/funkwhale/funkwhale.sock
## Web frontend and proxy
front: front:
image: image:
repository: nginx repository: nginx
tag: stable tag: stable
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# Additional mounts to add to the frontend container ## Additional mounts to add to the frontend container
extraVolumeMounts: [] extraVolumeMounts: []
# - name: extra-music-data # - name: extra-music-data
# mountPath: /srv/funkwhale/data/music # mountPath: /srv/funkwhale/data/music
# readOnly: true # readOnly: true
## Additional volumes to add to the frontend container
extraVolumes: [] extraVolumes: []
# - name: extra-music-data # - name: extra-music-data
# persistentVolumeClaim: # persistentVolumeClaim:
@ -188,11 +199,13 @@ front:
httpGet: httpGet:
path: / path: /
port: http port: http
scheme: HTTP
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
port: http port: http
scheme: HTTP
startupProbe: startupProbe:
tcpSocket: tcpSocket: