Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ services:
- RESOLUTION_MIN
- RESOLUTION_WIDTH
- RESOLUTION_WIDTH_MIN
- RTCSTATS_ENABLED
- RTCSTATS_STORE_LOGS
- RTCSTATS_POLL_INTERVAL
- RTCSTATS_SEND_SDP
- RTCSTATS_URL_BASE
- RTC_VISUALIZER_URL_BASE
- RTC_VISUALIZER_PATH
- START_AUDIO_MUTED
- START_AUDIO_ONLY
- START_SILENT
Expand Down
15 changes: 15 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ TZ=UTC
# Set etherpad-lite public URL, including /p/ pad path fragment (uncomment to enable)
#ETHERPAD_PUBLIC_URL=https://etherpad.my.domain/p/

#
# rtcstats integration
#

# Enable rtcstats analytics (uncomment to enable)
#RTCSTATS_ENABLED=true

# Send the console logs to the rtcstats server
#RTCSTATS_STORE_LOGS=false
Copy link
Member

Choose a reason for hiding this comment

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

In this file, RTCSTATS_ENABLED and RTCSTATS_SEND_SDP are both set "true" so when you uncomment them they will be turned on. But RTCSTATS_STORE_LOGS is "false" so if you uncomment it, it won't change anything. I think that this is because you are showing common defaults but the inconsistency seems a little strange to me because the rest of this example file seems to show how to turn things on.


# The interval at which rtcstats will poll getStats, defaults to 10000ms.
#RTCSTATS_POLL_INTERVAL=10000

# Send the SDP to the rtcstats server
#RTCSTATS_SEND_SDP=true

#
# Whiteboard integration
Expand Down
26 changes: 26 additions & 0 deletions rtcstats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
services:

rtcstats-server:
image: jitsi/rtcstats-server
restart: ${RESTART_POLICY:-unless-stopped}
env_file:
- ./rtcstats/.env
- ./rtcstats/rtcstats-server/.env
networks:
meet.jitsi:
aliases:
- rtcstats-server.meet.jitsi


rtc-visualizer:
image: jitsi/rtcstats-visualizer
restart: ${RESTART_POLICY:-unless-stopped}
volumes:
- ./rtcstats/rtc-visualizer/.data:/rtc-visualizer/.data
env_file:
- ./rtcstats/.env
- ./rtcstats/rtc-visualizer/.env
networks:
meet.jitsi:
aliases:
- rtc-visualizer.meet.jitsi
63 changes: 63 additions & 0 deletions rtcstats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Meeting stats with rtcstats

## Overview

This project demonstrates how to use rtcstats with Jitsi Meet to gather detailed information about meeting quality and logs.

## Getting Started

### Setup

1. **Update Jitsi Meet Docker Compose Configuration**

Edit `.env` in your `docker-jitsi-meet` directory to enable rtcstats.
```
#
# rtcstats integration
#

# Enable rtcstats analytics (uncomment to enable)
RTCSTATS_ENABLED=true

# Send the console logs to the rtcstats server
RTCSTATS_STORE_LOGS=false

# The interval at which rtcstats will poll getStats, defaults to 10000ms.
RTCSTATS_POLL_INTERVAL=10000

# Send the SDP to the rtcstats server
RTCSTATS_SEND_SDP=true

```

2. **Configure rtcstats**

Copy the example environment files and edit them according to your environment.
```shell
docker-jitsi-meet/rtcstats$ cp env.example .env
docker-jitsi-meet/rtcstats$ cp ./rtcstats-server/env.example ./rtcstats-server/.env
docker-jitsi-meet/rtcstats$ cp ./rtc-visualizer/env.example ./rtc-visualizer/.env
```

Next, edit `rtc-visualizer/.data/users.json` to add your users. The default credential is `admin:admin`.
```json
{
"Alice": "XXX",
"Bob": "YYY"
}
```

4. **Run Docker Compose**

From your `docker-jitsi-meet` directory, run the following command to start all services.
```shell
docker-compose -f docker-compose.yml -f rtcstats.yml up -d
```


## Usage

1. **View RTC Visualizer**

Open [https://localhost:8443/rtc-visualizer](https://localhost:8443/rtc-visualizer) (or `PUBLIC_URL/rtc-visualizer`) in your browser.

14 changes: 14 additions & 0 deletions rtcstats/env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# For AWS credentials
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=

# For local S3 and DynamoDB
RTCSTATS_S3_ENDPOINT=
RTCSTATS_DYNAMODB_ENDPOINT=

# DynamoDB Table for rtcstats
RTCSTATS_METADATA_TABLE=rtcstats-meta-table-local

# S3 Bucket for rtcstats
RTCSTATS_S3_BUCKET=jitsi-micros-rtcstats-server
1 change: 1 addition & 0 deletions rtcstats/localstack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
volume/
33 changes: 33 additions & 0 deletions rtcstats/localstack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Using Localstack

This section describes how to use Localstack to test and verify your rtcstats setup. Localstack simulates AWS cloud services (like S3) on your local machine, allowing you to confirm that statistics are being saved correctly without needing an actual AWS account.

### Setup


1. **Configure Network Alias for Custom S3 Bucket**

If you are using a custom S3 bucket name, you must add it as a network alias in `localstack.yml`. This allows the rtcstats-server and rtc-visualizer to resolve the bucket's address to the Localstack container.

Edit the `networks` section for the `localstack` service in `rtcstats/localstack/localstack.yml`:
```yml
services:

localstack:
# ... (other settings)
networks:
meet.jitsi:
aliases:
- localhost.localstack.cloud
# - jitsi-micros-rtcstats-server.s3.localhost.localstack.cloud # Default example
- YOUR_RTCSTATS_S3_BUCKET.localhost.localstack.cloud
```
**Note:** Replace `YOUR_RTCSTATS_S3_BUCKET` with the actual bucket name you defined in your environment variables.


2. **Run Docker Compose with Localstack**

From your `docker-jitsi-meet` directory, run the following command to start all services, including Jitsi Meet, rtcstats, and Localstack.
```shell
docker-compose -f docker-compose.yml -f rtcstats.yml -f ./rtcstats/localstack/localstack.yml up -d
```
43 changes: 43 additions & 0 deletions rtcstats/localstack/localstack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
services:

rtcstats-setup:
image: jitsi/rtcstats-server
env_file:
- ./rtcstats/.env
entrypoint: /bin/sh
command: >
-c '
node ./infra-samples/aws/create-dynamodb-table.js &&
node ./infra-samples/aws/create-s3-bucket.js
'
networks:
meet.jitsi:
depends_on:
- localstack


localstack:
container_name: localstack
image: localstack/localstack
ports:
- 4566:4566
- 4510-4559:4510-4559
env_file:
- ./rtcstats/.env
environment:
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
- SERVICES=lambda,iam,logs,s3,dynamodb,firehose

Choose a reason for hiding this comment

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

are lambda, firehose, iam and logs needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, we only use S3 and DynamoDB in this setup. The other services like lambda, firehose, iam, and logs are unnecessary. I will remove them.

- DEBUG=${DEBUG:-1}
- AWS_ACCESS_KEY_ID=dummy
- AWS_SECRET_ACCESS_KEY=dummy
- AWS_DEFAULT_REGION=us-east-1
- AWS_DEFAULT_OUTPUT=json
- AWS_ENDPOINT_URL=http://localhost.localstack.cloud:4566
volumes:
- "./rtcstats/localstack/${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"

Choose a reason for hiding this comment

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

what does this part here do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ./rtcstats/localstack/volume mount was intended for data persistence, but it doesn't seem to be functioning correctly for S3, so I will remove it. The /var/run/docker.sock mount is for services like Lambda. It is not needed here and I will remove that as well.

networks:
meet.jitsi:
aliases:
- localhost.localstack.cloud

Choose a reason for hiding this comment

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

why are these complex aliases needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've confirmed this also works using the simpler service name localstack, so I will update the configuration to use that method instead.

- jitsi-micros-rtcstats-server.s3.localhost.localstack.cloud
3 changes: 3 additions & 0 deletions rtcstats/rtc-visualizer/.data/users.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"admin": "admin"
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to have this something like "admin": "CHANGE_ME" to make it obvious to someone that they need to set the password to something other than admin here.

}
5 changes: 5 additions & 0 deletions rtcstats/rtc-visualizer/env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# rtc-visualizer
#RTCSTATS_FILES_ENDPOINT=
#RTCSTATS_JWT_PUBLIC_KEY=
#RTCSTATS_JWT_EGHT_PUBLIC_KEY=
USERS_FILE=.data/users.json
37 changes: 37 additions & 0 deletions rtcstats/rtcstats-server/env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# rtcstats-server: server config
#RTCSTATS_LOG_LEVEL
#RTCSTATS_ENVIRONMENT
#RTCSTATS_KEYPATH=./certs/key.pem
#RTCSTATS_CERTPATH=./certs/cert.pem
#RTCSTATS_TEMPPATH=temp
RTCSTATS_HTTPS=false
#RTCSTATS_SKIP_LOAD_BALANCER_IP
#RTCSTATS_JSON_CONSOLE_LOG

# rtcstats-server: amplitude
# RTCSTATS_AMPLITUDE_KEY=

# rtcstats-server: firehose
#RTCSTATS_FIREHOSE_AWS_REGION
#RTCSTATS_FIREHOSE_MEETING_STREAM
#RTCSTATS_FIREHOSE_PC_STREAM
#RTCSTATS_FIREHOSE_TRACKS_STREAM
#RTCSTATS_FIREHOSE_E2E_PING_STREAM
#RTCSTATS_FIREHOSE_FACE_LANDMARKS_STREAM
#RTCSTATS_FIREHOSE_MEETING_EVENT_STREAM

# rtcstats-server: s3
#RTCSTATS_S3_ACCESSKEYID
#RTCSTATS_S3_SECRETACCESSKEY
RTCSTATS_S3_AWS_REGION=us-east-1
RTCSTATS_S3_USEIAMAUTH=true
#RTCSTATS_S3_SIGNEDLINKEXPIRATIONSEC

# rtcstats-server: webhooks
#RTCSTATS_WEBHOOK_ENDPOINT
#RTCSTATS_JWT_AUDIENCE
#RTCSTATS_JWT_ISSUER

# rtcstats-server: secretmanager
#RTCSTATS_AWS_SECRET_REGION
#RTCSTATS_JWT_SECRET_ID
34 changes: 34 additions & 0 deletions web/rootfs/defaults/meet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
{{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}}
{{ $XMPP_BOSH_URL_BASE := .Env.XMPP_BOSH_URL_BASE | default "http://xmpp.meet.jitsi:5280" -}}
{{ $CORS_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN := .Env.CORS_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN | default "*" }}
{{ $RTCSTATS_ENABLED := .Env.RTCSTATS_ENABLED | default "false" | toBool -}}
{{ $RTCSTATS_URL_BASE := .Env.RTCSTATS_URL_BASE | default "http://rtcstats-server.meet.jitsi:3000" -}}
{{ $RTC_VISUALIZER_URL_BASE := .Env.RTC_VISUALIZER_URL_BASE | default "http://rtc-visualizer.meet.jitsi:8087" -}}
{{ $RTC_VISUALIZER_PATH := .Env.RTC_VISUALIZER_PATH | default "rtc-visualizer" -}}

server_name _;

Expand Down Expand Up @@ -136,6 +140,36 @@ location ^~ /etherpad/ {
}
{{ end }}

{{ if $RTCSTATS_ENABLED }}
# rtcstats websockets
location = /rtcstats-ws/ {
tcp_nodelay on;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;

proxy_pass {{ $RTCSTATS_URL_BASE }}/;
}

# rtc-visualizer
location = /{{ $RTC_VISUALIZER_PATH }} {
return 301 $scheme://$http_host$request_uri/;
}

location ^~ /{{ $RTC_VISUALIZER_PATH }}/ {
tcp_nodelay on;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;

proxy_pass {{ $RTC_VISUALIZER_URL_BASE }}/;
}
{{ end }}

{{ if .Env.WHITEBOARD_COLLAB_SERVER_URL_BASE }}
# whiteboard (excalidraw-backend)
location = /socket.io/ {
Expand Down
14 changes: 14 additions & 0 deletions web/rootfs/defaults/settings-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
{{ $ENABLE_JAAS_COMPONENTS := .Env.ENABLE_JAAS_COMPONENTS | default "0" | toBool }}
{{ $HIDE_PREJOIN_DISPLAY_NAME := .Env.HIDE_PREJOIN_DISPLAY_NAME | default "false" | toBool -}}
{{ $PUBLIC_URL := .Env.PUBLIC_URL | default "https://localhost:8443" -}}
{{ $PUBLIC_URL_DOMAIN := .Env.PUBLIC_URL | default "https://localhost:8443" | trimPrefix "https://" | trimSuffix "/" -}}
{{ $RESOLUTION := .Env.RESOLUTION | default "720" -}}
{{ $RESOLUTION_MIN := .Env.RESOLUTION_MIN | default "180" -}}
{{ $RESOLUTION_WIDTH := .Env.RESOLUTION_WIDTH | default "1280" -}}
Expand Down Expand Up @@ -68,6 +69,10 @@
{{ $CODEC_ORDER_JVB_MOBILE := .Env.CODEC_ORDER_JVB_MOBILE | default "[\"VP8\", \"VP9\", \"H264\", \"AV1\"]" -}}
{{ $CODEC_ORDER_P2P := .Env.CODEC_ORDER_JVB | default "[\"AV1\", \"VP9\", \"VP8\", \"H264\"]" -}}
{{ $CODEC_ORDER_P2P_MOBILE := .Env.CODEC_ORDER_JVB_MOBILE | default "[\"VP8\", \"VP9\", \"H264\", \"AV1\"]" -}}
{{ $RTCSTATS_ENABLED := .Env.RTCSTATS_ENABLED | default "false" | toBool -}}
{{ $RTCSTATS_STORE_LOGS := .Env.RTCSTATS_STORE_LOGS | default "false" | toBool -}}
{{ $RTCSTATS_POLL_INTERVAL := .Env.RTCSTATS_POLL_INTERVAL | default 10000 -}}
{{ $RTCSTATS_SEND_SDP := .Env.RTCSTATS_SEND_SDP | default "false" | toBool -}}

// Video configuration.
//
Expand Down Expand Up @@ -216,6 +221,15 @@ config.localRecording = {

config.analytics = {};

{{ if $RTCSTATS_ENABLED -}}
// RTCStats configuration.
config.analytics.rtcstatsEnabled = true;
config.analytics.rtcstatsStoreLogs = {{ $RTCSTATS_STORE_LOGS }};
config.analytics.rtcstatsEndpoint = 'wss://{{ $PUBLIC_URL_DOMAIN }}/rtcstats-ws';
config.analytics.rtcstatsPollInterval = {{ $RTCSTATS_POLL_INTERVAL }};
config.analytics.rtcstatsSendSdp = {{ $RTCSTATS_SEND_SDP }};
{{ end -}}

{{ if .Env.AMPLITUDE_ID -}}
// The Amplitude APP Key:
config.analytics.amplitudeAPPKey = '{{ .Env.AMPLITUDE_ID }}';
Expand Down