shy-raincoat-67106
02/24/2025, 5:31 AMgray-monkey-83525
02/24/2025, 5:31 AMshy-raincoat-67106
02/24/2025, 5:35 AMgray-monkey-83525
02/24/2025, 5:35 AMshy-raincoat-67106
02/24/2025, 5:37 AMgray-monkey-83525
02/24/2025, 5:37 AMcache.t3.micro
for development or cache.m5.large
for production).
- Number of Nodes: Typically, one node is sufficient for small setups, but you can increase this for redundancy.
- Subnet Group: Ensure the Redis cluster is in the same VPC as your LiveKit servers.
- Security Group: Configure inbound rules to allow access from your LiveKit server instances.
2. Configure Redis:
- Ensure Redis is set up to use the same database across all LiveKit instances.
- Use the Redis endpoint provided by ElastiCache in your LiveKit configuration.
Load Balancer Setup on AWS
1. Choose Load Balancer Type:
- Network Load Balancer (NLB): Ideal for handling TCP/UDP traffic, which is crucial for WebRTC and TURN server connections.
- Application Load Balancer (ALB): Suitable for HTTP/HTTPS traffic, but less ideal for WebRTC.
2. Create a Load Balancer:
- Navigate to the EC2 dashboard and select "Load Balancers."
- Choose "Create Load Balancer" and select "Network Load Balancer."
- Configure the load balancer settings:
- Listeners: Add listeners for TCP/UDP ports used by LiveKit (e.g., 7880 for WebSocket, 5349 for TURN/TLS).
- Availability Zones: Select the same zones where your LiveKit instances are deployed.
3. Target Groups:
- Create target groups for your LiveKit instances.
- Register your LiveKit server instances with the target groups.
- Ensure health checks are configured to monitor the health of your LiveKit instances.
4. DNS Configuration:
- Update your DNS records to point the LiveKit and TURN URLs to the load balancer's DNS name.
This setup ensures that your LiveKit deployment is scalable and resilient, with Redis providing a shared message bus and the load balancer distributing traffic efficiently across your server instances.
Sources:
- Distributed Setup | LiveKit Docs 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.shy-raincoat-67106
02/24/2025, 5:38 AMgray-monkey-83525
02/24/2025, 5:38 AMshy-raincoat-67106
02/24/2025, 6:07 AMgray-monkey-83525
02/24/2025, 6:07 AMshy-raincoat-67106
02/24/2025, 6:11 AMgray-monkey-83525
02/24/2025, 6:11 AMrtc.udp_port
in your LiveKit configuration. This way, you only need to open one UDP port on the NLB.
2. Multiple Listeners:
- If you must use a range, you would need to create individual listeners for each port, which is not practical for a large range like 50000-60000.
3. Custom Solution:
- Consider using a custom solution such as a proxy or a custom application that can handle a range of ports and forward them to the appropriate backend services.
Would you like more details on configuring a single UDP port for LiveKit?
Sources:
- https://docs.livekit.io/oss/deployment#Configuration
- https://docs.livekit.io/home/self-hosting/vm/#Troubleshooting 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.shy-raincoat-67106
02/24/2025, 6:17 AMrtc.udp_port
in your LiveKit configuration. This way, you only need to open one UDP port on the NLB.
How to do?gray-monkey-83525
02/24/2025, 6:17 AMrtc.udp_port
parameter in your LiveKit configuration file. This will allow you to specify a single port for all UDP traffic, simplifying your network setup.
Steps to Configure a Single UDP Port:
1. Edit the LiveKit Configuration File:
- Locate your LiveKit configuration file, typically named livekit.yaml
.
2. Set the rtc.udp_port
Parameter:
- Add or modify the rtc.udp_port
setting under the rtc_config
section to specify the single UDP port you want to use. For example:
rtc:
udp_port: 50000 # Specify the single UDP port here
3. Update Network Load Balancer:
- In your AWS Network Load Balancer, create a listener for the specified UDP port (e.g., 50000) to forward traffic to your LiveKit instances.
4. Restart LiveKit Server:
- After making changes to the configuration file, restart your LiveKit server to apply the new settings.
This setup will direct all WebRTC UDP traffic through the specified port, making it easier to manage firewall and load balancer configurations.
Would you like more detailed guidance on any of these steps?
Sources:
- https://docs.livekit.io/home/self-hosting/ports-firewall/ 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.shy-raincoat-67106
02/24/2025, 6:27 AMgray-monkey-83525
02/24/2025, 6:27 AMrtc
section of your livekit.yaml
file by adding the udp_port
parameter. Here's how you can update your configuration:
Updated livekit.yaml
Configuration:
rtc:
tcp_port: 7881
udp_port: 50000 # Specify the single UDP port here
use_external_ip: true
enable_loopback_candidate: false
Steps:
1. Add udp_port
: Insert the udp_port
parameter and set it to the desired port number (e.g., 50000). This will direct all UDP traffic through this single port.
2. Remove port_range_start
and port_range_end
: Since you are using a single UDP port, you can remove the port_range_start
and port_range_end
parameters.
3. Restart LiveKit Server: After updating the configuration file, restart your LiveKit server to apply the changes.
This change will simplify your network setup by using a single UDP port for WebRTC traffic, making it easier to configure your load balancer and firewall.
Would you like more information on any specific part of this process?
Sources:
- https://docs.livekit.io/home/self-hosting/ports-firewall/ 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.shy-raincoat-67106
02/24/2025, 6:31 AMgray-monkey-83525
02/24/2025, 6:31 AM127.0.0.1:6379
because the address is already in use. This typically means that another process is already using port 6379 on your system.
Steps to Resolve:
1. Check for Existing Redis Process:
- Use a command like lsof -i :6379
or netstat -tuln | grep 6379
to check if another process is using port 6379.
- If another Redis instance or process is using the port, you may need to stop it or configure your current Redis instance to use a different port.
2. Change Redis Port:
- If you want to run multiple Redis instances, you can change the port for the new instance. Edit the Redis configuration file (usually redis.conf
) and set a different port using the port
directive, e.g., port 6380
.
3. Restart Docker Compose:
- After making changes, restart your Docker Compose setup with docker-compose down
followed by docker-compose up
to apply the changes.
4. Check Docker Configuration:
- Ensure that your Docker Compose file does not have conflicting port mappings for Redis.
Would you like more detailed guidance on any of these steps?
Sources:
- https://livekit-users.slack.com/archives/C07FVFL1H3P/p1726754234.331919
- https://docs.livekit.io/home/self-hosting/egress/#Running-locally 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.shy-raincoat-67106
02/24/2025, 9:39 AMgray-monkey-83525
02/24/2025, 9:39 AMvm.overcommit_memory = 1
to your /etc/sysctl.conf
file and then running sysctl -p
to apply the changes. Alternatively, execute sysctl vm.overcommit_memory=1
to apply the change immediately.
2. External IP Validation:
- The logs indicate a failure in validating the external IP with the error "context canceled." This might be due to network configuration issues or firewall settings that prevent proper IP validation. Ensure that your network settings allow for external IP discovery and that any firewalls or security groups are configured to permit necessary traffic.
3. Caddy and LiveKit Configuration:
- The Caddy server seems to be running without issues, as indicated by the logs. However, ensure that your Caddy configuration (/etc/caddy.yaml
) is correctly set up to handle the domain and SSL/TLS settings for your LiveKit deployment.
4. LiveKit and TURN Server:
- The LiveKit server is starting with the specified TURN server settings. Ensure that the ports (5349 for TLS and 3478 for UDP) are open and accessible in your firewall and security group settings.
5. Redis Connection:
- The LiveKit server is attempting to connect to Redis at localhost:6379
. Ensure that Redis is running and accessible at this address. If Redis is running in a Docker container, ensure that the network settings allow for communication between the LiveKit and Redis containers.
Next Steps:
- Check Network and Firewall Settings: Ensure that all necessary ports are open and that there are no firewall rules blocking traffic.
- Verify Docker Network Configuration: If using Docker, ensure that the containers are on the same network and can communicate with each other.
- Review Logs for Additional Errors: Check the logs for any additional errors or warnings that might provide more context on the issues.
Would you like more detailed guidance on any specific part of this setup?
Sources:
- https://livekit-users.slack.com/archives/C07FRP66XGE/p1732019649.386179
- https://livekit-users.slack.com/archives/C07FVFL1H3P/p1731978837.234169 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.shy-raincoat-67106
02/24/2025, 9:41 AMgray-monkey-83525
02/24/2025, 9:41 AMshy-raincoat-67106
02/24/2025, 9:43 AMgray-monkey-83525
02/24/2025, 9:43 AM