dcrck

dcrck

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!

Showing Posts 1 to 5

dcrck

dcrck OP

Additional info: I can make the same API requests with curl without any issues. So I don’t think it’s a problem with any firewall or networking, since I can still access the data from maybe it’s just a problem with the nginx configuration? Or something with the elixir app config?

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.

dcrck

dcrck OP

Yeah, that seems to be what it is.

For future reference: I store compile_env() in my application’s configuration, i.e. config :my_app, env: compile_env(). Then, when I’m forming a new request using Req, I do:

env = Application.fetch_env!(:my_app, :env)
Req.new(
  # ...other options
  inet6: env == :prod
)

I was able to get one of my API connections working; the other (Backblaze B2) does not support IPv6 yet, but they will in September, so I’ll find a workaround until then.

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.

dcrck

dcrck OP

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.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

oliverandrich
I have released the first version of Ithibati, a passkey-authentication library for Elixir. It came out of my own blog engine, where the ...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews