Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose server on IPv6 interface #27

Closed
sorenhansendk opened this issue May 11, 2024 · 8 comments · Fixed by #28
Closed

Expose server on IPv6 interface #27

sorenhansendk opened this issue May 11, 2024 · 8 comments · Fixed by #28

Comments

@sorenhansendk
Copy link

First of all, thank you for developing such a useful tool to expose Redis to serverless environments. It's been incredibly helpful!

I am currently trying to deploy the server on Fly.io, which requires services to accept connections on IPv6. I've encountered an issue where the application does not seem to support listening on IPv6 addresses.

Could you please let me know if there is a way to configure the Elixir application to listen on a specific interface using an environment variable? Or if not, are there any plans to add IPv6 support in the near future?

Thank you.

@hiett
Copy link
Owner

hiett commented May 11, 2024

Hi!

I did some googling and it seems that I have to add a line of code to make the http server listen on inet6 rather than 4. So it's not out-of-the-box right now, but it is a very small change required to get it to work.

I have been planning to do some housekeeping and finish some of my PRs on this project this weekend, this is absolutely something I can sneak in.

For reference, it just needs net: :inet6 added next to the port in

{
Plug.Cowboy,
scheme: :http,
plug: Srh.Http.BaseRouter,
options: [
port: @port
]
}
-- that small of a change!

@hiett hiett linked a pull request May 11, 2024 that will close this issue
@hiett
Copy link
Owner

hiett commented May 11, 2024

Have this implemented in that PR, going to update the documentation and then make a release.

@hiett hiett closed this as completed in #28 May 11, 2024
@hiett
Copy link
Owner

hiett commented May 11, 2024

@sorenhansendk this is available via the image hiett/serverless-redis-http:0.0.10-alpha. Simply set env var SRH_IPV6 = true.

I am just doing some more comprehensive testing before I release it as the latest tag, but will be in a couple hours!

@hiett
Copy link
Owner

hiett commented May 11, 2024

this is now released under the latest tag. Let me know if all is good!

@sorenhansendk
Copy link
Author

sorenhansendk commented May 12, 2024

Hi @hiett, thank you for the quick fix regarding the IPv6 listener. It's working great!

Do you know if there should be any issues with connections to IPv6 addresses in the SRH_CONNECTION_STRING?

I'm encountering an error when I try to connect to a Redis (Dragonfly) instance hosted on an IPv6 address:

WARNING: SRH was unable to connect to the Redis server. Please make sure it is running, and the connection information is correct. SRH ID: env_config_connection

I have confirmed that there is a connection to the instance using curl on the same address, and that is working perfectly.

@hiett
Copy link
Owner

hiett commented May 12, 2024

It looks like there also has to be socket options provided to the Redix (redis driver used here) instance to use IPv6, and this is a common thing for people using fly.io: whatyouhide/redix#222

I will see if there is a nice way for me to add support for this. Especially since it's likely behind a local DNS name, it seems a bit counter-intuitive if I have to require manual IPv6 configuration for the SRH server. I will do some thinking. I can likely resolve the IP myself and check if it is IPv6 or not

@sorenhansendk
Copy link
Author

sorenhansendk commented May 13, 2024

Ok, thank you @hiett. Should I create a new issue on this one?

In the Redis library I use in Node.js I need to provide the connection string like this, if I connect on IPv6:

redis://{username}:{password}@[hostname]:6379

And if I would like to connect to a instance on IPv4, I remove the brackets like this:

redis://{username}:{password}@hostname:6379

@hiett
Copy link
Owner

hiett commented May 13, 2024

Yeah - let's open a new issue to drill down and fix this up, I'll let you create that one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants