Closed Jdyn closed 2 months ago
Hi,
Thanks for the contribution! I'm not sure it's the best place to change it, though, seeing as the function is called read_ip
and is intended to work with IP addresses only. We have a function resolve_hostname/1
in config_reader
which could be better suited here.
That being said, the change you're proposing would still require adjusting the name of the env variable (suffix _HOST
or _ADDRESS
instead of _IP
).
Do you know if this fly-global-services
hostname has to be used as-is somewhere in the deployed app? If not, you could try resolving this hostname before starting JF -- this wouldn't necessitate any changes in the code.
Btw, we've tried deploying to Fly.io in the past, and it wasn't exactly smooth sailing. Have a look at this docs page: did you encounter similar issues?
Ah I see the current naming would indeed be a huge problem if host names were accepted now.
I actually followed the fly deployment docs page exactly and fly has been working very well. UDP packets flow right away and there are no issues for me so far.
Of course the tutorial no longer exactly works because it suggests doing
[env]
...
JF_WEBRTC_TURN_LISTEN_IP = "fly-global-services"
Which cannot work due to this line
# config_reader.ex:107
...
turn_listen_ip: read_ip("JF_WEBRTC_TURN_LISTEN_IP") || {127, 0, 0, 1}
...
I also had to add
[env]
...
JF_WEBRTC_TURN_TCP_PORT = 50000
Also I am not sure if the current form of resolve_hostname
will work because it uses nota
to convert it to a string, but in this case we still want the tuple form I believe.
In any case feel free to close this and implement it as you see best. My hope is for Jellyfish to accept both IP and hostnames for the turn configurations. Since this is coming straight from the fly.toml
I am not sure how I would resolve the hostname before starting without making custom changes to JF or doing it manually.
getaddr
works on IPs and hostnames so it seemed suitable.
Glad to hear the Fly.io deployment works as intended now.
In the end, we decided to allow passing hostname in this env var :) hope this solves your issue.
I didn't realise the docs already said to set this env var to "fly-global-services", my bad. I'll take a look at that page, but if you spot anything else which doesn't quite work (or feel like there's room for improvement), feel free to make a PR to the docs as well. Contributions are always welcome, especially so since you've had hands-on experience with the deployment recently :)
Closing in favor of #188
Acknowledging the stipulations set forth:
I was looking to try a deploy on fly which requires setting:
The problem is that
config_reader
runsJF_WEBRTC_TURN_LISTEN_IP
through:inet.parse_address
andfly-global-services
is not an ip, just a hostname.One interesting note is that if I ignore the parsing altogether, without using
parse_address
orgetaddr
it then fails at themembrane_ice_plugin
level. I don't have the logs for that anymore, but the plugin raises with somebadarg
value when passing in a hostname as the turn_ip.With this change, we convert the hostname to it's underlying ip and
jellyfish
andmembrane_ice_plugin
works again. My understanding is thatgetaddr
works equally withip
s andhostnames
but more testing could be done.