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 -}}
{{- define "funkwhale.dbUrl" -}}
{{- if and .Values.postgresql.enabled .Values.postgresql.host -}}
{{ 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!" }}
{{- 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 }}
{{- else if .Values.postgresql.host -}}
@ -18,10 +20,6 @@ postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.pos
{{- 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.
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:
nginx.conf: |
upstream funkwhale-api {
server unix:/run/funkwhale/funkwhale.sock;
server localhost:5000;
}
map $http_upgrade $connection_upgrade {

View file

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

View file

@ -5,10 +5,10 @@ metadata:
name: {{ include "funkwhale.fullname" . }}-worker
labels:
app.kubernetes.io/name: {{ include "funkwhale.name" . }}
helm.sh/chart: {{ include "funkwhale.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
audio.funkwhale/component: celery-worker
helm.sh/chart: {{ include "funkwhale.chart" . }}
spec:
replicas: {{ .Values.celery.worker.replicaCount }}
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
kind: Deployment
@ -5,10 +8,10 @@ metadata:
name: {{ include "funkwhale.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "funkwhale.name" . }}
helm.sh/chart: {{ include "funkwhale.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
audio.funkwhale/component: app
helm.sh/chart: {{ include "funkwhale.chart" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
@ -34,20 +37,15 @@ spec:
- sh
- -c
- |-
set -x
# Copy frontend files for the front pod
cp -r frontend/* /srv/funkwhale/frontend/
# Apply any waiting migrations
/app/manage.py migrate
# Make the server bind to a unix socket
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
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
fi
readinessProbe:
@ -62,8 +60,6 @@ spec:
- secretRef:
name: {{ include "funkwhale.fullname" . }}
volumeMounts:
- mountPath: /run/funkwhale
name: funkwhale-sock
- mountPath: /srv/funkwhale/data/static/
name: static
- mountPath: /srv/funkwhale/frontend
@ -73,6 +69,10 @@ spec:
{{- with .Values.api.extraVolumeMounts }}
{{ toYaml . | nindent 12 }}
{{- end }}
ports:
- name: api
containerPort: 5000
protocol: TCP
resources:
{{- toYaml .Values.api.resources | nindent 12 }}
- name: nginx
@ -104,8 +104,6 @@ spec:
startupProbe:
{{ toYaml .Values.front.startupProbe | nindent 12 }}
volumeMounts:
- mountPath: /run/funkwhale
name: funkwhale-sock
- mountPath: /srv/funkwhale/data
name: data
- mountPath: /frontend
@ -135,8 +133,6 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: funkwhale-sock
emptyDir: {}
- name: frontend
emptyDir: {}
- name: static

View file

@ -31,15 +31,15 @@ ingress:
# - chart-example.local
postgresql:
# 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.
## 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.
enabled: true
## Database host
host: ""
## External Postgresql hostname or IP
# host: postgresql.example.com
## Database user
postgresqlUsername: postgres
postgresqlUsername: funkwhale
## Database password
postgresqlPassword: funkwhale
@ -51,19 +51,21 @@ postgresql:
service:
port: 5432
## Database storage configuration
persistence:
enabled: true
# storageClass: ""
# size: 8Gi
redis:
# 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.
## 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.
enabled: true
host: ''
## External Redis hostname or IP
# host: redis.example.com
redisPort: 6379
password: 'funkwhale'
password: funkwhale
cluster:
enabled: false
@ -74,8 +76,10 @@ redis:
persistence:
enabled: false
## Django secret to use for encoding cookies/macaroons
djangoSecret: ''
## Additional environment variables to set
extraEnv: {}
# LDAP_ENABLED: "True"
# LDAP_ROOT_DN: dc=example,dc=com
@ -84,23 +88,26 @@ extraEnv: {}
# LDAP_START_TLS: "True"
# MEDIA_ROOT: /srv/funkwhale/data/media
## Additional secret environment variables to set
extraSecret: {}
# EMAIL_CONFIG: smtp://
# DEFAULT_FROM_EMAIL: funkwhale@example.com
## PVC-based data storage configuration
persistence:
enabled: false
# existingClaim: netbox-data
# storageClass: "-"
# 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
# single api replica.
#
# An example is provided for the worker affinity
## 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
## single api replica.
##
## An example is provided for the worker affinity
accessMode: ReadWriteMany
size: 1Gi
## S3-based data storage configuration
s3:
enabled: false
proxy: true
@ -112,13 +119,16 @@ s3:
# location: /funkwhale
# url: http://s3.example.com
## API server configuration
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: []
# - name: extra-music-data
# mountPath: /srv/funkwhale/data/music
# readOnly: true
## Additional volumes to add to the API container
extraVolumes: []
# - name: extra-music-data
# persistentVolumeClaim:
@ -137,36 +147,37 @@ api:
tolerations: []
affinity: {}
readinessProbe:
exec:
command:
- stat
- /run/funkwhale/funkwhale.sock
httpGet:
path: /
port: api
scheme: HTTP
livenessProbe:
exec:
command:
- stat
- /run/funkwhale/funkwhale.sock
httpGet:
path: /
port: api
scheme: HTTP
startupProbe:
exec:
command:
- stat
- /run/funkwhale/funkwhale.sock
tcpSocket:
port: api
## Web frontend and proxy
front:
image:
repository: nginx
tag: stable
pullPolicy: IfNotPresent
# Additional mounts to add to the frontend container
## Additional mounts to add to the frontend container
extraVolumeMounts: []
# - name: extra-music-data
# mountPath: /srv/funkwhale/data/music
# readOnly: true
## Additional volumes to add to the frontend container
extraVolumes: []
# - name: extra-music-data
# persistentVolumeClaim:
@ -188,11 +199,13 @@ front:
httpGet:
path: /
port: http
scheme: HTTP
livenessProbe:
httpGet:
path: /
port: http
scheme: HTTP
startupProbe:
tcpSocket: