3

I'm getting the following error when trying to deploy to fly.io

I get this error both on updating an existing rails app and when trying to deploy a new one.

 => ERROR [base 5/5] RUN gem update --system --no-document &&   gem install -N bundler -v 2.2.33                                                                                                          60.9s
------
 > [base 5/5] RUN gem update --system --no-document &&   gem install -N bundler -v 2.2.33:
#10 60.85 ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
#10 60.85     Net::OpenTimeout: execution expired (https://rubygems.org/specs.4.8.gz)
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -o pipefail -c gem update --system --no-document &&   gem install -N bundler -v ${BUNDLER_VERSION}]: exit code: 1

Apparently this is an issue relating to bundler trying to connect to rubygems via IPv6 and not resolving and then timing out before trying IPv4.

I've seen various workarounds for this on local machines, but I'm not sure how to solve this in fly.io / docker environment.

Ive posted on their forums too but without much response.

Any help is appreciated.

UPDATE: Upon further investigation, it seems that fly.io uses a remote app they host on your account to do the build before it gets deployed. It seems that the problem is that builder not being able to access rubygems.org.

Brad
  • 8,044
  • 10
  • 39
  • 50

1 Answers1

0

I think you are suffering from the known problems with api.rubygems.org. There is actually already answer on SO as I have searched it in the past.

The current best solution, that worked for me, is to have a IPv4 fallback in rubygems enabled. You need to have at least rubygems 3.2.11 for this configuration to work.

You have to edit your ~/.gemrc file and add a line for ipv4 fallback:

:ipv4_fallback_enabled: true

Here is the link to the original SO question & answers.

tukan
  • 17,050
  • 1
  • 20
  • 48
  • Thank you for the response, I'm familiar with the issue and the solution, my question is more specifically how do I implement this fix in fly.io via dockerfiles. The issue seems to have resolved itself now. – Brad Feb 28 '23 at 08:40
  • @Brad I see. I think it would be nice for future reference to know what was the issue. Did you hae the IPv4 fallback in place when the fly.io did not work? – tukan Feb 28 '23 at 09:12
  • 1
    From reading of various sources, it seems the ip6 issue stems from the isp of the server. all I can assume is that whatever was causing the issue for the isp not resolving the ip is no longer an issue. Its very strange and annoying to not know. – Brad Feb 28 '23 at 11:07
  • @Brad I see, probably some misconfiguration. Now I'm torn if I should keep the answer or delete it. You can decide. – tukan Feb 28 '23 at 12:25