scaling recommendation for egress. right now i hav...
# ask-ai
p
scaling recommendation for egress. right now i have 1 instance of egress runinng on docker compose.
t
Thanks for reaching out, Bryner. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
When you're looking to scale your Egress service smoothly using Docker Compose, here are some friendly tips to keep in mind: • Resource Allocation: It’s a good idea to set aside at least 4 CPUs and 4 GB of memory for each Egress instance, especially since tasks like video transcoding can be pretty demanding. • Docker Configuration: Don’t forget to use the
--cap-add=SYS_ADMIN
flag for Chrome sandboxing, and make sure to mount volumes for your configuration and output data. • Horizontal Scaling: Running multiple Egress instances behind a load balancer helps spread the workload evenly, keeping things running smoothly. • Monitoring and Autoscaling: Keep an eye on your instances with Prometheus metrics like
livekit_egress_available
. If you’re using Kubernetes, autoscaling can be a real lifesaver. • Storage Configuration: Setting up cloud storage—whether it’s AWS S3, Azure Blob, or GCP—makes handling file uploads much easier. Here’s a handy example command to get an Egress instance up and running:
Copy code
docker run --rm \
--cap-add SYS_ADMIN \
-e EGRESS_CONFIG_FILE=/out/config.yaml \
-v ~/livekit-egress:/out \
livekit/egress
Also, keep an eye on CPU usage to make sure it stays under 80% per instance. Doing some load testing can really help you get a feel for how scaling works under different conditions. If you have any questions or want to chat more about this, just let me know—I’m here to help!
p
egress:
image: livekit/egress:latest
restart: unless-stopped
environment:
- EGRESS_CONFIG_FILE=/etc/egress.yaml
network_mode: "host"
volumes:
- ./egress.yaml:/etc/egress.yaml
cap_add:
- CAP_SYS_ADMIN
this is the egress part in my docker-compose. but i dont want to change the docker compose file. can i just run seperate docker and will it work
t
Hey there! You can totally run a separate Docker container for Egress without touching your existing Docker Compose file. Here’s a simple way to do it: 1. Run the Egress Container: Just run this command to start a new Egress container:
Copy code
docker run --rm \
-e EGRESS_CONFIG_FILE=/out/config.yaml \
-v ~/egress-test:/out \
livekit/egress
2. Prepare the Configuration File: Create a
config.yaml
file inside the mounted directory (like
~/egress-test/config.yaml
) with your details:
Copy code
api_key: your-api-key
api_secret: your-api-secret
ws_url: <ws://your-livekit-server:7880>
redis:
  address: your-redis-server:6379
  username: your-redis-username
  password: your-redis-password
  db: 0
Just swap out the placeholders with your real credentials and server info. 3. Optional: Enable Chrome Sandbox: If you want, you can add the security profile for Chrome sandboxing like this: `--security-opt seccomp=chrome-sandboxing-seccomp-profile.json`You can grab the profile from the Egress repository. 4. Ensure Redis Connectivity: Make sure Redis is reachable from the new container. If needed, tweak your Redis settings. This way, you can run Egress on its own without changing your Docker Compose file at all. If you hit any bumps or want a hand with anything else, just let me know—I’m here to help!