Prerequisites#

Jellystat#

Jellystat is a dashboard for monitoring the health and performance of jellyfin media server.

Installation#

  1. Create the following directory structure for Jellystat:
    jellystat/
    ├── db.yml
    ├── ingress.yml
    ├── pvc.yml
    ├── secret.yml
    ├── jellystat.yml
    └── svc.yml
  2. Add the following content to the db.yml file:
    ---
    kind: "postgresql"
    apiVersion: "acid.zalan.do/v1"
    
    metadata:
      name: "jellystat-db-cluster"
      namespace: "monitoring"
      labels:
        team: acid
    
    spec:
      teamId: "acid"
      postgresql:
        version: "18"
      numberOfInstances: 3
      volume:
        size: "1Gi"
        storageClass: "longhorn"
      users:
        postgres: []
      databases:
        postgres: jfstat
      patroni:
        pg_hba:
          - local all all trust
          - hostssl all +zalandos 127.0.0.1/32 pam
          - host all all 127.0.0.1/32 md5
          - hostssl all +zalandos ::1/128 pam
          - host all all ::1/128 md5
          - local replication standby trust
          - hostssl replication standby all md5
          - hostssl all +zalandos all pam
          - host all all all md5
  3. Add the following content to the ingress.yml file:
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: jellystat-ingress
      namespace: monitoring
      annotations:
        cert-manager.io/cluster-issuer: letsencrypt-cloudflare
        traefik.ingress.kubernetes.io/router.middlewares: tools-authelia@kubernetescrd
        traefik.ingress.kubernetes.io/router.entrypoints: websecure
    spec:
      ingressClassName: traefik
      tls:
      - hosts:
        - jellystat.example.com
        secretName: jellystat-tls
      rules:
      - host: jellystat.example.com
        http:
          paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: jellystat-service
                port:
                  number: 3000
  4. Add the following content to the pvc.yml file:
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: jellystat-backups-longhorn
      namespace: monitoring
    spec:
      accessModes:
        - ReadWriteOnce
      volumeMode: Filesystem
      resources:
        requests:
          storage: 1Gi
      storageClassName: longhorn
  5. Add the following content to the secret-tmp.yml file:
    ---
    apiVersion: v1
    kind: Secret
    metadata:
      name: jellystat-secret
      namespace: monitoring
    type: Opaque
    data:
      jwt: <base64-encoded-jwt-secret>
  6. Encrypt the secret-tmp.yml file with kubeseal and save the output as secret.yml:
    kubeseal -o yaml < secret-tmp.yml > secret.yml && \
    rm secret-tmp.yml
  7. Add the following content to the jellystat.yml file:
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: jellystat
      namespace: monitoring
    spec:
      strategy:
        type: Recreate
      replicas: 1
      selector:
        matchLabels:
          app: jellystat
      template:
        metadata:
          labels:
            app: jellystat
        spec:
          containers:
          - name: jellystat
            image: cyfershepard/jellystat:1.1.11
            env:
            - name: JWT_SECRET
              valueFrom:
                secretKeyRef:
                  name: jellystat-secret
                  key: jwt
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres.jellystat-db-cluster.credentials.postgresql.acid.zalan.do
                  key: password
            - name: POSTGRES_IP
              value: "jellystat-db-cluster.monitoring.svc.cluster.local"
            - name: POSTGRES_PORT
              value: "5432"
            - name: POSTGRES_USER
              value: "postgres"
            volumeMounts:
            - name: backups
              mountPath: /app/backend/backup-data
          volumes:
          - name: backups
            persistentVolumeClaim:
              claimName: jellystat-backups-longhorn
  8. Add the following content to the svc.yml file:
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: jellystat-service
      namespace: monitoring
    spec:
      selector:
        app: jellystat
      ports:
      - port: 3000
        targetPort: 3000
        protocol: TCP
  9. Commit and push the changes to your git repository and flux will automatically deploy the application to your cluster.