This repo contains code for:
- Configuring a
livekit
egress server so that it saves recordings to aminio
instance. - Adding a simple inotify hook that will upload recordings to a nextcloud instance using
webdav
and share it with an arbitrary entity in Nextcloud (Atalk
conversation is used by default).
First, compile any of the two binaries that you think you're going to need:
go build ./cmd/livekit-minio
go build ./cmd/minio-hook
The first binary you need to place in the box that you will use to control recordings. You might want to dockerize it and make it available from wherever your authentication app lives.
Edit the provided sample config:
cp livekit-minio-example.env .env
Here you might want to implement a different uploader, but one is provided for convenience.
On the folder/container where you want to run the inotify watcher, do:
cp mino-hook-example.env .env
The minio instance is local in this case; you need to provide also nextcloud credentials to do the webdav upload and the sharing with the destination group. by default, we're using a Talk ID, but this can be customized to your needs.
On the API server:
❯ ./livekit-minio
____ __
/ __/___/ / ___
/ _// __/ _ \/ _ \
/___/\__/_//_/\___/ v3.3.10-dev
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
O\
⇨ http server started on [::]:3000
On the minio vm:
./minio-hook
The control utility offers two endpoints. You need, obviously, to pass credentials to connect to your egress server. It expects two parameters:
- the room name
- the sharewith entity. this will be encoded in the filename, and later used to known with which nextcloud entity the audiobot needs to share the file.
An example will probably make it clearer. To start recording:
curl "localhost:3000/start?room=testroom&shareWith=a92tv9pf"
And to stop it:
curl "localhost:3000/stop?room=testroom
Please note that stopping the service will make it lose state (i.e., will lose any ongoing recording), since the live recordings are only persisted in memory so far.
Beware also that there's no authentication implemented in the control plane; it's up to you to check that the calls to make recordings are properly checked for ACLs and sanitized.
If you're using django, you might want to use django-livekit-api to schedule livekit rooms and to add permissions for joining and recording.
Follow instructions to install minio
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20231223071911.0.0_amd64.deb -O minio.deb
sudo dpkg -i minio.deb
- Make sure that the service is up and running, and create a bucket (
livekit-uploads
). - Create access key (take note of the access key and secret).
- Create a policy for the bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::livekit-recordings/*"
]
}
]
}
- Create user
livekit
and assign the livekit policy.