Repository navigation
feat: add teardown option to toggle workflow - #36
Conversation
Two bugs preventing clips from playing in the dashboard: 1. fileUrl used DIRECT (http://api-ip:8000) — browsers block loading HTTP media from an HTTPS Vercel page (mixed-content policy). Fix: route file downloads through the same-origin Next.js proxy. 2. The proxy read all responses with upstream.text(), which corrupts binary MP4 data. Fix: use arrayBuffer() so binary passes through intact.
Adds a third action — teardown — that deletes the ACI container group and wipes both file shares (clipsmith-data, clipsmith-out) so Azure storage charges drop to near-zero during idle periods. Also upgrades start to detect whether the container group exists: it calls az container start for an existing group, or re-creates it from clipsmith:latest (same YAML as deploy.yml) after a teardown, making toggle self-sufficient without a full Deploy re-run.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 380e8cd9b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| runs = json.load(sys.stdin) | ||
| print(any(r['status'] in ('pending', 'running') for r in runs)) | ||
| ") | ||
| " 2>/dev/null || echo "False") |
There was a problem hiding this comment.
Fail closed when the active-run check fails
This fallback turns any /runs failure—HTTP error, transient DNS/network issue, or malformed JSON—into ACTIVE=False. For teardown, that means a temporary inability to read the run list can bypass the only guard and the following steps can delete the ACI and wipe both file shares while a pending/running job still exists; this should abort unless the workflow has independently proven the container is absent or stopped.
Useful? React with 👍 / 👎.
| az container delete \ | ||
| --resource-group ${{ secrets.RESOURCE_GROUP }} \ | ||
| --name ${{ secrets.ACI_NAME_DEV }} \ | ||
| --yes 2>/dev/null || echo "Container group not found or already deleted." |
There was a problem hiding this comment.
Do not continue teardown after delete failures
The || echo handles every non-zero az container delete result as if the group were already gone. If Azure returns a permission, resource-lock, conflict, or transient failure while the storage key is still valid, the workflow continues into the share-wipe steps with the container group potentially still alive, risking deletion of the DB/output files under a running service; only a verified not-found case should be ignored.
Useful? React with 👍 / 👎.
Summary
teardownaction that deletes the ACI container group and wipes both file shares (clipsmith-data,clipsmith-out), dropping Azure storage charges to near-zero during idle periodsstartto detect whether the container group exists: callsaz container startfor a stopped group, or re-creates it fromclipsmith:latestafter a teardown — no Deploy re-run neededteardownreuses the active-run guard so it's blocked if a pipeline job is in progressCost impact
stopteardownTest plan