JustDesk Deployment Guide

Prerequisites

Quick Deployment

1. Clone Repository

git clone https://github.com/kadirertancam/JustDesk.git
cd JustDesk
    

2. Configure Environment

cp .env.example .env
nano .env
    

Değiştirilecek önemli değişkenler:

3. Run Setup Script

chmod +x scripts/setup.sh
./scripts/setup.sh
    

Bu script:

Manual Deployment

1. Install Dependencies

sudo apt update
sudo apt install -y docker.io docker-compose nginx certbot python3-certbot-nginx
    

2. Configure SSL

sudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
    

3. Build and Start Services

docker-compose build
docker-compose up -d
    

4. Configure Nginx

sudo cp nginx/conf.d/default.conf /etc/nginx/sites-available/justdesk
sudo ln -s /etc/nginx/sites-available/justdesk /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
    

Production Considerations

Security

Performance

Backup

Monitoring

Environment Variables

Variable Description Example
NODE_ENV Çalışma modu production
DOMAIN Domain adı justdesk.io
REDIS_PASSWORD Redis şifresi strong-password
TURN_SECRET TURN sunucu gizli anahtarı random-secret
SSL_EMAIL SSL için e-posta admin@justdesk.io

Troubleshooting

Connection Issues

Performance Issues

SSL Issues

Scaling

Single Server

Multi-Server Setup

Cloud Deployment

AWS

# Use provided CloudFormation template
aws cloudformation create-stack \
  --stack-name justdesk \
  --template-body file://aws-cf-template.yaml
    

Docker Swarm

docker swarm init
docker stack deploy -c docker-compose.yml justdesk
    

Kubernetes

kubectl apply -f k8s/
    

Maintenance

Updates

cd /opt/justdesk
git pull
docker-compose down
docker-compose up -d --build
    

Logs

# View all logs
docker-compose logs -f

# Specific service
docker-compose logs -f backend
    

Backup

./scripts/backup.sh
    

SSL Renewal

certbot renew
docker-compose restart nginx
    

JustDesk API Documentation

Overview

JustDesk, gerçek zamanlı iletişim için WebSocket bağlantıları kullanır. Bu doküman, mevcut event’ler ve veri formatlarını açıklar.

WebSocket Connection

Connection URL

wss://justdesk.io/socket.io/

Connection Example

const socket = io('wss://justdesk.io', {
  transports: ['websocket']
});
    

Events

Client → Server Events

create-room

Yeni ekran paylaşım odası oluşturur.

socket.emit('create-room', (response) => {
  console.log(response);
  // { success: true, roomId: '123456789', password: 'ABC123' }
});
    

join-room

Var olan odaya izleyici olarak katılır.

socket.emit('join-room', {
  roomId: '123456789',
  password: 'ABC123'
}, (response) => {
  console.log(response);
  // { success: true, hostId: 'socket-id' }
});
    

offer

WebRTC bağlantısı için offer (teklif) gönderir.

socket.emit('offer', {
  offer: { type: 'offer', sdp: '...' },
  to: 'target-socket-id'
});
    

answer

Offer'a cevap olarak WebRTC answer (cevap) gönderir.

socket.emit('answer', {
  answer: { type: 'answer', sdp: '...' },
  to: 'target-socket-id'
});
    

ice-candidate

Bağlantı kurulumu için ICE candidate bilgilerini paylaşır.

socket.emit('ice-candidate', {
  candidate: {
    candidate: '...',
    sdpMLineIndex: 0,
    sdpMid: '0'
  },
  to: 'target-socket-id'
});
    

Server → Client Events

viewer-joined

Bir izleyici odaya katıldığında host’a bildirim gönderir.

socket.on('viewer-joined', ({ viewerId, roomId }) => {
  console.log(`Viewer ${viewerId} joined room ${roomId}`);
});
    

viewer-left

Bir izleyici odadan ayrıldığında host’a bildirim gönderir.

socket.on('viewer-left', ({ viewerId }) => {
  console.log(`Viewer ${viewerId} left`);
});
    

host-disconnected

Host bağlantısı kesildiğinde izleyicilere bildirim gönderir.

socket.on('host-disconnected', () => {
  console.log('Host has disconnected');
});
    

offer

Peer’den WebRTC offer alır.

socket.on('offer', ({ offer, from }) => {
  // Handle incoming offer
});
    

answer

Peer’den WebRTC answer alır.

socket.on('answer', ({ answer, from }) => {
  // Handle incoming answer
});
    

ice-candidate

Peer’den ICE candidate alır.

socket.on('ice-candidate', ({ candidate, from }) => {
  // Handle incoming ICE candidate
});
    

REST API Endpoints

Health Check

GET /api/health

Yanıt:

{
  "status": "ok",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "uptime": 12345
}
    

Room Info (Debug Only)

GET /api/room/:roomId

Yanıt:

{
  "roomId": "123456789",
  "created": 1704067200000,
  "participantCount": 2
}
    

Error Codes

Code Description
ROOM_NOT_FOUND Belirtilen oda mevcut değil
INVALID_PASSWORD Yanlış oda şifresi
ROOM_FULL Oda maksimum kapasiteye ulaştı
CONNECTION_FAILED WebRTC bağlantısı başarısız oldu
RATE_LIMIT_EXCEEDED Çok fazla istek gönderildi

Rate Limits

WebRTC Configuration

ICE Servers

{
  iceServers: [
    { urls: 'stun:stun.justdesk.io:3478' },
    {
      urls: 'turn:turn.justdesk.io:3478',
      username: 'provided-username',
      credential: 'provided-password'
    }
  ]
}
    

Media Constraints

{
  video: {
    width: { ideal: 1920 },
    height: { ideal: 1080 },
    frameRate: { ideal: 30 }
  },
  audio: true
}