McCloudS / subgen

Autogenerate subtitles using OpenAI Whisper Model via Jellyfin, Plex, Emby, Tautulli, or Bazarr
MIT License
532 stars 48 forks source link

Running in Kubernetes #36

Closed lenaxia closed 7 months ago

lenaxia commented 7 months ago

For anyone looking to get this running in kubernetes. Here's a helm release you can play with:

kind: HelmRelease
metadata:
  name: &appname subgen
  namespace: &namespace media
spec:
  releaseName: *appname
  chart:
    spec:
      chart: app-template
      version: 2.4.0
      sourceRef:
        kind: HelmRepository
        name: bjw-s-charts
        namespace: flux-system
  interval: 6m
  values:
    defaultPodOptions:
      securityContext:
        runAsUser: 0
        runAsGroup: 0
        fsGroup: 0
        fsGroupChangePolicy: OnRootMismatch

      nodeSelector:
        node-role.kubernetes.io/worker: 'true'
    controllers:
      main:
        type: statefulset
        annotations:
          reloader.stakater.com/auto: 'true'
        containers:
          main:
            image:
              repository: mccloud/subgen
              tag: cpu
              pullPolicy: Always
            env:
              TZ: ${TIMEZONE}
              TRANSCRIBE_DEVICE: "cpu"
              WHISPER_MODEL: "medium"
              CONCURRENT_TRANSCRIPTIONS: "2"
              WHISPER_THREADS: "4"
              PROCADDEDMEDIA: True # will gen subtitles for all media added regardless of existing external/embedded subtitles (based off of SKIPIFINTERNALSUBLANG)
              PROCMEDIAONPLAY: True # will gen subtitles for all played media regardless of existing external/embedded subtitles (based off of SKIPIFINTERNALSUBLANG)
              NAMESUBLANG: "AUTO" # allows you to pick what it will name the subtitle. Instead of using EN, I'm using AA, so it doesn't mix with exiting external EN subs, and AA will populate higher on the list in Plex.
              SKIPIFINTERNALSUBLANG: 'eng' #Will not generate a subtitle if the file has an internal sub matching the 3 letter code of this variable
              PLEXSERVER: "http://plex.media.svc.cluster.local:32400"
            envFrom:
              - secretRef:
                  name: *appname
            probes:
              liveness: &probes
                enabled: false
                custom: true
                spec:
                  httpGet:
                    path: /
                    port: &port 8090

                  initialDelaySeconds: 0
                  periodSeconds: 10
                  timeoutSeconds: 1
                  failureThreshold: 3
              readiness: *probes
              startup:
                enabled: false

    service:
      main:
        ports:
          http:
            port: 8090
        type: ClusterIP

    volumeClaimTemplates:
      - name: config
        mountPath: /config
        accessMode: ReadWriteOnce
        size: 5Gi
        storageClass: longhorn
    ingress:
      main:
        enabled: true
        annotations:
          hajimari.io/enable: 'true'
          hajimari.io/icon: television-box
          hajimari.io/group: Media
          cert-manager.io/cluster-issuer: letsencrypt-production
          traefik.ingress.kubernetes.io/router.entrypoints: websecure
          traefik.ingress.kubernetes.io/router.middlewares: networking-chain-authelia@kubernetescrd
        hosts:
          - host: &uri subgen.${SECRET_DEV_DOMAIN}
            paths:
              - path: /
                pathType: Prefix
                service:
                  name: main
                  port: http
        tls:
          - hosts:
              - *uri
            secretName: *uri
        className: traefik
    persistence:
      omoikane:
        enabled: true
        type: custom
        volumeSpec:
          nfs:
            server: ${NAS_ADDR}
            path: /volume1/omoikane
        globalMounts:
          - path: /omoikane
      backups:
        enabled: true
        type: custom
        volumeSpec:
          nfs:
            server: ${NAS_ADDR}
            path: ${NFS_ARR}
        globalMounts:
          - path: /config/Backups
      downloads:
        enabled: true
        type: custom
        volumeSpec:
          nfs:
            server: ${NAS_ADDR}
            path: /volume2/downloads
        globalMounts:
          - path: /downloads
    podLabels:
      app: *appname