Skip to content

Feat/apps whisper fn - #40

Open
KonstantinMKloster wants to merge 7 commits into
stackitcloud:mainfrom
KonstantinMKloster:feat/apps-whisper-fn
Open

KonstantinMKloster wants to merge 7 commits into
stackitcloud:mainfrom
KonstantinMKloster:feat/apps-whisper-fn

Conversation

@KonstantinMKloster

Copy link
Copy Markdown

Description

Checklist

  • [ X ] The CI pipeline passed successfully.

Konstantin Kloster and others added 7 commits October 8, 2026 11:59
…iption demo

Rebuilds an always-on VM video-transcription demo as a STACKIT Function:
downloads a video from S3, transcribes it with openai-whisper, writes the
transcript back to S3, and scales to zero when idle instead of billing 24/7.
…ually runnable

The fake imageio_ffmpeg path was a non-existent directory already named
"ffmpeg", so handler.py's self-symlink step raised FileNotFoundError on
every run. Point the stub at a real temp file instead.
Added email addresses for maintainers Konstantin Kloster and Dennis Gauss.
@mauritzuph

Copy link
Copy Markdown
Collaborator

CI is still failing @KonstantinMKloster

Comment thread apps/whisper-fn/setup.sh
echo " 4. Test locally without Docker/S3: python3 whisper-fn/test_handler_local.py"
echo " 5. When ready to deploy (creates billable STACKIT resources):"
echo " ./deploy.sh <project-id> <registry-image-ref> <registry-username>"
echo " 6. Using Claude Code? CLAUDE.md has all the context, including the"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add your CLAUDE.md or AGENTS.md or remove such References

Built via a hand-written `Dockerfile`, **not** `sfn functions build`
(Cloud Native Buildpacks) -- the buildpack output includes a zero-byte
metadata layer that this project's STACKIT Harbor registry rejects on
push. See `../DECISIONS.md`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or replace all references to missing files

"outdated cli" against this project)
- `curl`
- A STACKIT project with Functions enabled, `Object Storage bucket`, and
`Container Registry` already set up (see below -- all three already exist

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "already exist for this project" as well as other such comments and write the docs for the readers environment. not yours

if method == "GET" and path == "/health":
return await self._respond(send, 200, {"status": "ok", "model": MODEL_SIZE})

if method == "POST" and path == "/transcribe":

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function URLs are public (https://docs.functions.onstackit.cloud/basics/concepts.html), so anyone who finds the URL can call it in a loop and run up cost. Please require a token from an env var, check Authorization: Bearer with hmac.compare_digest. Return 401 otherwise, and document it.


MODEL_SIZE = os.environ.get("WHISPER_MODEL", "small")
S3_BUCKET = os.environ.get("S3_BUCKET")
S3_INPUT_KEY = os.environ.get("S3_INPUT_KEY", "elephants_dream.mp4")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every call transcribes the same elephants_dream.mp4 and overwrites the same transcript, so this function only works as a demo. Please accept input_key / output_key in the JSON request body

Comment thread apps/whisper-fn/deploy.sh
esac

echo "== Step 4/4: deploy (no --build/--push, image is already in the registry) =="
sfn functions deploy --project-id "$PROJECT_ID" --env-file .env --no-interactive

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull-secret step is also missing. Per the revision.yaml reference (https://docs.functions.onstackit.cloud/reference/revision-yaml.html), "the pinning will fail if e.g. the image is private and pull-credentials haven't been created yet". Please add the step, or check for an existing pull secret before deploying

No `--build`/`--push` flags needed -- omitting them means "don't rebuild,
don't repush," since the image is already in the registry from step 5.
(Note: these are boolean switches, not `key=value` options --
`--build=false` is a CLI parse error, just omit the flag entirely.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The official custom functions how-to (https://docs.functions.onstackit.cloud/how-tos/create-custom-functions.html) uses exactly sfn function deploy --build=false --push=true --image …, and so does the Dockerfile header (Dockerfile:10-11). Please check and make GETTING-STARTED.md, the READMEs and the Dockerfile consistent

# ships a static ffmpeg binary via pip instead, but under a versioned
# filename (e.g. "ffmpeg-linux-aarch64-v7.0.2"), not "ffmpeg" -- putting its
# directory on PATH alone isn't enough, so symlink it to the expected name.
_ffmpeg_exe = imageio_ffmpeg.get_ffmpeg_exe()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the ffmpeg symlink out of handler.py. It currently writes into site-packages at import time, which is why the Dockerfile needs RUN python -c "import handler" as root. Create it at build time instead

license = "MIT"
dependencies = [
"httpx",
"pytest",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move pytest, pytest-asyncio and httpx out of the runtime dependencies, right now they needlessly end up in the image

version = "0.1.0"
requires-python = ">=3.9"
readme = "README.md"
license = "MIT"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change license from MIT to Apache-2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants