in self hosted livkit server do we redis.conf to b...
# ask-ai
b
in self hosted livkit server do we redis.conf to be persitence and what is the reason for that ?
t
Thanks for reaching out, Nitish. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to understand a bit more about how you're planning to use Redis persistence with your self-hosted LiveKit server. Are you hoping to make sure your data is safe and can be recovered after a restart, or is there a particular feature you're trying to support? Feel free to share, and I'll do my best to help!
b
We have hosted our own livkit server, the sip trunks are create dthere but when our livkit server restart's we get the that trunk does nto exists when we initate our call
t
To make sure your SIP trunks stick around even after a server restart on your self-hosted LiveKit server, it’s important to set up Redis with persistence. By default, Redis keeps everything in memory, so it forgets all data when it restarts unless you enable persistence. Here’s a friendly guide to help you configure Redis for persistence: 1. Enable Redis Persistence: Start by creating a custom
redis.conf
file with these settings: `save 900 1 save 300 10 save 60 10000 appendonly yes appendfilename "appendonly.aof" dir /data`This setup enables both periodic snapshots (RDB) and write-ahead logging (AOF), giving you durable storage. 2. Update Docker Configuration: Next, update your
docker-compose.yaml
to include the config and data mounts:
Copy code
redis:
  image: redis
  volumes:
    - ./redis.conf:/usr/local/etc/redis/redis.conf
    - redis_data:/data
  command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
  ports:
    - 6379:6379
3. Verify Persistence: After restarting Redis and LiveKit-SIP services, you can check that your SIP trunks are still there by: ◦ Using the LiveKit CLI to list SIP trunks:
livekit-cli list-sip-trunks
◦ Looking directly at Redis keys:
HGETALL sip_trunk
◦ Checking for persistence files like
dump.rdb
and
appendonly.aof
inside the
/data
directory. If Redis persistence isn’t set up properly, SIP trunks and dispatch rules won’t survive a restart. Please don’t hesitate to reach out if you’d like a hand with this setup or have any other questions—I’m here to help! Sources: pkg/service/redisstore_sip_test.go | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik... | Self-hosting the Egress Service | LiveKit Docs | README.md
b
can you give the redis.conf full configuration structure and also of nay other file if needed ?
t
Thanks for reaching out! While the full configuration structure for
redis.conf
tailored to LiveKit's persistence needs isn't fully detailed in the documentation, I’m happy to guide you through the general setup to get you started: 1. Redis Configuration: For persistence, you can use these settings in your `redis.conf`: `save 900 1 save 300 10 save 60 10000 appendonly yes appendfilename "appendonly.aof" dir /data`Also, if you’re working in a development or local environment, make sure to: ◦ Comment out
bind 127.0.0.1
so external connections are allowed. ◦ Set
protected-mode no
to enable non-local clients. 1. Other Required Files: To complete your setup, you might also need:These files usually get generated as part of LiveKit’s VM deployment tool. ◦
livekit.yaml
- This is the main configuration file for LiveKit. ◦
docker-compose.yaml
- Useful for containerized deployments. ◦
caddy.yaml
- For setting up the reverse proxy. One important tip: to keep everything running smoothly, make sure all services like SIP and Egress are pointing to the same Redis instance. If you have any questions or need help with a specific part of the configuration, just let me know—I’m here to help! Sources: pkg/service/wire.go | README.md | pkg/config/config.go | Self-hosting the Egress Service | LiveKit Docs | Deploy to a VM | LiveKit Docs