feat(rtcstats): add rtcstats support (#2116)
* feat(rtcstats): add rtcstats support * chore(rtcstats): update users.json to use placeholder password * chore(rtcstats): update RTCSTATS_STORE_LOGS in env.example * chore(rtcstats): add expose ports * feat(rtcstats): add mongodb support * docs(rtcstats): add readme for mongodb integration * chore(rtcstats): fix readme * feat(rtcstats): add grafana dashboard for prometheus metrics * chore(rtcstats): update readme * chore(rtcstats): fix readme * chore(rtcstats): add troubleshooting to localstack readme * fix(rtcstats): improve accuracy of dashboard graphs * fix(rtcstats): fix typo in dashboard display name * fix(rtcstats): simplify and clean up localstack configuration * docs(rtcstats): improve localstack readme --------- Co-authored-by: Andrei Gavrilescu <51706180+andrei-gavrilescu@users.noreply.github.com>
This commit is contained in:
83
rtcstats/README.md
Normal file
83
rtcstats/README.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# 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:CHANGE_ME`.
|
||||
```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.
|
||||
|
||||
## Monitoring with Prometheus
|
||||
|
||||
1. **Update Prometheus Configuration**
|
||||
|
||||
Add the rtcstats-server endpoint to `prometheus/prometheus.yml`.
|
||||
```yml
|
||||
scrape_configs:
|
||||
- job_name: "prometheus"
|
||||
# ... other configurations
|
||||
static_configs:
|
||||
- targets: ["...","rtcstats-server:8095"]
|
||||
```
|
||||
|
||||
2. **Run Docker Compose**
|
||||
|
||||
Restart your environment with the `prometheus.yml` and `grafana.yml` files to launch the monitoring services.
|
||||
|
||||
```shell
|
||||
docker compose -f docker-compose.yml -f rtcstats.yml -f prometheus.yml -f grafana.yml up -d
|
||||
```
|
||||
23
rtcstats/env.example
Normal file
23
rtcstats/env.example
Normal file
@@ -0,0 +1,23 @@
|
||||
# Set the service type. Can be "AWS" or "MongoDB".
|
||||
RTCSTATS_SERVICE_TYPE=AWS
|
||||
|
||||
# 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
|
||||
|
||||
# For MongoDB
|
||||
#RTCSTATS_MONGODB_URI=mongodb://root:root@mongodb.meet.jitsi:27017
|
||||
#RTCSTATS_MONGODB_NAME=rtcstats-db
|
||||
#RTCSTATS_METADATA_COLLECTION=rtcstats-meta-collection
|
||||
#RTCSTATS_GRIDFS_BUCKET=rtcstats-dump-file-bucket
|
||||
49
rtcstats/localstack/README.md
Normal file
49
rtcstats/localstack/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
## 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:
|
||||
# - jitsi-micros-rtcstats-server.s3.localstack # Default example
|
||||
- YOUR_RTCSTATS_S3_BUCKET.s3.localstack
|
||||
```
|
||||
**Note:** Replace `YOUR_RTCSTATS_S3_BUCKET` with the actual bucket name you defined in your environment variables.
|
||||
|
||||
To enable the AWS SDK to make Virtual-Hosted-Style requests to S3, you need to also configure the endpoints in `rtcstats/.env` as follows:
|
||||
```
|
||||
RTCSTATS_S3_ENDPOINT=http://s3.localstack:4566
|
||||
RTCSTATS_DYNAMODB_ENDPOINT=http://localstack:4566
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
- **502 Bad Gateway on RTC Visualizer**
|
||||
|
||||
If you encounter a `502 Bad Gateway` error when accessing the RTC Visualizer, you may need to restart the `jitsi/web` container.
|
||||
|
||||
Run the following command from your docker-jitsi-meet directory to resolve the issue:
|
||||
```shell
|
||||
docker compose restart web
|
||||
```
|
||||
38
rtcstats/localstack/localstack.yml
Normal file
38
rtcstats/localstack/localstack.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
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
|
||||
env_file:
|
||||
- ./rtcstats/.env
|
||||
environment:
|
||||
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
|
||||
- SERVICES=s3,dynamodb
|
||||
- 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://localstack:4566
|
||||
networks:
|
||||
meet.jitsi:
|
||||
aliases:
|
||||
- jitsi-micros-rtcstats-server.s3.localstack
|
||||
1
rtcstats/mongodb/.gitignore
vendored
Normal file
1
rtcstats/mongodb/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
data/
|
||||
29
rtcstats/mongodb/README.md
Normal file
29
rtcstats/mongodb/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
## Using MongoDB
|
||||
|
||||
This section describes how to use MongoDB for rtcstats.
|
||||
|
||||
### Setup
|
||||
|
||||
|
||||
1. **Configure Environment Variables**
|
||||
|
||||
Edit the MongoDB environment variables in `rtcstats/.env`:
|
||||
```
|
||||
# Set the service type. Can be "AWS" or "MongoDB".
|
||||
RTCSTATS_SERVICE_TYPE=MongoDB
|
||||
|
||||
...
|
||||
|
||||
# For MongoDB
|
||||
RTCSTATS_MONGODB_URI=mongodb://root:root@mongodb.meet.jitsi:27017
|
||||
RTCSTATS_MONGODB_NAME=rtcstats-db
|
||||
RTCSTATS_METADATA_COLLECTION=rtcstats-meta-collection
|
||||
RTCSTATS_GRIDFS_BUCKET=rtcstats-dump-file-bucket
|
||||
```
|
||||
|
||||
2. **Run Docker Compose with MongoDB**
|
||||
|
||||
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/mongodb/mongodb.yml up -d
|
||||
```
|
||||
13
rtcstats/mongodb/mongodb.yml
Normal file
13
rtcstats/mongodb/mongodb.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
|
||||
mongodb:
|
||||
image: mongo
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: root
|
||||
volumes:
|
||||
- ./rtcstats/mongodb/data:/data/db
|
||||
networks:
|
||||
meet.jitsi:
|
||||
aliases:
|
||||
- mongodb.meet.jitsi
|
||||
3
rtcstats/rtc-visualizer/.data/users.json
Normal file
3
rtcstats/rtc-visualizer/.data/users.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"admin": "CHANGE_ME"
|
||||
}
|
||||
5
rtcstats/rtc-visualizer/env.example
Normal file
5
rtcstats/rtc-visualizer/env.example
Normal file
@@ -0,0 +1,5 @@
|
||||
# rtc-visualizer
|
||||
#RTCSTATS_FILES_ENDPOINT=
|
||||
#RTCSTATS_JWT_PUBLIC_KEY=
|
||||
#RTCSTATS_JWT_EGHT_PUBLIC_KEY=
|
||||
USERS_FILE=.data/users.json
|
||||
37
rtcstats/rtcstats-server/env.example
Normal file
37
rtcstats/rtcstats-server/env.example
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user