✨(devex) add LIVEKIT_INTERNAL_URL for server-to-server communication#1172
Closed
✨(devex) add LIVEKIT_INTERNAL_URL for server-to-server communication#1172
Conversation
Introduced a LIVEKIT_INTERNAL_URL environment variable for container-to-container LiveKit communication, using http://livekit:7880 in development. LIVEKIT_API_URL continues to serve browser-facing requests, and create_livekit_client() prefers the internal URL when set, preserving backwards compatibility.
15ec1e6 to
0999f2e
Compare
|
| # Internal URL for server-to-server LiveKit API calls (e.g. container-to-container). | ||
| # Defaults to LIVEKIT_API_URL when not set. | ||
| LIVEKIT_INTERNAL_URL = values.Value( | ||
| "", environ_name="LIVEKIT_INTERNAL_URL", environ_prefix=None |
Collaborator
There was a problem hiding this comment.
default shoud be None, not ""
Comment on lines
+215
to
+219
| configuration = { | ||
| **(custom_configuration or settings.LIVEKIT_CONFIGURATION), | ||
| "url": settings.LIVEKIT_INTERNAL_URL | ||
| or (custom_configuration or settings.LIVEKIT_CONFIGURATION)["url"], | ||
| } |
Collaborator
There was a problem hiding this comment.
It’s a bit hard to follow, something like this might be clearer with an explicit comment:
Suggested change
| configuration = { | |
| **(custom_configuration or settings.LIVEKIT_CONFIGURATION), | |
| "url": settings.LIVEKIT_INTERNAL_URL | |
| or (custom_configuration or settings.LIVEKIT_CONFIGURATION)["url"], | |
| } | |
| configuration = custom_configuration or settings.LIVEKIT_CONFIGURATION | |
| # ... clear commment it's necessary for the docker compose stack | |
| if settings.LIVEKIT_INTERNAL_URL is not None: | |
| configuration["url"] = settings.LIVEKIT_INTERNAL_URL | |
Collaborator
Author
|
The problem was a firewall issue on my local machine... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



NB: this requires extra attention, as the following is proposed by AI, and I don't have full understanding of the implications !
Problem
Docker Compose's extra_hosts: host-gateway maps 127.0.0.1.nip.io to 172.17.0.1 (the docker0 bridge). This worked with Docker Compose plugin 5.0.2, but after an upgrade to 5.1.0, the DOCKER-FORWARD chain now isolates bridge networks by default — traffic from the compose network (172.18.0.0/16) to the docker0 bridge (172.17.0.1) is dropped.
This broke all server-side LiveKit API calls (telephony SIP dispatch, recording egress) because the backend container used LIVEKIT_API_URL (http://127.0.0.1.nip.io:7880) for both:
Fix
Added LIVEKIT_INTERNAL_URL setting for server-to-server LiveKit communication. In development, this is set to http://livekit:7880 (Docker DNS), while LIVEKIT_API_URL remains http://127.0.0.1.nip.io:7880 for the browser. create_livekit_client() uses the internal URL when set, falling back to LIVEKIT_API_URL for backwards compatibility.
Original error