A tool that automatically uploads Jitsi recordings from a Jibri container's PVC (Persistent Volume Claim) to Google Drive.
- Monitors Jibri recordings directory for new video files
- Automatically uploads recordings to Google Drive
- Configurable retry logic with exponential backoff
- Comprehensive logging and error handling
- Optional cleanup of local files after successful upload
- Graceful shutdown handling
- Support for multiple video formats (MP4, AVI, MOV, MKV, WebM)
- Node.js 16+
- Google Drive API credentials
- Access to Jibri recordings directory
-
Install dependencies:
npm install
-
Configure Google Drive API:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google Drive API
- Create OAuth 2.0 credentials
- Generate a refresh token using the OAuth playground
-
Configure environment variables:
cp .env.example .env
Edit
.env
with your configuration:GOOGLE_CLIENT_ID=your_client_id_here GOOGLE_CLIENT_SECRET=your_client_secret_here GOOGLE_REFRESH_TOKEN=your_refresh_token_here UPLOAD_FOLDER_ID=your_google_drive_folder_id JIBRI_RECORDINGS_PATH=/opt/jitsi/jibri/recordings
npm run dev
npm start
For Kubernetes/Docker environments, mount the Jibri PVC to the container and set the appropriate path in the environment variables.
Example Docker run:
docker run -d \
--name jitsi-uploader \
-v /path/to/jibri/recordings:/opt/jitsi/jibri/recordings:ro \
-e GOOGLE_CLIENT_ID=your_client_id \
-e GOOGLE_CLIENT_SECRET=your_client_secret \
-e GOOGLE_REFRESH_TOKEN=your_refresh_token \
-e UPLOAD_FOLDER_ID=your_folder_id \
jitsi-recording-uploader
Environment Variable | Description | Default |
---|---|---|
GOOGLE_CLIENT_ID |
Google OAuth client ID | Required |
GOOGLE_CLIENT_SECRET |
Google OAuth client secret | Required |
GOOGLE_REFRESH_TOKEN |
Google OAuth refresh token | Required |
UPLOAD_FOLDER_ID |
Target Google Drive folder ID | Optional |
JIBRI_RECORDINGS_PATH |
Path to Jibri recordings | /opt/jitsi/jibri/recordings |
LOG_LEVEL |
Logging level | info |
WATCH_INTERVAL |
File watcher interval (ms) | 5000 |
MAX_RETRIES |
Max upload retry attempts | 3 |
CLEANUP_AFTER_UPLOAD |
Delete local files after upload | false |
Logs are written to:
- Console (colored output)
logs/combined.log
(all logs)logs/error.log
(errors only)
-
Create Google Cloud Project:
- Visit Google Cloud Console
- Create a new project
- Enable Google Drive API
-
Create OAuth Credentials:
- Go to APIs & Services > Credentials
- Create OAuth 2.0 Client ID
- Set authorized redirect URIs
-
Generate Refresh Token:
- Use Google OAuth Playground
- Select Google Drive API v3 scopes
- Authorize and exchange for refresh token
-
Get Folder ID (Optional):
- Create or navigate to target folder in Google Drive
- Copy folder ID from URL:
https://drive.google.com/drive/folders/FOLDER_ID_HERE
The tool includes comprehensive error handling:
- Automatic retries with exponential backoff
- File stability checks (waits for files to stop changing)
- Google Drive API error handling
- Graceful shutdown on system signals
- Status logging every 30 seconds when uploads are active
- Detailed upload progress and results logging
- Error tracking with stack traces
- Queue status monitoring
MIT