diff --git a/ci/k8s/coverpage.yaml b/ci/k8s/coverpage.yaml index 67fe516..4559e3d 100644 --- a/ci/k8s/coverpage.yaml +++ b/ci/k8s/coverpage.yaml @@ -8,7 +8,7 @@ spec: app: islandora-coverpage ports: - protocol: TCP - port: 8888 + port: 8082 targetPort: 8080 --- apiVersion: apps/v1 @@ -37,7 +37,7 @@ spec: memory: "1Gi" ports: - containerPort: 8080 - hostPort: 8888 + hostPort: 8082 readinessProbe: httpGet: path: /healthcheck diff --git a/ci/k8s/crayfits.yaml b/ci/k8s/crayfits.yaml index 0f8af92..e9f0a50 100644 --- a/ci/k8s/crayfits.yaml +++ b/ci/k8s/crayfits.yaml @@ -8,7 +8,8 @@ spec: app: islandora-crayfits ports: - protocol: TCP - port: 8080 + port: 8083 + targetPort: 8080 --- apiVersion: apps/v1 kind: Deployment @@ -36,7 +37,7 @@ spec: memory: "128Mi" ports: - containerPort: 8080 - hostPort: 8080 + hostPort: 8083 readinessProbe: httpGet: path: /healthcheck diff --git a/ci/k8s/fits.yaml b/ci/k8s/fits.yaml index 50dd273..136ef1d 100644 --- a/ci/k8s/fits.yaml +++ b/ci/k8s/fits.yaml @@ -8,7 +8,8 @@ spec: app: fits ports: - protocol: TCP - port: 8080 + port: 8084 + targetPort: 8080 --- apiVersion: apps/v1 kind: Deployment @@ -41,6 +42,7 @@ spec: memory: "2Gi" ports: - containerPort: 8080 + hostPort: 8084 readinessProbe: httpGet: path: /fits/version diff --git a/ci/k8s/hls.yaml b/ci/k8s/hls.yaml new file mode 100644 index 0000000..498974a --- /dev/null +++ b/ci/k8s/hls.yaml @@ -0,0 +1,46 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: islandora-hls +spec: + selector: + app: islandora-hls + ports: + - protocol: TCP + port: 8085 + targetPort: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: islandora-hls +spec: + replicas: 3 + selector: + matchLabels: + app: islandora-hls + template: + metadata: + labels: + app: islandora-hls + spec: + containers: + - name: scyllaridae-hls + image: lehighlts/scyllaridae-hls:main + imagePullPolicy: IfNotPresent + resources: + requests: + memory: "512Mi" + cpu: "250m" + limits: + memory: "4Gi" + ports: + - hostPort: 8085 + containerPort: 8080 + readinessProbe: + httpGet: + path: /healthcheck + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 10 diff --git a/ci/k8s/homarus.yaml b/ci/k8s/homarus.yaml index fc86e2b..36ab336 100644 --- a/ci/k8s/homarus.yaml +++ b/ci/k8s/homarus.yaml @@ -8,7 +8,8 @@ spec: app: islandora-ffmpeg ports: - protocol: TCP - port: 8080 + port: 8086 + targetPort: 8080 --- apiVersion: apps/v1 kind: Deployment @@ -35,7 +36,8 @@ spec: limits: memory: "4Gi" ports: - - containerPort: 8080 + - hostPort: 8086 + containerPort: 8080 readinessProbe: httpGet: path: /healthcheck diff --git a/ci/k8s/htr.yaml b/ci/k8s/htr.yaml index de51390..282b1d2 100644 --- a/ci/k8s/htr.yaml +++ b/ci/k8s/htr.yaml @@ -8,7 +8,7 @@ spec: app: islandora-openai-htr ports: - protocol: TCP - port: 8001 + port: 8087 targetPort: 8080 --- apiVersion: apps/v1 @@ -26,7 +26,7 @@ spec: app: islandora-openai-htr spec: containers: - - name: scyllaridae-tesseract + - name: scyllaridae-htr image: lehighlts/scyllaridae-openai-htr:main imagePullPolicy: IfNotPresent env: @@ -42,7 +42,7 @@ spec: limits: memory: "1Gi" ports: - - hostPort: 8001 + - hostPort: 8087 containerPort: 8080 readinessProbe: httpGet: diff --git a/ci/k8s/mergepdf.yaml b/ci/k8s/mergepdf.yaml index 800167b..af65cd0 100644 --- a/ci/k8s/mergepdf.yaml +++ b/ci/k8s/mergepdf.yaml @@ -8,7 +8,7 @@ spec: app: islandora-mergepdf ports: - protocol: TCP - port: 8887 + port: 8088 targetPort: 8080 --- apiVersion: apps/v1 @@ -40,7 +40,7 @@ spec: memory: "4Gi" ports: - containerPort: 8080 - hostPort: 8887 + hostPort: 8088 readinessProbe: httpGet: path: /healthcheck diff --git a/ci/k8s/ocrpdf.yaml b/ci/k8s/ocrpdf.yaml index 1ebd9a4..2d0d1dd 100644 --- a/ci/k8s/ocrpdf.yaml +++ b/ci/k8s/ocrpdf.yaml @@ -8,7 +8,7 @@ spec: app: islandora-ocrpdf ports: - protocol: TCP - port: 8886 + port: 8089 targetPort: 8080 --- apiVersion: apps/v1 @@ -37,7 +37,7 @@ spec: memory: "2Gi" ports: - containerPort: 8080 - hostPort: 8886 + hostPort: 8089 readinessProbe: httpGet: path: /healthcheck diff --git a/examples/hls/Dockerfile b/examples/hls/Dockerfile new file mode 100644 index 0000000..ec7be9e --- /dev/null +++ b/examples/hls/Dockerfile @@ -0,0 +1,11 @@ +ARG TAG=main +ARG DOCKER_REPOSITORY=lehighlts +FROM ${DOCKER_REPOSITORY}/scyllaridae:${TAG} + +RUN apk update && \ + apk add --no-cache \ + ffmpeg==6.1.1-r8 \ + jq==1.7.1-r0 + +COPY scyllaridae.yml /app/scyllaridae.yml +COPY cmd.sh /app/cmd.sh diff --git a/examples/hls/README.md b/examples/hls/README.md new file mode 100644 index 0000000..77a6925 --- /dev/null +++ b/examples/hls/README.md @@ -0,0 +1,5 @@ +# Streaming Audio and Video Derivatives + +Create an HLS streaming derivative for audio and video files + +Requires `islandora_hls` module running on your Islandora site to render the streaming derivative. diff --git a/examples/hls/cmd.sh b/examples/hls/cmd.sh new file mode 100755 index 0000000..7c5c571 --- /dev/null +++ b/examples/hls/cmd.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -eou pipefail + +SOURCE_MIMETYPE="$1" +NODE_URL="$2" +NID=$(basename "$NODE_URL") +TMP_DIR=$(mktemp -d) + +ffmpeg \ + -f "$SOURCE_MIMETYPE" \ + -i - \ + -profile:v \ + baseline \ + -level 3.0 \ + -s 640x360 \ + -start_number 0 \ + -hls_time 10 \ + -hls_list_size 0 \ + -f hls \ + -b:v 800k \ + -maxrate 800k \ + -bufsize 1200k \ + -b:a 96k "$TMP_DIR/$NID.m3u8" > /dev/null 2>&1 + +if [ ! -f "$TMP_DIR/$NID.m3u8" ]; then + exit 1 +fi + +# shellcheck disable=SC2046 +tar -czf "$TMP_DIR/hls.tar.gz" -C "$TMP_DIR" "./$NID.m3u8" $(cd "$TMP_DIR" ; echo ./*.ts) + +BASE_URL=$(dirname "$NODE_URL" | xargs dirname) +TID=$(curl -s "$BASE_URL/term_from_term_name?vocab=islandora_media_use&name=Service+File&_format=json" | jq '.[0].tid[0].value') + +curl -s \ + -H "Authorization: $SCYLLARIDAE_AUTH" \ + -H "Content-Type: application/gzip" \ + -H "Content-Location: private://derivatives/hls/$NID/hls.tar.gz" \ + -T "$TMP_DIR/hls.tar.gz" \ + "$NODE_URL/media/file/$TID" + +rm -rf "$TMP_DIR" diff --git a/examples/hls/scyllaridae.yml b/examples/hls/scyllaridae.yml new file mode 100644 index 0000000..3da5afa --- /dev/null +++ b/examples/hls/scyllaridae.yml @@ -0,0 +1,10 @@ +forwardAuth: true +allowedMimeTypes: + - "audio/*" + - "video/*" +cmdByMimeType: + default: + cmd: /app/cmd.sh + args: + - "%source-mime-ext" + - "%canonical" diff --git a/examples/parry/scyllaridae.yml b/examples/parry/scyllaridae.yml index 4b1c553..24ef8dc 100644 --- a/examples/parry/scyllaridae.yml +++ b/examples/parry/scyllaridae.yml @@ -2,6 +2,7 @@ queueMiddlewares: - queueName: islandora-pdf-coverpage url: http://coverpage:8080 consumers: 3 + forwardAuth: true - queueName: islandora-cache-warmer url: http://cache-warmer:8080 consumers: 3 @@ -9,3 +10,8 @@ queueMiddlewares: - queueName: islandora-merge-pdf url: http://mergepdf:8080 consumers: 3 + forwardAuth: true + - queueName: islandora-hls + url: http://hls:8080 + consumers: 3 + forwardAuth: true