diff --git a/.gitignore b/.gitignore index 6ec3130..03e989a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,8 @@ test-media/ # Packaged Helm charts dist/ + +# Local Helm overrides (may contain the Deezer ARL) +values.local.yaml +charts/*/values.local.yaml .kotlin/ diff --git a/README.md b/README.md index 02d4eb7..9652fc5 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Everything is environment variables: | `YTDLP_PATH` | `yt-dlp` | YouTube Music downloader / search binary | | `STREAMRIP_PATH` | `rip` | Deezer downloader (`streamrip`) | | `DEFAULT_SOURCE` | `deezer` | Source for new moods: `deezer` or `youtube` | -| `DEEZER_ARL` | empty | Deezer account cookie used for downloads | +| `DEEZER_ARL` | empty | Deezer account cookie used for downloads (chart: `deezer.arl` or `deezer.existingSecret`) | | `DEEZER_QUALITY` | `0` | `0` = 128 kbps MP3, `1` = 320 kbps MP3 | | `DEEZER_API_BASE` | `https://api.deezer.com` | Public Deezer API base | @@ -277,6 +277,33 @@ helm upgrade --install audiomanager charts/audiomanager \ upgrade. CI builds `:latest` and `:sha-` on every push to `main`, and publishes the packaged chart. +### Setting the Deezer ARL in a values file + +`deezer.arl` takes the cookie directly, so no Secret is needed: + +```yaml +# values.local.yaml (gitignored) +image: + tag: sha- +users: + existingSecret: audiomanager-users +defaultSource: deezer +deezer: + arl: "" + quality: 0 +``` + +```bash +helm upgrade --install audiomanager charts/audiomanager \ + --namespace audiomanager --create-namespace \ + -f values.local.yaml +``` + +Set only one of `deezer.arl` and `deezer.existingSecret`; the chart fails +otherwise. A plain value is stored in clear text in your values file, in +`helm get values` and in the release Secret, so use `deezer.existingSecret` on a +shared cluster or an untracked `values.local.yaml` here. + Before deploying the mood-first version over an old instance, wipe the old database and media: V8 drops the content, but the old mounted files are no longer referenced and should be removed by the operator. The old chart used the diff --git a/charts/audiomanager/Chart.yaml b/charts/audiomanager/Chart.yaml index ffbf0c2..8f187c6 100644 --- a/charts/audiomanager/Chart.yaml +++ b/charts/audiomanager/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: audiomanager description: Mood-first self-hosted music server type: application -version: 0.4.0 +version: 0.4.1 appVersion: "0.1.0" diff --git a/charts/audiomanager/templates/deployment.yaml b/charts/audiomanager/templates/deployment.yaml index fb7b476..9a5c95f 100644 --- a/charts/audiomanager/templates/deployment.yaml +++ b/charts/audiomanager/templates/deployment.yaml @@ -4,6 +4,9 @@ {{- if not (has (int .Values.deezer.quality) (list 0 1)) }} {{- fail "deezer.quality must be 0 (128 kbps) or 1 (320 kbps)" }} {{- end }} +{{- if and .Values.deezer.arl .Values.deezer.existingSecret }} +{{- fail "set only one of deezer.arl and deezer.existingSecret" }} +{{- end }} apiVersion: apps/v1 kind: Deployment metadata: @@ -65,6 +68,9 @@ spec: name: {{ .Values.deezer.existingSecret }} key: {{ .Values.deezer.key }} optional: true + {{- else if .Values.deezer.arl }} + - name: DEEZER_ARL + value: {{ .Values.deezer.arl | quote }} {{- end }} {{- with .Values.env }} {{- toYaml . | nindent 12 }} diff --git a/charts/audiomanager/values.yaml b/charts/audiomanager/values.yaml index f16d099..b4467b9 100644 --- a/charts/audiomanager/values.yaml +++ b/charts/audiomanager/values.yaml @@ -21,13 +21,21 @@ users: key: users.yaml # Default catalog for new moods. Users can switch each mood between Deezer and -# YouTube Music. Deezer needs an ARL cookie in a secret. +# YouTube Music. Deezer needs an ARL cookie: either `deezer.arl` below or a +# Secret referenced by `deezer.existingSecret`. Leave both empty to use +# YouTube Music only. defaultSource: deezer deezer: - # Create this secret with `kubectl create secret generic audiomanager-deezer - # --from-literal=arl=...`. Leave it empty to use YouTube Music only. + # Option A (recommended on a shared machine): a Secret you manage separately. + # kubectl -n audiomanager create secret generic audiomanager-deezer \ + # --from-literal=arl='' existingSecret: "" key: arl + # Option B: the ARL directly in values. It is stored in plaintext in this + # file, in `helm get values` and in the release Secret, so keep this file out + # of git (or pass it as `--set deezer.arl="$DEEZER_ARL"` instead). + # Set only one of `arl` and `existingSecret`. + arl: "" # 0 = 128 kbps MP3 (Deezer Free), 1 = 320 kbps MP3 (Deezer Premium). quality: 0 apiBase: https://api.deezer.com diff --git a/scripts/check-chart.sh b/scripts/check-chart.sh index bb04498..244f8ef 100755 --- a/scripts/check-chart.sh +++ b/scripts/check-chart.sh @@ -77,4 +77,21 @@ helm template "$RELEASE" "$CHART_DIR" \ --set users.existingSecret=test \ --set allowDefaultNamespace=true >/dev/null +echo "render with deezer.arl" +helm template "$RELEASE" "$CHART_DIR" \ + --namespace "$NAMESPACE" \ + --set users.existingSecret=test \ + --set deezer.arl=test-arl > "$workdir/arl.yaml" +grep -A1 'name: DEEZER_ARL' "$workdir/arl.yaml" | grep -q 'value: "test-arl"' + +echo "deezer.arl and deezer.existingSecret are mutually exclusive" +if helm template "$RELEASE" "$CHART_DIR" \ + --namespace "$NAMESPACE" \ + --set users.existingSecret=test \ + --set deezer.arl=test-arl \ + --set deezer.existingSecret=test-secret >/dev/null 2>&1; then + echo "FAIL: the chart accepted both deezer.arl and deezer.existingSecret" >&2 + exit 1 +fi + echo "chart check passed"