Skip to content

Commit fb5d113

Browse files
committed
jitsi self hosted local setup
1 parent 078ee5d commit fb5d113

File tree

21 files changed

+3637
-15
lines changed

21 files changed

+3637
-15
lines changed

docker/jitsi/.env.example

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Jitsi Configuration
2+
# Copy this file to .env and configure for your environment
3+
4+
# ===== Basic Settings =====
5+
HTTP_PORT=8080
6+
HTTPS_PORT=8443
7+
PUBLIC_URL=https://meet.localhost:8443
8+
DOCKER_HOST_ADDRESS=localhost
9+
10+
# ===== Authentication =====
11+
# 0 = anyone can create rooms, 1 = only authenticated users
12+
ENABLE_AUTH=0
13+
ENABLE_GUESTS=1
14+
AUTH_TYPE=internal
15+
16+
# ===== Secrets (change these in production!) =====
17+
JICOFO_AUTH_PASSWORD=changeme123
18+
JICOFO_COMPONENT_SECRET=changeme456
19+
JVB_AUTH_PASSWORD=changeme789
20+
JIBRI_XMPP_PASSWORD=changeme012
21+
JIBRI_RECORDER_PASSWORD=changeme345
22+
23+
# ===== Recording =====
24+
ENABLE_RECORDING=1
25+
JIBRI_RECORDING_RESOLUTION=1280x720
26+
JIBRI_RECORDING_VIDEO_ENCODE_PRESET=veryfast
27+
28+
# ===== Transcription =====
29+
ENABLE_TRANSCRIPTIONS=0
30+
31+
# ===== Network =====
32+
JVB_PORT=10000
33+
JVB_TCP_PORT=4443
34+
JVB_TCP_HARVESTER_DISABLED=false
35+
JVB_STUN_SERVERS=stun.l.google.com:19302,stun1.l.google.com:19302
36+
37+
# ===== Event Collection =====
38+
EVENT_COLLECTOR_PORT=3001
39+
REDIS_PORT=6380
40+
REDIS_URL=redis://redis:6379
41+
ENABLE_EVENT_LOGGING=true
42+
43+
# ===== Reflector Integration =====
44+
# Update this to your Reflector backend URL
45+
REFLECTOR_WEBHOOK_URL=http://host.docker.internal:8000/v1/jitsi/events
46+
REFLECTOR_API_KEY=your-api-key-here
47+
48+
# ===== S3 Storage (optional) =====
49+
# For uploading recordings to S3-compatible storage
50+
S3_ENDPOINT=
51+
S3_BUCKET=
52+
AWS_ACCESS_KEY_ID=
53+
AWS_SECRET_ACCESS_KEY=
54+
AWS_DEFAULT_REGION=us-east-1
55+
56+
# ===== Monitoring (optional) =====
57+
ENABLE_STATS_D=false
58+
JVB_SENTRY_DSN=
59+
SENTRY_ENVIRONMENT=development
60+
61+
# ===== Advanced =====
62+
CHROMIUM_FLAGS=--use-fake-ui-for-media-stream --start-maximized --kiosk --enabled --disable-infobars --autoplay-policy=no-user-gesture-required
63+
NODE_ENV=development

docker/jitsi/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Jitsi local development files
2+
recordings/
3+
ssl/*.pem
4+
ssl/*.key
5+
ssl/*.crt
6+
ssl/*.csr
7+
prosody/
8+
jicofo/
9+
jvb/
10+
jibri/
11+
event-collector/node_modules/
12+
event-collector/dist/
13+
.env

docker/jitsi/README.md

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
# Local Jitsi Setup with Recording
2+
3+
This directory contains a complete local Jitsi Meet setup with automatic recording capabilities and event collection.
4+
5+
## Quick Start
6+
7+
### Prerequisites
8+
9+
1. **Docker** and **Docker Compose** installed
10+
2. **Node.js** and **npm** for event collector
11+
3. **mkcert** for SSL certificates (install with `brew install mkcert`)
12+
4. **Add to /etc/hosts:**
13+
```bash
14+
echo "127.0.0.1 jitsi.local" | sudo tee -a /etc/hosts
15+
```
16+
17+
### Setup SSL Certificates
18+
19+
```bash
20+
cd ssl
21+
mkcert jitsi.local localhost 127.0.0.1 ::1
22+
cp jitsi.local+3.pem jitsi.crt
23+
cp jitsi.local+3-key.pem jitsi.key
24+
```
25+
26+
### Start Services
27+
28+
```bash
29+
# Start all Jitsi services (includes event collector)
30+
docker compose -f docker-compose.simple.yml up -d
31+
```
32+
33+
**All services start automatically including:**
34+
- Jitsi stack (nginx, web, prosody, jicofo, jvb, jibri)
35+
- Redis database
36+
- Event collector (containerized)
37+
38+
### Verify Services Running
39+
40+
```bash
41+
docker ps --filter name=jitsi
42+
```
43+
44+
You should see:
45+
- `jitsi_nginx` (ports 80, 443)
46+
- `jitsi_web`
47+
- `jitsi_prosody`
48+
- `jitsi_jicofo`
49+
- `jitsi_jvb` (ports 4443, 10000)
50+
- `jitsi_jibri` (recording service)
51+
- `jitsi_redis` (port 6380)
52+
- `jitsi_event_collector` (port 3002)
53+
54+
## Testing
55+
56+
### Test Jitsi Meeting
57+
58+
1. **Start Frontend** (if not already running):
59+
```bash
60+
cd ../../www
61+
pnpm dev
62+
```
63+
64+
2. **Open Test Page:**
65+
- Navigate to: `http://localhost:3000/jitsi-test?local=true`
66+
- Fill form:
67+
- Room: `my-test-room`
68+
- Name: `Your Name`
69+
- Click "Join Meeting"
70+
71+
3. **Verify Features:**
72+
- ✅ Meeting loads in iframe
73+
- ✅ Auto-recording starts (console: "🎬 Attempting to start recording...")
74+
- ✅ No "recording failed to start" errors
75+
- ✅ Recording indicator shows "Recording" in UI
76+
77+
### Verify Recording Files
78+
79+
**After leaving meeting:**
80+
```bash
81+
# Check recording files created
82+
ls -la recordings/
83+
84+
# View specific recording
85+
ls -la recordings/*/
86+
```
87+
88+
**Files created:**
89+
- `{room-name}_{timestamp}.mp4` - Recording file
90+
- `metadata.json` - Recording metadata
91+
92+
### Verify Events in Redis
93+
94+
```bash
95+
# Check events for specific room
96+
redis-cli -p 6380 LRANGE "jitsi:events:my-test-room" 0 -1
97+
98+
# Monitor events in real-time
99+
redis-cli -p 6380 MONITOR
100+
101+
# Subscribe to event publications
102+
redis-cli -p 6380 PSUBSCRIBE "jitsi:*"
103+
```
104+
105+
**Expected events:**
106+
- `api_ready` - Meeting API initialized
107+
- `videoConferenceJoined` - Participant joined
108+
- `recording_status_changed` - Recording started/stopped
109+
- `videoConferenceLeft` - Participant left
110+
- `ready_to_close` - Meeting ended
111+
112+
## Architecture
113+
114+
```
115+
Frontend (localhost:3000)
116+
↓ HTTPS iframe + Client events
117+
Nginx Proxy (jitsi.local:443)
118+
↓ SSL termination
119+
Jitsi Web + Prosody + Jicofo + JVB
120+
↓ Recording requests
121+
Jibri → MP4 files (/recordings/)
122+
↓ Webhook events + Finalize script
123+
Event Collector (localhost:3002)
124+
↓ Publish/Store
125+
Redis (localhost:6380)
126+
```
127+
128+
### Event Flow
129+
130+
1. **Client Events** (from frontend):
131+
- `videoConferenceJoined` - User joins with participant info
132+
- `videoConferenceLeft` - User leaves meeting
133+
- `recording_status_changed` - Recording state changes
134+
135+
2. **Jibri Events** (from recording service):
136+
- `recording_completed` - Recording finished with file metadata
137+
- `recording_available` - Recording file ready for processing
138+
- `recording_failed` - Recording error occurred
139+
140+
3. **Event Correlation**:
141+
- Events linked by `roomName` and `sessionId`
142+
- Recording files contain session ID in path
143+
- Participant data from client events enriches recording metadata
144+
145+
## Configuration
146+
147+
### Key Environment Variables
148+
149+
**Jibri (Recording Service):**
150+
- `JIBRI_WEBHOOK_SUBSCRIBERS` - Webhook endpoint for events (http://event-collector:3002/webhook/jibri)
151+
- `JIBRI_FINALIZE_RECORDING_SCRIPT_PATH` - Post-recording script (/scripts/finalize.sh)
152+
- `JIBRI_RECORDING_DIR` - Recording output directory (/recordings)
153+
154+
**Event Collector:**
155+
- `REDIS_URL` - Redis connection (default: redis://localhost:6380)
156+
- `ENABLE_EVENT_LOGGING` - Enable detailed logging (true/false)
157+
- `REFLECTOR_WEBHOOK_URL` - Forward events to Reflector (optional)
158+
159+
**Frontend:**
160+
- `NEXT_PUBLIC_JITSI_DOMAIN` - Jitsi domain (default: jitsi.local)
161+
- `NEXT_PUBLIC_EVENT_COLLECTOR_URL` - Event collector URL (default: localhost:3002)
162+
- `NEXT_PUBLIC_USE_LOCAL_JITSI` - Force local Jitsi (true/false)
163+
164+
### Important Files
165+
166+
- `docker-compose.simple.yml` - Self-contained Jitsi stack
167+
- `docker-compose.yml` - Production version (requires external network)
168+
- `nginx.conf` - SSL proxy configuration
169+
- `event-collector/` - TypeScript event aggregation service
170+
- `.gitignore` - Excludes recordings and certificates
171+
172+
## Troubleshooting
173+
174+
### Common Issues
175+
176+
**Recording fails to start:**
177+
- Check Jibri container logs: `docker logs jitsi_jibri`
178+
- Verify DNS mapping in container: `docker exec jitsi_jibri cat /etc/hosts`
179+
- Should see: `192.168.x.x jitsi.local`
180+
181+
**SSL certificate errors:**
182+
- Verify mkcert certificates exist: `ls -la ssl/`
183+
- Trust certificates: Run mkcert commands from setup section
184+
185+
**Event collector not receiving events:**
186+
- Check event collector logs for incoming webhook calls
187+
- Verify frontend can reach localhost:3002
188+
- Check Redis connection: `redis-cli -p 6380 ping`
189+
190+
**iframe embedding blocked:**
191+
- Check nginx Content-Security-Policy headers
192+
- Verify frontend loads from localhost:3000
193+
194+
### Logs and Debugging
195+
196+
```bash
197+
# Jitsi container logs
198+
docker logs jitsi_jibri # Recording service
199+
docker logs jitsi_prosody # XMPP server
200+
docker logs jitsi_nginx # SSL proxy
201+
202+
# Event collector logs
203+
# See running event collector terminal
204+
205+
# Redis operations
206+
redis-cli -p 6380 MONITOR
207+
```
208+
209+
### Clean Restart
210+
211+
```bash
212+
# Stop all services
213+
docker compose -f docker-compose.simple.yml down
214+
215+
# Remove volumes (clears config)
216+
docker compose -f docker-compose.simple.yml down -v
217+
218+
# Clean start
219+
docker compose -f docker-compose.simple.yml up -d
220+
```
221+
222+
## Production Deployment
223+
224+
For production use:
225+
1. Use `docker-compose.yml` (not simple version)
226+
2. Configure external `reflector` network
227+
3. Set proper environment variables in `.env`
228+
4. Use real SSL certificates (not mkcert)
229+
5. Configure `REFLECTOR_WEBHOOK_URL` for database integration
230+
231+
## Security Notes
232+
233+
- Local setup uses self-signed certificates (mkcert)
234+
- No authentication enabled (ENABLE_AUTH=0)
235+
- Recording files are stored locally in `./recordings/`
236+
- Event collector has no authentication
237+
- Redis has no password protection
238+
239+
**For production, enable proper authentication and security measures.**

0 commit comments

Comments
 (0)