diff --git a/whisper/docker-compose.yml b/whisper/docker-compose.yml new file mode 100644 index 0000000..5a6b1e5 --- /dev/null +++ b/whisper/docker-compose.yml @@ -0,0 +1,70 @@ +# version: "3.9" + +# services: +# mongo: +# image: mongo +# env_file: +# - .env +# restart: unless-stopped +# volumes: +# - ./whishper_data/db_data:/data/db +# - ./whishper_data/db_data/logs/:/var/log/mongodb/ +# environment: +# MONGO_INITDB_ROOT_USERNAME: ${DB_USER:-whishper} +# MONGO_INITDB_ROOT_PASSWORD: ${DB_PASS:-whishper} +# expose: +# - 27017 +# command: ['--logpath', '/var/log/mongodb/mongod.log'] + +# translate: +# container_name: whisper-libretranslate +# image: libretranslate/libretranslate:latest +# restart: unless-stopped +# volumes: +# - ./whishper_data/libretranslate/data:/home/libretranslate/.local/share +# - ./whishper_data/libretranslate/cache:/home/libretranslate/.local/cache +# env_file: +# - .env +# tty: true +# environment: +# LT_DISABLE_WEB_UI: True +# LT_UPDATE_MODELS: True +# expose: +# - 5000 +# networks: +# default: +# aliases: +# - translate +# healthcheck: +# test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py'] +# interval: 2s +# timeout: 3s +# retries: 5 + +# whishper: +# pull_policy: always +# image: pluja/whishper:${WHISHPER_VERSION:-latest} +# env_file: +# - .env +# volumes: +# - ./whishper_data/uploads:/app/uploads +# - ./whishper_data/logs:/var/log/whishper +# container_name: whishper +# restart: unless-stopped +# networks: +# default: +# aliases: +# - whishper +# ports: +# - 8082:80 +# depends_on: +# - mongo +# - translate +# environment: +# PUBLIC_INTERNAL_API_HOST: "http://127.0.0.1:80" +# PUBLIC_TRANSLATION_API_HOST: "" +# PUBLIC_API_HOST: ${WHISHPER_HOST:-} +# PUBLIC_WHISHPER_PROFILE: cpu +# WHISPER_MODELS_DIR: /app/models +# UPLOAD_DIR: /app/uploads +# CPU_THREADS: 4 \ No newline at end of file diff --git a/whisper/env-configmap.yaml b/whisper/env-configmap.yaml new file mode 100644 index 0000000..621941e --- /dev/null +++ b/whisper/env-configmap.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +data: + DB_PASS: whishper + DB_USER: whishper + LT_LOAD_ONLY: en,nl + WHISHPER_HOST: http://127.0.0.1:8082 + WHISPER_MODELS: large +kind: ConfigMap +metadata: + labels: + io.kompose.service: mongo-env + name: env diff --git a/whisper/ingress.yaml b/whisper/ingress.yaml index d9a4f1b..d10bd7d 100644 --- a/whisper/ingress.yaml +++ b/whisper/ingress.yaml @@ -31,9 +31,9 @@ spec: pathType: Prefix backend: service: - name: app + name: whishper port: - number: 80 + number: 8082 # TLS configuration for HTTPS tls: diff --git a/whisper/mongo-claim0-persistentvolumeclaim.yaml b/whisper/mongo-claim0-persistentvolumeclaim.yaml new file mode 100644 index 0000000..909b0af --- /dev/null +++ b/whisper/mongo-claim0-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: mongo-claim0 + name: mongo-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi diff --git a/whisper/mongo-claim1-persistentvolumeclaim.yaml b/whisper/mongo-claim1-persistentvolumeclaim.yaml new file mode 100644 index 0000000..b34580f --- /dev/null +++ b/whisper/mongo-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: mongo-claim1 + name: mongo-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi diff --git a/whisper/mongo-deployment.yaml b/whisper/mongo-deployment.yaml new file mode 100644 index 0000000..5b7d1f5 --- /dev/null +++ b/whisper/mongo-deployment.yaml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: mongo + name: mongo +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: mongo + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: mongo + spec: + containers: + - args: + - --logpath + - /var/log/mongodb/mongod.log + env: + - name: DB_PASS + valueFrom: + configMapKeyRef: + key: DB_PASS + name: env + - name: DB_USER + valueFrom: + configMapKeyRef: + key: DB_USER + name: env + - name: LT_LOAD_ONLY + valueFrom: + configMapKeyRef: + key: LT_LOAD_ONLY + name: env + - name: MONGO_INITDB_ROOT_PASSWORD + value: whishper + - name: MONGO_INITDB_ROOT_USERNAME + value: whishper + - name: WHISHPER_HOST + valueFrom: + configMapKeyRef: + key: WHISHPER_HOST + name: env + - name: WHISPER_MODELS + valueFrom: + configMapKeyRef: + key: WHISPER_MODELS + name: env + image: mongo + name: mongo + ports: + - containerPort: 27017 + protocol: TCP + volumeMounts: + - mountPath: /data/db + name: mongo-claim0 + - mountPath: /var/log/mongodb + name: mongo-claim1 + restartPolicy: Always + volumes: + - name: mongo-claim0 + persistentVolumeClaim: + claimName: mongo-claim0 + - name: mongo-claim1 + persistentVolumeClaim: + claimName: mongo-claim1 diff --git a/whisper/mongo-service.yaml b/whisper/mongo-service.yaml new file mode 100644 index 0000000..11e7802 --- /dev/null +++ b/whisper/mongo-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: mongo + name: mongo +spec: + ports: + - name: "27017" + port: 27017 + targetPort: 27017 + selector: + io.kompose.service: mongo diff --git a/whisper/nginx.conf b/whisper/nginx.conf new file mode 100644 index 0000000..c779a3d --- /dev/null +++ b/whisper/nginx.conf @@ -0,0 +1,35 @@ +events { + worker_connections 1024; +} + +http { + gzip on; + + server { + listen 80; + + location /api/video { + alias /app/uploads/; + } + + location /languages { + proxy_pass http://translate:5000; + } + + location /api { + client_max_body_size 0; + proxy_pass http://127.0.0.1:8080; + } + + location /ws { + proxy_pass http://127.0.0.1:8080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + location / { + proxy_pass http://127.0.0.1:3000; + } + } +} \ No newline at end of file diff --git a/whisper/translate-claim0-persistentvolumeclaim.yaml b/whisper/translate-claim0-persistentvolumeclaim.yaml new file mode 100644 index 0000000..091672b --- /dev/null +++ b/whisper/translate-claim0-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: translate-claim0 + name: translate-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi diff --git a/whisper/translate-claim1-persistentvolumeclaim.yaml b/whisper/translate-claim1-persistentvolumeclaim.yaml new file mode 100644 index 0000000..1fbcffd --- /dev/null +++ b/whisper/translate-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: translate-claim1 + name: translate-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi \ No newline at end of file diff --git a/whisper/translate-deployment.yaml b/whisper/translate-deployment.yaml new file mode 100644 index 0000000..8f950f2 --- /dev/null +++ b/whisper/translate-deployment.yaml @@ -0,0 +1,81 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: translate + name: translate +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: translate + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: translate + spec: + containers: + - env: + - name: DB_PASS + valueFrom: + configMapKeyRef: + key: DB_PASS + name: env + - name: DB_USER + valueFrom: + configMapKeyRef: + key: DB_USER + name: env + - name: LT_DISABLE_WEB_UI + value: "true" + - name: LT_LOAD_ONLY + valueFrom: + configMapKeyRef: + key: LT_LOAD_ONLY + name: env + - name: LT_UPDATE_MODELS + value: "true" + - name: WHISHPER_HOST + valueFrom: + configMapKeyRef: + key: WHISHPER_HOST + name: env + - name: WHISPER_MODELS + valueFrom: + configMapKeyRef: + key: WHISPER_MODELS + name: env + image: libretranslate/libretranslate:latest + livenessProbe: + exec: + command: + - ./venv/bin/python scripts/healthcheck.py + failureThreshold: 5 + periodSeconds: 2 + timeoutSeconds: 3 + name: whisper-libretranslate + ports: + - containerPort: 5000 + protocol: TCP + tty: true + volumeMounts: + - mountPath: /home/libretranslate/.local/share + name: translate-claim0 + - mountPath: /home/libretranslate/.local/cache + name: translate-claim1 + restartPolicy: Always + volumes: + - name: translate-claim0 + persistentVolumeClaim: + claimName: translate-claim0 + - name: translate-claim1 + persistentVolumeClaim: + claimName: translate-claim1 diff --git a/whisper/translate-service.yaml b/whisper/translate-service.yaml new file mode 100644 index 0000000..0225668 --- /dev/null +++ b/whisper/translate-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: translate + name: translate +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: translate diff --git a/whisper/whishper-claim0-persistentvolumeclaim.yaml b/whisper/whishper-claim0-persistentvolumeclaim.yaml new file mode 100644 index 0000000..14b490c --- /dev/null +++ b/whisper/whishper-claim0-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: whishper-claim0 + name: whishper-claim0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi diff --git a/whisper/whishper-claim1-persistentvolumeclaim.yaml b/whisper/whishper-claim1-persistentvolumeclaim.yaml new file mode 100644 index 0000000..4a499ec --- /dev/null +++ b/whisper/whishper-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: whishper-claim1 + name: whishper-claim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi diff --git a/whisper/whishper-deployment.yaml b/whisper/whishper-deployment.yaml new file mode 100644 index 0000000..663773c --- /dev/null +++ b/whisper/whishper-deployment.yaml @@ -0,0 +1,81 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: whishper + name: whishper +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: whishper + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: whishper + spec: + containers: + - env: + - name: CPU_THREADS + value: "4" + - name: DB_PASS + valueFrom: + configMapKeyRef: + key: DB_PASS + name: env + - name: DB_USER + valueFrom: + configMapKeyRef: + key: DB_USER + name: env + - name: LT_LOAD_ONLY + valueFrom: + configMapKeyRef: + key: LT_LOAD_ONLY + name: env + - name: PUBLIC_API_HOST + - name: PUBLIC_INTERNAL_API_HOST + value: http://127.0.0.1:80 + - name: PUBLIC_TRANSLATION_API_HOST + - name: PUBLIC_WHISHPER_PROFILE + value: cpu + - name: UPLOAD_DIR + value: /app/uploads + - name: WHISHPER_HOST + valueFrom: + configMapKeyRef: + key: WHISHPER_HOST + name: env + - name: WHISPER_MODELS + valueFrom: + configMapKeyRef: + key: WHISPER_MODELS + name: env + - name: WHISPER_MODELS_DIR + value: /app/models + image: pluja/whishper:latest + name: whishper + ports: + - containerPort: 80 + protocol: TCP + volumeMounts: + - mountPath: /app/uploads + name: whishper-claim0 + - mountPath: /var/log/whishper + name: whishper-claim1 + restartPolicy: Always + volumes: + - name: whishper-claim0 + persistentVolumeClaim: + claimName: whishper-claim0 + - name: whishper-claim1 + persistentVolumeClaim: + claimName: whishper-claim1 diff --git a/whisper/whishper-service.yaml b/whisper/whishper-service.yaml new file mode 100644 index 0000000..b4cda44 --- /dev/null +++ b/whisper/whishper-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: whishper + name: whishper +spec: + ports: + - name: "8082" + port: 8082 + targetPort: 80 + selector: + io.kompose.service: whishper