Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
6b7149540e | |||
3bd868f391 | |||
fd622dcb34 | |||
9bccf45052 | |||
b2ff30d358 | |||
5493f2ba41 | |||
927f8ca092 |
3 changed files with 129 additions and 2 deletions
39
.forgejo/workflows/build.yml
Normal file
39
.forgejo/workflows/build.yml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
name: docker-build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions: write-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- uses: actions/forgejo-release@v2
|
||||||
|
with:
|
||||||
|
direction: upload
|
||||||
|
url: https://git.h2-invent.com
|
||||||
|
repo: meetling/livekit-uploader
|
||||||
|
tag: ${{ vars.LIVEKIT_UPLOADER_MAJOR_VERSION }}.${{ github.run_number }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
docker-build:
|
||||||
|
runs-on: host
|
||||||
|
needs:
|
||||||
|
- release
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.h2-invent.com
|
||||||
|
username: ${{ secrets.FORGEJO_ACTION_PACKAGE_RW_USER }}
|
||||||
|
password: ${{ secrets.FORGEJO_ACTION_PACKAGE_RW_KEY }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: git.h2-invent.com/meetling/livekit-uploader:${{ vars.LIVEKIT_UPLOADER_MAJOR_VERSION }}.${{ github.run_number }},git.h2-invent.com/meetling/livekit-uploader:latest
|
89
README.md
89
README.md
|
@ -1,2 +1,89 @@
|
||||||
# Livekit-Uploader
|
# Meetling Livekit Recording Uploader
|
||||||
|
|
||||||
|
This containerized utility monitors a directory for new `.mp4` files, splits them into chunks, and uploads each chunk to a specified endpoint. It is intended for use with the Meetling Livekit recording system.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Features
|
||||||
|
|
||||||
|
- 📁 Watches the `/out` directory for new `.mp4` files
|
||||||
|
- ✂️ Splits files into configurable chunk sizes
|
||||||
|
- 📤 Uploads chunks via HTTP with bearer token authorization
|
||||||
|
- 🐳 Lightweight Alpine-based Docker image
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚙️ Environment Variables
|
||||||
|
|
||||||
|
| Variable | Default | Description |
|
||||||
|
|---------------|-------------------------------------------|--------------------------------------------|
|
||||||
|
| `CHUNK_SIZE` | `1048576` (1 MiB) | Size of each chunk in bytes |
|
||||||
|
| `UPLOAD_URL` | `http://localhost:8000/recording/upload` | Upload endpoint URL |
|
||||||
|
| `AUTH_TOKEN` | `verySecretToken` | Bearer token for authentication |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Usage
|
||||||
|
|
||||||
|
### 1. Build the Docker image
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t meetling-uploader --build-arg VERSION=1.0.0 .
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Run the container
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -v /your/output/directory:/out meetling-uploader
|
||||||
|
```
|
||||||
|
|
||||||
|
> Replace `/your/output/directory` with the directory containing your `.mp4` recordings.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔄 Upload Process
|
||||||
|
|
||||||
|
Once a `.mp4` file is completely written to `/out`, the script:
|
||||||
|
|
||||||
|
1. Verifies the file exists.
|
||||||
|
2. Calculates file size.
|
||||||
|
3. Splits the file into chunks based on `CHUNK_SIZE`.
|
||||||
|
4. Uploads each chunk using `curl`.
|
||||||
|
|
||||||
|
Each upload includes the following multipart form fields:
|
||||||
|
|
||||||
|
- `recording_id`: Filename without `.mp4`
|
||||||
|
- `chunk_index`: Index of the chunk (starting from 0)
|
||||||
|
- `total_chunks`: Total number of chunks
|
||||||
|
- `file`: The actual chunk
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🐳 Dockerfile Overview
|
||||||
|
|
||||||
|
The image uses `alpine:3.20` and installs:
|
||||||
|
|
||||||
|
- `inotify-tools` (for file system event watching)
|
||||||
|
- `curl` (for HTTP requests)
|
||||||
|
- `coreutils` (for `stat` and `dd` utilities)
|
||||||
|
|
||||||
|
The script is located at `/inotify.sh` and is executed when the container starts.
|
||||||
|
It runs as the non-privileged user `nobody` for security.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 License
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👨💻 Maintainers
|
||||||
|
|
||||||
|
**H2 invent GmbH**
|
||||||
|
📧 [support@h2-invent.com](mailto:support@h2-invent.com)
|
||||||
|
🌐 [https://meetling.de](https://meetling.de)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> **Note:** Ensure your backend server supports chunked uploads and correctly assembles the file.
|
|
@ -36,7 +36,8 @@ inotifywait -m /out -e close_write |
|
||||||
if [ -f "$temp_chunk_file" ]
|
if [ -f "$temp_chunk_file" ]
|
||||||
then
|
then
|
||||||
# Chunk hochladen
|
# Chunk hochladen
|
||||||
/usr/bin/curl --location "$UPLOAD_URL" \
|
/usr/bin/curl --no-progress-meter \
|
||||||
|
--location "$UPLOAD_URL" \
|
||||||
--header "Authorization: Bearer $AUTH_TOKEN" \
|
--header "Authorization: Bearer $AUTH_TOKEN" \
|
||||||
--form "recording_id=${id}" \
|
--form "recording_id=${id}" \
|
||||||
--form "chunk_index=${i}" \
|
--form "chunk_index=${i}" \
|
||||||
|
|
Loading…
Add table
Reference in a new issue