feat(radio-chicken): add Kubernetes manifests and migration scripts for Radio Chicken
Sync HTPC Manifests to GitOps / Sync Manifests to GitOps Repo (push) Successful in 4s
Sync HTPC Manifests to GitOps / Sync Manifests to GitOps Repo (push) Successful in 4s
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: radio-chicken-icecast-config
|
||||
namespace: htpc
|
||||
labels:
|
||||
app.kubernetes.io/name: radio-chicken
|
||||
app.kubernetes.io/part-of: htpc
|
||||
data:
|
||||
icecast.xml: |
|
||||
<icecast>
|
||||
<location>Radio Chicken Coop</location>
|
||||
<admin>admin@localhost</admin>
|
||||
|
||||
<limits>
|
||||
<clients>500</clients>
|
||||
<sources>20</sources>
|
||||
<queue-size>524288</queue-size>
|
||||
<client-timeout>30</client-timeout>
|
||||
<header-timeout>15</header-timeout>
|
||||
<source-timeout>10</source-timeout>
|
||||
<burst-on-connect>1</burst-on-connect>
|
||||
<burst-size>65535</burst-size>
|
||||
</limits>
|
||||
|
||||
<authentication>
|
||||
<source-password>hackme</source-password>
|
||||
<relay-password>hackme</relay-password>
|
||||
<admin-user>admin</admin-user>
|
||||
<admin-password>hackme</admin-password>
|
||||
</authentication>
|
||||
|
||||
<hostname>localhost</hostname>
|
||||
|
||||
<listen-socket>
|
||||
<port>8000</port>
|
||||
</listen-socket>
|
||||
|
||||
<fileserve>1</fileserve>
|
||||
|
||||
<paths>
|
||||
<logdir>/var/log/icecast2</logdir>
|
||||
<webroot>/usr/share/icecast2/web</webroot>
|
||||
<adminroot>/usr/share/icecast2/admin</adminroot>
|
||||
<alias source="/" destination="/status.xsl"/>
|
||||
</paths>
|
||||
|
||||
<logging>
|
||||
<accesslog>access.log</accesslog>
|
||||
<errorlog>error.log</errorlog>
|
||||
<loglevel>3</loglevel>
|
||||
<logsize>10000</logsize>
|
||||
</logging>
|
||||
|
||||
<security>
|
||||
<chroot>0</chroot>
|
||||
</security>
|
||||
|
||||
<!-- Mountpoint configuratie voor Radio Chicken Audio met Fallback -->
|
||||
<mount type="normal">
|
||||
<mount-name>/chicken</mount-name>
|
||||
<fallback-mount>/standby.ogg</fallback-mount>
|
||||
<fallback-override>1</fallback-override>
|
||||
<fallback-when-full>1</fallback-when-full>
|
||||
</mount>
|
||||
|
||||
<!-- Mountpoint configuratie voor Radio Chicken Video met Fallback -->
|
||||
<mount type="normal">
|
||||
<mount-name>/chicken_video.webm</mount-name>
|
||||
<fallback-mount>/standby_video.webm</fallback-mount>
|
||||
<fallback-override>1</fallback-override>
|
||||
<fallback-when-full>1</fallback-when-full>
|
||||
</mount>
|
||||
</icecast>
|
||||
@@ -0,0 +1,229 @@
|
||||
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: IfNotPresent
|
||||
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
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- configmap.yaml
|
||||
- pvc.yaml
|
||||
- service.yaml
|
||||
- deployment.yaml
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: radio-chicken-data
|
||||
namespace: htpc
|
||||
labels:
|
||||
app.kubernetes.io/name: radio-chicken
|
||||
app.kubernetes.io/part-of: htpc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: local-path
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
@@ -0,0 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: radio-chicken
|
||||
namespace: htpc
|
||||
labels:
|
||||
app.kubernetes.io/name: radio-chicken
|
||||
app.kubernetes.io/part-of: htpc
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: radio-chicken
|
||||
ports:
|
||||
- name: http-web
|
||||
port: 5000
|
||||
targetPort: 5000
|
||||
protocol: TCP
|
||||
- name: http-icecast
|
||||
port: 8000
|
||||
targetPort: 8000
|
||||
protocol: TCP
|
||||
Reference in New Issue
Block a user