Funkwhale 2.x defines --color-foreground-* and --color-background-* only inside two @scope blocks in fw.css. Firefox ESR 140 has no @scope, so every color: var(--color-foreground-N) was invalid and text fell back to black on the Mocha background. files/compat.js marks such browsers with html.no-css-scope, and catppuccin.css supplies the same positive and negative mappings as plain selectors there. Chromium is unaffected. The API pod now also restarts when the theme changes, because it caches the front's index.html for 15 minutes for the pages it renders itself. Destructive buttons and the old teal count badges get exact Catppuccin colours. Checked with headless Firefox ESR 140 and Chromium against a local copy with test content: nothing below 4.5:1 in dark mode on the home, library, album, artist, profile, search, settings, notifications and admin pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
473 lines
14 KiB
Django/Jinja
473 lines
14 KiB
Django/Jinja
{#- Shared by every pod: the role's affinity plus a preference for the
|
|
node the other Funkwhale pods already run on. -#}
|
|
{%- set _colocate = {'podAffinity': {'preferredDuringSchedulingIgnoredDuringExecution': [{'weight': 100, 'podAffinityTerm': {'topologyKey': 'kubernetes.io/hostname', 'labelSelector': {'matchLabels': {'app.kubernetes.io/instance': funkwhale_name}}}}]}} -%}
|
|
{%- set _funkwhale_affinity = funkwhale_affinity | combine(_colocate) if funkwhale_colocate | bool else funkwhale_affinity -%}
|
|
{%- set oidc = funkwhale_oidc_enabled | bool -%}
|
|
{%- macro labels(component) -%}
|
|
{{ {'app.kubernetes.io/name': 'funkwhale', 'app.kubernetes.io/instance': funkwhale_name, 'app.kubernetes.io/component': component} | to_json }}
|
|
{%- endmacro -%}
|
|
{%- macro env_from(with_secret=true) %}
|
|
envFrom:
|
|
- configMapRef:
|
|
name: {{ funkwhale_name }}
|
|
{% if with_secret %}
|
|
- secretRef:
|
|
name: {{ funkwhale_name }}
|
|
{% endif %}
|
|
{%- endmacro -%}
|
|
{#- pip-installs funkwhale-oidc and PyJWT into the "plugins" emptyDir, which
|
|
is mounted at FUNKWHALE_PLUGINS_PATH (on Funkwhale's sys.path). -#}
|
|
{%- macro plugin_init() %}
|
|
{% if oidc %}
|
|
- name: plugins
|
|
image: {{ funkwhale_api_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- >-
|
|
pip install --no-cache-dir --no-compile --disable-pip-version-check
|
|
--quiet --target /srv/funkwhale/plugins {{ funkwhale_oidc_plugin_url | quote }}
|
|
volumeMounts:
|
|
- name: plugins
|
|
mountPath: /srv/funkwhale/plugins
|
|
{% endif %}
|
|
{%- endmacro -%}
|
|
{%- macro plugin_mount() %}
|
|
{% if oidc %}
|
|
- name: plugins
|
|
mountPath: /srv/funkwhale/plugins
|
|
readOnly: true
|
|
{% endif %}
|
|
{%- endmacro -%}
|
|
{%- macro plugin_volume() %}
|
|
{% if oidc %}
|
|
- name: plugins
|
|
emptyDir: {}
|
|
{% endif %}
|
|
{%- endmacro -%}
|
|
{%- macro pvc(name, size) -%}
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: {{ funkwhale_name }}-{{ name }}
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: funkwhale
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
spec:
|
|
# Shared by the api, celery worker and front pods.
|
|
accessModes: [ReadWriteMany]
|
|
storageClassName: {{ funkwhale_storage_class }}
|
|
resources:
|
|
requests:
|
|
storage: {{ size }}
|
|
{%- endmacro -%}
|
|
{%- set checksums %}
|
|
checksum/config: {{ lookup('ansible.builtin.template', 'config.yml.j2') | hash('sha256') }}
|
|
checksum/secret: {{ lookup('ansible.builtin.template', 'secret.yml.j2') | hash('sha256') }}
|
|
# The API caches the front's index.html (FUNKWHALE_SPA_HTML_CACHE_DURATION)
|
|
# for the pages it renders itself; restart it when the theme hook changes.
|
|
checksum/theme: {{ lookup('ansible.builtin.template', 'theme-configmap.yml.j2') | hash('sha256') }}
|
|
{%- endset -%}
|
|
{{ pvc('media', funkwhale_media_storage_size) }}
|
|
---
|
|
{{ pvc('music', funkwhale_music_storage_size) }}
|
|
---
|
|
{{ pvc('static', funkwhale_static_storage_size) }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ funkwhale_name }}-redis
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels: {{ labels('redis') }}
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: redis
|
|
template:
|
|
metadata:
|
|
labels: {{ labels('redis') }}
|
|
spec:
|
|
affinity: {{ _funkwhale_affinity | to_json }}
|
|
containers:
|
|
# Cache and Celery broker only; nothing here needs to survive a restart.
|
|
- name: redis
|
|
image: {{ funkwhale_redis_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
args: [--save, "", --appendonly, "no"]
|
|
ports:
|
|
- name: redis
|
|
containerPort: 6379
|
|
readinessProbe:
|
|
exec:
|
|
command: [redis-cli, ping]
|
|
periodSeconds: 10
|
|
resources: {{ funkwhale_redis_resources | to_json }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ funkwhale_name }}-redis
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: funkwhale
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: redis
|
|
ports:
|
|
- name: redis
|
|
port: 6379
|
|
targetPort: redis
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ funkwhale_name }}-api
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels: {{ labels('api') }}
|
|
spec:
|
|
replicas: 1
|
|
# Migrations run in an init container; never two at once.
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: api
|
|
template:
|
|
metadata:
|
|
labels: {{ labels('api') }}
|
|
annotations:
|
|
{{ checksums }}
|
|
spec:
|
|
affinity: {{ _funkwhale_affinity | to_json }}
|
|
initContainers:
|
|
{{ plugin_init() }}
|
|
- name: migrate
|
|
image: {{ funkwhale_api_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
# collectstatic fills the shared volume the front serves /staticfiles/ from.
|
|
command: [sh, -c, "funkwhale-manage migrate --noinput && funkwhale-manage collectstatic --noinput --clear -v 0"]
|
|
{{ env_from() }}
|
|
volumeMounts:
|
|
{{ plugin_mount() }}
|
|
- name: static
|
|
mountPath: /srv/funkwhale/data/static
|
|
containers:
|
|
- name: api
|
|
image: {{ funkwhale_api_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
args: [gunicorn]
|
|
{{ env_from() }}
|
|
ports:
|
|
- name: http
|
|
containerPort: 5000
|
|
startupProbe: &probe
|
|
httpGet:
|
|
path: /api/v2/instance/nodeinfo/2.1/
|
|
port: http
|
|
# Django only answers for FUNKWHALE_HOSTNAME.
|
|
httpHeaders:
|
|
- name: Host
|
|
value: {{ funkwhale_host }}
|
|
periodSeconds: 5
|
|
timeoutSeconds: 5
|
|
failureThreshold: 60
|
|
readinessProbe:
|
|
<<: *probe
|
|
periodSeconds: 10
|
|
failureThreshold: 3
|
|
livenessProbe:
|
|
<<: *probe
|
|
periodSeconds: 30
|
|
failureThreshold: 4
|
|
resources: {{ funkwhale_api_resources | to_json }}
|
|
volumeMounts:
|
|
{{ plugin_mount() }}
|
|
- name: media
|
|
mountPath: /srv/funkwhale/data/media
|
|
- name: music
|
|
mountPath: /music
|
|
readOnly: true
|
|
- name: static
|
|
mountPath: /srv/funkwhale/data/static
|
|
readOnly: true
|
|
volumes:
|
|
{{ plugin_volume() }}
|
|
- name: media
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-media
|
|
- name: music
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-music
|
|
- name: static
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-static
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ funkwhale_name }}-api
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: funkwhale
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: api
|
|
ports:
|
|
- name: http
|
|
port: 5000
|
|
targetPort: http
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ funkwhale_name }}-celeryworker
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels: {{ labels('celeryworker') }}
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: celeryworker
|
|
template:
|
|
metadata:
|
|
labels: {{ labels('celeryworker') }}
|
|
annotations:
|
|
{{ checksums }}
|
|
spec:
|
|
affinity: {{ _funkwhale_affinity | to_json }}
|
|
{% if oidc %}
|
|
initContainers:
|
|
{{ plugin_init() }}
|
|
{% endif %}
|
|
containers:
|
|
- name: celeryworker
|
|
image: {{ funkwhale_api_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- exec celery --app=funkwhale_api.taskapp worker --loglevel=INFO --concurrency="$CELERYD_CONCURRENCY"
|
|
{{ env_from() }}
|
|
env:
|
|
- name: C_FORCE_ROOT
|
|
value: "true"
|
|
resources: {{ funkwhale_worker_resources | to_json }}
|
|
volumeMounts:
|
|
{{ plugin_mount() }}
|
|
- name: media
|
|
mountPath: /srv/funkwhale/data/media
|
|
- name: music
|
|
mountPath: /music
|
|
readOnly: true
|
|
volumes:
|
|
{{ plugin_volume() }}
|
|
- name: media
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-media
|
|
- name: music
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-music
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ funkwhale_name }}-celerybeat
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels: {{ labels('celerybeat') }}
|
|
spec:
|
|
# Exactly one scheduler, or periodic tasks run twice.
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: celerybeat
|
|
template:
|
|
metadata:
|
|
labels: {{ labels('celerybeat') }}
|
|
annotations:
|
|
{{ checksums }}
|
|
spec:
|
|
affinity: {{ _funkwhale_affinity | to_json }}
|
|
{% if oidc %}
|
|
initContainers:
|
|
{{ plugin_init() }}
|
|
{% endif %}
|
|
containers:
|
|
- name: celerybeat
|
|
image: {{ funkwhale_api_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
command:
|
|
- celery
|
|
- --app=funkwhale_api.taskapp
|
|
- beat
|
|
- --loglevel=INFO
|
|
- --schedule=/tmp/celerybeat-schedule
|
|
- --pidfile=
|
|
{{ env_from() }}
|
|
resources: {{ funkwhale_beat_resources | to_json }}
|
|
{% if oidc %}
|
|
volumeMounts:
|
|
{{ plugin_mount() }}
|
|
volumes:
|
|
{{ plugin_volume() }}
|
|
{% endif %}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ funkwhale_name }}-front
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels: {{ labels('front') }}
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: front
|
|
template:
|
|
metadata:
|
|
labels: {{ labels('front') }}
|
|
annotations:
|
|
checksum/config: {{ lookup('ansible.builtin.template', 'config.yml.j2') | hash('sha256') }}
|
|
checksum/theme: {{ lookup('ansible.builtin.template', 'theme-configmap.yml.j2') | hash('sha256') }}
|
|
spec:
|
|
affinity: {{ _funkwhale_affinity | to_json }}
|
|
{% if oidc %}
|
|
initContainers:
|
|
{{ plugin_init() }}
|
|
# The front half of the plugin: login button, and /accounts/ -> api.
|
|
- name: oidc-front
|
|
image: {{ funkwhale_api_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
command: [sh, -c, "cp /srv/funkwhale/plugins/funkwhale_oidc/front/* /oidc/ && chmod 0755 /oidc/inject.sh"]
|
|
volumeMounts:
|
|
- name: plugins
|
|
mountPath: /srv/funkwhale/plugins
|
|
readOnly: true
|
|
- name: oidc
|
|
mountPath: /oidc
|
|
{% endif %}
|
|
containers:
|
|
- name: front
|
|
image: {{ funkwhale_front_image }}
|
|
imagePullPolicy: {{ funkwhale_image_pull_policy }}
|
|
{{ env_from(with_secret=false) }}
|
|
ports:
|
|
- name: http
|
|
containerPort: 80
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
periodSeconds: 30
|
|
resources: {{ funkwhale_front_resources | to_json }}
|
|
volumeMounts:
|
|
- name: theme
|
|
mountPath: /usr/share/nginx/html/eom
|
|
readOnly: true
|
|
- name: theme
|
|
mountPath: /docker-entrypoint.d/99-eom-theme.sh
|
|
subPath: theme.sh
|
|
readOnly: true
|
|
{% if oidc %}
|
|
- name: oidc
|
|
mountPath: /usr/share/nginx/html/oidc
|
|
readOnly: true
|
|
- name: oidc
|
|
mountPath: /docker-entrypoint.d/98-funkwhale-oidc.sh
|
|
subPath: inject.sh
|
|
readOnly: true
|
|
{% endif %}
|
|
- name: media
|
|
mountPath: /srv/funkwhale/data/media
|
|
readOnly: true
|
|
- name: music
|
|
mountPath: /music
|
|
readOnly: true
|
|
- name: static
|
|
mountPath: /usr/share/nginx/html/staticfiles
|
|
readOnly: true
|
|
volumes:
|
|
- name: theme
|
|
configMap:
|
|
name: {{ funkwhale_name }}-theme
|
|
defaultMode: 0755
|
|
{% if oidc %}
|
|
{{ plugin_volume() }}
|
|
- name: oidc
|
|
emptyDir: {}
|
|
{% endif %}
|
|
- name: media
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-media
|
|
- name: music
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-music
|
|
- name: static
|
|
persistentVolumeClaim:
|
|
claimName: {{ funkwhale_name }}-static
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ funkwhale_name }}-front
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: funkwhale
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
app.kubernetes.io/component: front
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
targetPort: http
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: {{ funkwhale_name }}
|
|
namespace: {{ funkwhale_namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: funkwhale
|
|
app.kubernetes.io/instance: {{ funkwhale_name }}
|
|
annotations: {{ funkwhale_ingress_annotations | to_json }}
|
|
spec:
|
|
ingressClassName: {{ funkwhale_ingress_class_name }}
|
|
tls:
|
|
- hosts:
|
|
- {{ funkwhale_host }}
|
|
secretName: {{ funkwhale_tls_secret_name }}
|
|
rules:
|
|
- host: {{ funkwhale_host }}
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
backend:
|
|
service:
|
|
name: {{ funkwhale_name }}-front
|
|
port:
|
|
name: http
|