dcrck

dcrck

Deploying Phoenix to a IPv6-only VPS: :enetunreach on external API requests

Hello,

I’m working on a Phoenix app that I want to deploy to an Alpine Linux VPS that only supports IPv6. I’ve had to muddle through the setup procedure (which I’ll document at some point) but I’ve seemingly hit a roadblock near the end: I can’t seem to make external API requests without running into an :enetureach error from Req. Outside of the app, I can ping the URLs and receive a response, but the app can’t seem to find them.

I’ve followed this guide to set up networking, DNS, fail2ban, ip6tables, NAT64, and nginx with IPv6-only and CloudFlare. I’ve modified the nginx config to create a proxy to localhost:4000 and get websockets working. I have set up all the environment variables specified in the configuration, as well as the API keys I need for the calls. The web pages just fine, and the on-device database works, but I can’t call external APIs. I have basically no experience with networking so I figured this would be a good challenge for me to learn more about it, but I’m a bit stuck here. I have tried turning disabling individual services (ip6tables, eliminating some of the rules in my nginx config), but I’ve had no luck so far. I get that it’s a networking issue, but there appear to be a lot of moving parts around that. Does anyone have any ideas on how to fix this? Let me know if any additional config files, scripts, etc. would be helpful to help find the problem.

Thanks!

Marked As Solved

Hermanverschooten

Hermanverschooten

I think you need to tell Req to use :inet6, see the documentation at Req — req v0.6.2 and scroll down to Finch options.

Also Liked

LostKobrakai

LostKobrakai

I‘d suggest turning the dependency around. Instead of your code depending on knowing the env the code should expose a configuration like config :myapp, request_using_ipv6: …, which you happen to set to true in your config depending on the env. That way those settings become more flexible to be controlled without affecting the codebase itself.

Last Post!

dcrck

dcrck

That makes a lot of sense, yeah. Probably easier to just set a bunch of flags in config/config.exs and switch them in different environments as necessary.

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New

We're in Beta

About us Mission Statement