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 "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- 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. 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

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

View file

@ -8,35 +8,37 @@ metadata:
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 }}
data: data:
DJANGO_SETTINGS_MODULE: config.settings.production
FUNKWHALE_API_IP: 0.0.0.0 FUNKWHALE_API_IP: 0.0.0.0
FUNKWHALE_API_PORT: "5000" 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_HOSTNAME: {{ .Values.ingress.host }}
FUNKWHALE_PROTOCOL: {{ .Values.ingress.protocol }} 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_ACCESS_KEY_ID: {{ .Values.s3.accessKey }}
AWS_SECRET_ACCESS_KEY: {{ .Values.s3.secretKey }} AWS_SECRET_ACCESS_KEY: {{ .Values.s3.secretKey }}
AWS_STORAGE_BUCKET_NAME: {{ .Values.s3.bucket }} AWS_STORAGE_BUCKET_NAME: {{ .Values.s3.bucket }}
{{- if .Values.s3.region }} {{- if .Values.s3.region -}}
AWS_S3_REGION_NAME: {{ .Values.s3.region }} AWS_S3_REGION_NAME: {{ .Values.s3.region }}
{{- end }} {{- end -}}
{{- if .Values.s3.location }} {{- if .Values.s3.location -}}
AWS_LOCATION: {{ .Values.s3.location }} AWS_LOCATION: {{ .Values.s3.location }}
{{- end }} {{- end -}}
{{- if .Values.s3.url }} {{- if .Values.s3.url -}}
AWS_S3_ENDPOINT_URL: {{ .Values.s3.url }} AWS_S3_ENDPOINT_URL: {{ .Values.s3.url }}
{{- end }} {{- end -}}
PROXY_MEDIA: {{ .Values.s3.proxy | quote }} PROXY_MEDIA: {{ .Values.s3.proxy | quote }}
{{- end }} {{- end -}}
{{- with .Values.extraEnv }} {{- with .Values.extraEnv -}}
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}
{{- end }} {{- end -}}

View file

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

View file

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

View file

@ -26,11 +26,11 @@ spec:
- name: worker - name: worker
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
commands: command:
- sh - sh
- -c - -c
- | - |
celery -A funkwhale_api.taskapp worder -l INFO celery -A funkwhale_api.taskapp worker -l INFO
env: env:
- name: C_FORCE_ROOT - name: C_FORCE_ROOT
value: "true" value: "true"
@ -59,7 +59,7 @@ spec:
volumes: volumes:
- name: data - name: data
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}-data claimName: {{ include "funkwhale.fullname" . }}
- name: config - name: config
configMap: configMap:
name: {{ include "funkwhale.fullname" . }}-front name: {{ include "funkwhale.fullname" . }}-front

View file

@ -42,7 +42,7 @@ spec:
- name: nginx - name: nginx
image: "{{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}" image: "{{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}"
imagePullPolicy: {{ .Values.front.image.pullPolicy }} imagePullPolicy: {{ .Values.front.image.pullPolicy }}
commands: command:
- sh - sh
- -c - -c
- | - |
@ -91,7 +91,7 @@ spec:
emptyDir: {} emptyDir: {}
- name: data - name: data
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}-data claimName: {{ include "funkwhale.fullname" . }}
- name: config - name: config
configMap: configMap:
name: {{ include "funkwhale.fullname" . }}-front name: {{ include "funkwhale.fullname" . }}-front

View file

@ -25,15 +25,11 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range .Values.ingress.hosts }} - host: {{ .Values.ingress.host | quote }}
- host: {{ .host | quote }}
http: http:
paths: paths:
{{- range .paths }} - path:
- path: {{ . }}
backend: backend:
serviceName: {{ $fullName }}-front serviceName: {{ $fullName }}-front
servicePort: http servicePort: http
{{- end }}
{{- 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/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
data: data:
CACHE_URL: {{ .Values.redisUrl | b64enc }} CACHE_URL: {{ include "funkwhale.redisUrl" . | b64enc }}
DATABASE_URL: {{ .Values.dbUrl | b64enc }} DATABASE_URL: {{ include "funkwhale.dbUrl" . | b64enc }}
DJANGO_SECRET_KEY: {{ .Values.djangoSecret | b64enc }} DJANGO_SECRET_KEY: {{ .Values.djangoSecret | b64enc }}
{{- range $key, $val := .Values.extraSecret -}}
{{ $key }}: {{ $val | b64enc }}
{{- end -}}

View file

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