apiVersion: apps/v1 kind: Deployment metadata: name: radio-chicken namespace: htpc labels: app.kubernetes.io/name: radio-chicken app.kubernetes.io/part-of: htpc spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: radio-chicken template: metadata: labels: app: radio-chicken app.kubernetes.io/name: radio-chicken app.kubernetes.io/part-of: htpc spec: nodeSelector: kubernetes.io/hostname: vmserver initContainers: - name: migrate-data image: alpine:3.20 imagePullPolicy: IfNotPresent command: - /bin/sh - -c - | echo "Checking and preparing directories for Radio Chicken..." mkdir -p /data/data /data/webroot if [ ! -f /data/data/settings.json ] && [ -f /host-radio/data/settings.json ]; then echo "Syncing Radio Chicken data and cache from host (/home/bart/jellyfinradio/data)..." cp -a /host-radio/data/* /data/data/ || true fi if [ ! -f /data/webroot/standby.ogg ] && [ -d /host-radio/webroot ]; then echo "Syncing standby media files from host (/home/bart/jellyfinradio/webroot)..." cp -a /host-radio/webroot/* /data/webroot/ || true fi chmod -R 777 /data echo "Init container completed successfully." volumeMounts: - name: data mountPath: /data - name: host-radio mountPath: /host-radio readOnly: true containers: # Container 1: Icecast Audio & Video Streaming Server - name: icecast image: moul/icecast:latest imagePullPolicy: IfNotPresent env: - name: ICECAST_SOURCE_PASSWORD value: "hackme" - name: ICECAST_ADMIN_PASSWORD value: "hackme" - name: ICECAST_PASSWORD value: "hackme" ports: - name: icecast containerPort: 8000 hostPort: 8000 protocol: TCP resources: requests: cpu: 50m memory: 64Mi limits: cpu: 500m memory: 512Mi volumeMounts: - name: icecast-config mountPath: /etc/icecast2/icecast.xml subPath: icecast.xml - name: data mountPath: /usr/share/icecast2/web/standby.ogg subPath: webroot/standby.ogg - name: data mountPath: /usr/share/icecast2/web/standby.mp3 subPath: webroot/standby.mp3 - name: data mountPath: /usr/share/icecast2/web/standby_video.webm subPath: webroot/standby_video.webm livenessProbe: httpGet: path: /status-json.xsl port: 8000 initialDelaySeconds: 15 periodSeconds: 20 timeoutSeconds: 5 readinessProbe: httpGet: path: /status-json.xsl port: 8000 initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 5 # Container 2: Radio Chicken Web Application & Audio/Video Streamer - name: radio-chicken image: git.bnhmeijer.nl/bart/radio-chicken:latest imagePullPolicy: Always securityContext: privileged: true env: - name: JELLYFIN_URL value: "http://jellyfin:8096/jellyfin" - name: JELLYFIN_API_KEY value: "c58f4b427eaf475aafd86abd87f139af" - name: JELLYFIN_USER_ID value: "40a220e1e05e4a4395c9b0c6569f6e82" - name: ICECAST_URL value: "icecast://source:hackme@127.0.0.1:8000/chicken" - name: VIDEO_ENCODER value: "h264_vaapi" - name: VAAPI_DEVICE value: "/dev/dri/renderD128" ports: - name: web containerPort: 5000 hostPort: 5000 protocol: TCP resources: requests: cpu: 200m memory: 1Gi limits: cpu: 4000m memory: 6Gi volumeMounts: - name: data mountPath: /app/data subPath: data - name: music-videos mountPath: /music_videos - name: dri mountPath: /dev/dri livenessProbe: httpGet: path: /live port: 5000 initialDelaySeconds: 45 periodSeconds: 20 timeoutSeconds: 5 readinessProbe: httpGet: path: /live port: 5000 initialDelaySeconds: 20 periodSeconds: 10 timeoutSeconds: 5 # Container 3: Radio Chicken Autoplacer Worker - name: autoplacer image: git.bnhmeijer.nl/bart/radio-chicken-autoplacer:latest imagePullPolicy: IfNotPresent env: - name: JELLYFIN_URL value: "http://jellyfin:8096/jellyfin" - name: JELLYFIN_API_KEY value: "c58f4b427eaf475aafd86abd87f139af" - name: JELLYFIN_USER_ID value: "40a220e1e05e4a4395c9b0c6569f6e82" - name: CHECK_INTERVAL_SECONDS value: "60" - name: PROCESS_DELAY_SECONDS value: "3" resources: requests: cpu: 50m memory: 256Mi limits: cpu: 1000m memory: 2Gi # Container 4: Radio Chicken Music Video Downloader Worker - name: mv-downloader image: git.bnhmeijer.nl/bart/radio-chicken-mv-downloader:latest imagePullPolicy: IfNotPresent env: - name: JELLYFIN_URL value: "http://jellyfin:8096/jellyfin" - name: JELLYFIN_API_KEY value: "c58f4b427eaf475aafd86abd87f139af" - name: JELLYFIN_USER_ID value: "40a220e1e05e4a4395c9b0c6569f6e82" - name: MUSIC_VIDEOS_DIR value: "/music_videos" - name: CHECK_INTERVAL_SECONDS value: "3600" - name: PROCESS_DELAY_SECONDS value: "3" resources: requests: cpu: 50m memory: 256Mi limits: cpu: 2000m memory: 2Gi volumeMounts: - name: music-videos mountPath: /music_videos volumes: - name: data persistentVolumeClaim: claimName: radio-chicken-data - name: icecast-config configMap: name: radio-chicken-icecast-config - name: music-videos hostPath: path: /datadisk/htpc/music_video type: Directory - name: dri hostPath: path: /dev/dri type: Directory - name: host-radio hostPath: path: /home/bart/jellyfinradio type: DirectoryOrCreate