More work on Funkwhale

This commit is contained in:
Alexander Olofsson 2019-05-18 10:51:47 +02:00
parent 40534e57d2
commit 940962ecbf
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
14 changed files with 150 additions and 79 deletions

Binary file not shown.

View file

@ -0,0 +1,6 @@
dependencies:
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com/
version: 7.1.1
digest: sha256:5a2449433325c0e819134bdcd7bd7ab463975b9b529c8516a9ff030547140bf6
generated: 2019-05-18T10:14:13.270735156+02:00

View file

@ -0,0 +1,4 @@
dependencies:
- name: redis
version: 7.1.1
repository: https://kubernetes-charts.storage.googleapis.com/

View file

@ -6,6 +6,14 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "funkwhale.dbUrl" -}}
postgres://{{ .Values.database.user}}:{{ .Values.database.password }}@{{ .Values.database.host }}:{{ .Values.database.port }}/{{ .Values.database.database }}
{{- end -}}
{{- define "funkwhale.redisUrl" -}}
redis://:{{ .Values.redis.password }}@{{ template "funkwhale.fullname" . }}-redis-master:{{ .Values.redis.redisPort }}/0
{{- 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

@ -11,7 +11,7 @@ metadata:
data:
nginx.conf: |
upstream funkwhale-api {
server {{ include "funkwhale.fullname" . }}-api.{{ .Release.Namespace }}.svc:5000;
server {{ include "funkwhale.fullname" . }}-api:5000;
}
map $http_upgrade $connection_upgrade {

View file

@ -8,35 +8,37 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
DJANGO_SETTINGS_MODULE: config.settings.production
FUNKWHALE_API_IP: 0.0.0.0
FUNKWHALE_API_PORT: "5000"
FUNKWHALE_FRONTEND_PATH: /srv/funkwhale/front/dist
MEDIA_ROOT: /srv/funkwhale/data/media
NGINX_MAX_BODY_SIZE: 30M
REVERSE_PROXY_TYPE: nginx
STATIC_ROOT: /srv/funkwhale/data/static
DJANGO_ALLOWED_HOSTS: {{ .Values.ingress.host }}
FUNKWHALE_HOSTNAME: {{ .Values.ingress.host }}
FUNKWHALE_PROTOCOL: {{ .Values.ingress.protocol }}
REVERSE_PROXY_TYPE: nginx
MEDIA_ROOT: /srv/funkwhale/data/media
STATIC_ROOT: /srv/funkwhale/data/static
MUSIC_DIRECTORY_PATH: /srv/funkwhale/data/music
MUSIC_DIRECTORY_SERVE_PATH: /srv/funkwhale/data/music
DJANGO_SETTINGS_MODULE: config.settings.production
FUNKWHALE_FRONTEND_PATH: /srv/funkwhale/front/dist
NGINX_MAX_BODY_SIZE: 500M
{{- if .Values.s3.enabled }}
DJANGO_ALLOWED_HOSTS: '*'
{{- if .Values.s3.enabled -}}
AWS_ACCESS_KEY_ID: {{ .Values.s3.accessKey }}
AWS_SECRET_ACCESS_KEY: {{ .Values.s3.secretKey }}
AWS_STORAGE_BUCKET_NAME: {{ .Values.s3.bucket }}
{{- if .Values.s3.region }}
{{- if .Values.s3.region -}}
AWS_S3_REGION_NAME: {{ .Values.s3.region }}
{{- end }}
{{- if .Values.s3.location }}
{{- end -}}
{{- if .Values.s3.location -}}
AWS_LOCATION: {{ .Values.s3.location }}
{{- end }}
{{- if .Values.s3.url }}
{{- end -}}
{{- if .Values.s3.url -}}
AWS_S3_ENDPOINT_URL: {{ .Values.s3.url }}
{{- end }}
{{- end -}}
PROXY_MEDIA: {{ .Values.s3.proxy | quote }}
{{- end }}
{{- end -}}
{{- with .Values.extraEnv }}
{{- with .Values.extraEnv -}}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View file

@ -41,7 +41,7 @@ spec:
# port: http
readinessProbe:
tcpSocket:
port: http
port: api
volumeMounts:
- name: data
mountPath: /srv/funkwhale/data
@ -67,9 +67,9 @@ spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}-data
claimName: {{ include "funkwhale.fullname" . }}
{{- range .Values.api.extraVolumeMounts }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- end }}<Paste>
{{- end }}

View file

@ -22,7 +22,7 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}
audio.funkwhale/component: celery-beat
spec:
initContainers:
containers:
- name: celery-beat
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}

View file

@ -26,11 +26,11 @@ spec:
- name: worker
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
commands:
command:
- sh
- -c
- |
celery -A funkwhale_api.taskapp worder -l INFO
celery -A funkwhale_api.taskapp worker -l INFO
env:
- name: C_FORCE_ROOT
value: "true"
@ -56,15 +56,15 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}-data
- name: config
configMap:
name: {{ include "funkwhale.fullname" . }}-front
{{- range .Values.celery.worker.extraVolumeMounts }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- end }}
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}
- name: config
configMap:
name: {{ include "funkwhale.fullname" . }}-front
{{- range .Values.celery.worker.extraVolumeMounts }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- end }}

View file

@ -42,7 +42,7 @@ spec:
- name: nginx
image: "{{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}"
imagePullPolicy: {{ .Values.front.image.pullPolicy }}
commands:
command:
- sh
- -c
- |
@ -86,17 +86,17 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: frontend
emptyDir: {}
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}-data
- name: config
configMap:
name: {{ include "funkwhale.fullname" . }}-front
{{- range .Values.front.extraVolumeMounts }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- end }}
volumes:
- name: frontend
emptyDir: {}
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}
- name: config
configMap:
name: {{ include "funkwhale.fullname" . }}-front
{{- range .Values.front.extraVolumeMounts }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- end }}

View file

@ -25,15 +25,11 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
- host: {{ .Values.ingress.host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
- path:
backend:
serviceName: {{ $fullName }}-front
servicePort: http
{{- end }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,22 @@
kind: PersistentVolumeClaim
apiVersion: v1
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 }}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}

View file

@ -8,6 +8,10 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
CACHE_URL: {{ .Values.redisUrl | b64enc }}
DATABASE_URL: {{ .Values.dbUrl | b64enc }}
CACHE_URL: {{ include "funkwhale.redisUrl" . | b64enc }}
DATABASE_URL: {{ include "funkwhale.dbUrl" . | b64enc }}
DJANGO_SECRET_KEY: {{ .Values.djangoSecret | b64enc }}
{{- range $key, $val := .Values.extraSecret -}}
{{ $key }}: {{ $val | b64enc }}
{{- end -}}

View file

@ -16,7 +16,8 @@ service:
ingress:
enabled: false
annotations: {}
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 500m
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
host: chart-example.local
@ -27,19 +28,51 @@ ingress:
# hosts:
# - chart-example.local
dbUrl: ''
redisUrl: ''
database:
## Database host
host:
## Database port
port: 5432
## Database user
user: funkwhale
## Database password
password:
## Database name
database: funkwhale
redis:
cluster:
enabled: false
master:
persistence:
enabled: false
slave:
persistence:
enabled: false
password: funkwhale
redisPort: 6379
djangoSecret: ''
extraEnv: []
extraEnv: {}
# LDAP_ENABLED: "True"
# LDAP_ROOT_DN: dc=example,dc=com
# LDAP_SEARCH_FILTER: (|(uid={0})(mail={0}))
# LDAP_SERVER_URI: ldaps://ldap.example.com
# LDAP_START_TLS: "True"
# MEDIA_ROOT: /srv/funkwhale/data/media
# MUSIC_DIRECTORY_PATH: /srv/funkwhale/data/music
# MUSIC_DIRECTORY_SERVE_PATH: /srv/funkwhale/data/music
extraSecret: {}
# EMAIL_CONFIG: smtp://
# DEFAULT_FROM_EMAIL: funkwhale@example.com
persistence:
size: 1Gi
storageClass: "-"
s3:
enabled: false
@ -48,7 +81,7 @@ s3:
accessKey: ''
secretKey: ''
bucket: funkwhale
# region: us-1
# region: eu-west-2
# location: /funkwhale
# url: http://s3.example.com
@ -113,17 +146,13 @@ front:
celery:
beat:
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 10m
memory: 75Mi
nodeSelector: {}
@ -132,7 +161,7 @@ celery:
affinity: {}
worker:
replicaCount: 1
replicaCount: 2
# Additional mounts to add to the frontend pod
extraVolumeMounts: []