From 7f3b3ff48e80decbcc4828c5b70403740e3628aa Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Sat, 20 Dec 2025 18:02:07 +0100 Subject: [PATCH] refine snapcast deployment so piping between containers works --- apps/snapcast/README.md | 7 +++++ apps/snapcast/deployment.yaml | 50 ++++++++++++++++++-------------- apps/snapcast/kustomization.yaml | 1 + apps/snapcast/pvc.yaml | 2 +- 4 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 apps/snapcast/README.md diff --git a/apps/snapcast/README.md b/apps/snapcast/README.md new file mode 100644 index 0000000..751fccb --- /dev/null +++ b/apps/snapcast/README.md @@ -0,0 +1,7 @@ +### Credentials +Since this tries to run in an isolated network we can't rely on autodiscover and the spotify client needs to be tied to an account. + +This is achieved by registering the client on startup via oauth. The logs show an url which should be copied to a local browser. The successfull redirect needs to be forwarded back to the client, hence run: +``` +k port-forward deployments/snapcast 5588:5588 +``` diff --git a/apps/snapcast/deployment.yaml b/apps/snapcast/deployment.yaml index e938cfe..b63f804 100644 --- a/apps/snapcast/deployment.yaml +++ b/apps/snapcast/deployment.yaml @@ -51,9 +51,20 @@ spec: - name: TZ value: Europe/Berlin - name: AIRPLAY_CONFIG_ENABLED - value: "0" + value: "1" - name: SPOTIFY_CONFIG_ENABLED value: "0" + - name: PIPE_CONFIG_ENABLED + value: "1" + - name: PIPE_PATH + value: /mnt/pipe/spotipipe + - name: PIPE_SOURCE_NAME + value: "Librespot" + # - name: PIPE_MODE + # value: "read" + - name: PIPE_EXTRA_ARGS + # see https://github.com/badaix/snapcast/issues/1248 + value: "&sampleformat=44100:16:2" volumeMounts: - name: pipe mountPath: /mnt/pipe @@ -68,34 +79,31 @@ spec: requests: memory: "128Mi" cpu: "250m" - # ports: + ports: + - containerPort: 5588 # default port for oauth callback env: - name: BACKEND value: pipe - name: DEVICE value: /mnt/pipe/spotipipe + - name: DISABLE_DISCOVERY + value: Y + - name: AUTOPLAY + value: Y + # - name: VERBOSE + # value: Y + # - name: PASSTHROUGH + # value: Y + - name: ADDITIONAL_ARGUMENTS + value: "--enable-oauth --cache /cache" volumeMounts: - name: pipe mountPath: /mnt/pipe + - name: credentials-cache + mountPath: /cache volumes: - name: pipe emptyDir: {} - - - # - name: SPOTIFY_ACCESS_TOKEN - # value: BQBxGPPPXZTXF7WTBzJItu3KNkeoZu2j2-Rlk1RmtnmXvzPh1fWFpOT2VeXwWxMJXlBYwxSOTo1ZKk3hAr08OhDhbQChi6KDl6qEmK-Y8Wq8g3EoP7M-oRnHt4WFMg1zC1C37t90nQUKZ-F9UdSuL9A6Ny6V6pYsai1bUspOU0q5UHn6-Dv9E8gwEKXOPMlBKEXNi1D0sT2m9rzwI7UK1g7ToRPn03eqGe41RRvlfrSCgf41tg - - - # - name: SPOTIFY_EXTRA_ARGS - # value: " --disable-discovery --access-token BQBxGPPPXZTXF7WTBzJItu3KNkeoZu2j2-Rlk1RmtnmXvzPh1fWFpOT2VeXwWxMJXlBYwxSOTo1ZKk3hAr08OhDhbQChi6KDl6qEmK-Y8Wq8g3EoP7M-oRnHt4WFMg1zC1C37t90nQUKZ-F9UdSuL9A6Ny6V6pYsai1bUspOU0q5UHn6-Dv9E8gwEKXOPMlBKEXNi1D0sT2m9rzwI7UK1g7ToRPn03eqGe41RRvlfrSCgf41tg" - # volumeMounts: - # - name: config - # mountPath: /config - # - name: snapserver-config - # mountPath: /root/.config/ - # volumes: - # - name: config - # secret: - # secretName: snapcast-config - # - name: snapserver-config - # emptyDir: {} + - name: credentials-cache + persistentVolumeClaim: + claimName: cache diff --git a/apps/snapcast/kustomization.yaml b/apps/snapcast/kustomization.yaml index f4a3d63..12abefd 100644 --- a/apps/snapcast/kustomization.yaml +++ b/apps/snapcast/kustomization.yaml @@ -7,6 +7,7 @@ resources: - namespace.yaml - deployment.yaml - service.yaml + - pvc.yaml - snapcast-config.secret.yaml images: diff --git a/apps/snapcast/pvc.yaml b/apps/snapcast/pvc.yaml index 411c1dc..854191b 100644 --- a/apps/snapcast/pvc.yaml +++ b/apps/snapcast/pvc.yaml @@ -1,7 +1,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: data + name: cache spec: storageClassName: "nfs-client" accessModes: