PeerTube collector

peertube-collector is a project designed to collect and analyze WebRTC statistics from a Chromium browser and export them to a MongoDB service. This project includes a Docker setup for running the necessary services.

Working Project Structure

peertube-collector/
├── requirements.txt
├── telegraf.conf
├── docker-compose.yml
├── Dockerfile
├── main.py
├── .env
└── utils/
└── webrtc-internals-exporter/

Prerequisites

Linux based OS with the following:

Software:

  • Docker (with compose support)

Open ports on localhost/loopback interface:

  • 4444 (Selenium)
  • 7900 (Selenium VNC - Optional)

If needed, you can open these ports in ufw by running the following commands:

ufw allow from 172.30.0.1 to 127.0.0.1 port 4444
ufw allow from 172.30.0.1 to 127.0.0.1 port 7900

Setup

  1. Clone the repository:

    git clone <repository-url>
    cd peertube-collector
    
  2. Create and configure the environment file based on the .env.example file:

    cp .env.example .env
    
  3. Start the Docker containers:

    docker compose up
    

    or in detached mode:

    docker-compose up -d
    

The collector will start collecting WebRTC stats from the specified PeerTube instance.

Components

Docker Compose

The docker-compose.yml file defines the following services:

  • selenium: Runs a Selenium standalone Chromium container.
  • telegraf: Collects and sends metrics to the specified output.
  • collector: Runs the main Python application to collect WebRTC stats.

Dockerfile

The Dockerfile sets up the Python environment and installs the necessary dependencies to run the main.py script.

Main Python Script

The main.py script sets up the Selenium WebDriver, collects WebRTC stats, and sends them to the Telegraf service.

WebRTC Internals Exporter

The webrtc-internals-exporter directory contains a Chromium extension that collects WebRTC stats from the browser.

Description
No description provided
Readme MIT 1.7 GiB
Languages
Python 39.2%
JavaScript 28.7%
Shell 24.9%
Dockerfile 4.9%
HTML 2.1%
Other 0.2%