Skip to content

Amm-ar/LiveKit-render

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

LiveKit Server on Render

This repository contains a Docker-based setup for deploying LiveKit Server on Render. LiveKit is an open-source WebRTC server for real-time audio, video, and data communication.

Files Overview

  • Dockerfile: Defines the Docker image for LiveKit Server using the official livekit/livekit-server:latest image.
  • livekit.yaml: Configuration file for LiveKit Server, using environment variables for sensitive data.
  • render.yaml: Render blueprint file defining the deployment configuration, environment variables, and ports.

Prerequisites

  • A Render account
  • API keys from LiveKit (get them from LiveKit Cloud or generate your own)
  • A Redis instance (Render provides managed Redis)
  • A TURN/STUN server (you can deploy coturn on Render or use a managed provider)

Deployment Steps

  1. Clone or fork this repository to your GitHub account.

  2. Update render.yaml:

    • Replace placeholder values with your actual credentials:
      • LIVEKIT_API_KEY: Your LiveKit API key
      • LIVEKIT_API_SECRET: Your LiveKit API secret
      • LIVEKIT_REDIS_ADDRESS: Redis connection URL (e.g., redis://your-redis-instance:6379)
      • LIVEKIT_REDIS_PASSWORD: Redis password
      • LIVEKIT_TURN_HOST: TURN server hostname
      • LIVEKIT_TURN_PORT: TURN server port (default: 3478)
      • LIVEKIT_TURN_USERNAME: TURN username
      • LIVEKIT_TURN_PASSWORD: TURN password
  3. Set up Redis on Render:

    • Create a new Redis service in your Render dashboard.
    • Note the connection URL and password.
  4. Set up TURN/STUN:

    • Deploy a TURN server (e.g., coturn) as a separate Render service, or use a managed provider like Twilio TURN.
    • Configure the credentials in render.yaml.
  5. Deploy on Render:

    • Connect your GitHub repository to Render.
    • Render will automatically build and deploy using the render.yaml blueprint.
    • The service will be available at the generated URL (e.g., https://livekit-server.onrender.com).

Usage

Once deployed, your LiveKit Server will be running on port 7880 (signaling) and 5349 (TURN).

Connecting from a Client

Use the LiveKit SDKs to connect to your server:

import { Room } from 'livekit-client';

const room = new Room();
await room.connect('wss://your-render-url.onrender.com', token);

Generate tokens using your API key and secret. See the LiveKit documentation for details.

API Endpoints

  • Signaling: wss://your-render-url.onrender.com
  • TURN: Configured via environment variables

Configuration

The livekit.yaml file uses environment variables for configuration. Key settings include:

  • API keys for authentication
  • Redis for clustering and state management
  • TURN/STUN for NAT traversal
  • Room limits and timeouts
  • WebRTC ICE servers

Refer to the LiveKit Server Configuration for all options.

Scaling

Render automatically scales your service based on the plan. For high concurrency:

  • Use a higher Render plan
  • Ensure Redis is properly configured for clustering
  • Monitor TURN server capacity

Troubleshooting

  • Check Render logs for deployment issues
  • Verify environment variables are set correctly
  • Ensure Redis and TURN services are accessible
  • Test connectivity using LiveKit's health check endpoint

Security

  • Never commit actual API keys or secrets to the repository
  • Use Render's environment variable management for sensitive data
  • Enable TLS (Render provides free SSL certificates)
  • Regularly rotate API keys and TURN credentials

Contributing

Feel free to submit issues or pull requests to improve this setup.

License

This setup uses the LiveKit Server, which is open-source. Check LiveKit's licensing for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors