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

Pact Broker does not bind to [::], only 0.0.0.0 #163

Open
3 of 4 tasks
rmartine-ias opened this issue Jan 31, 2024 · 6 comments · Fixed by #170
Open
3 of 4 tasks

Pact Broker does not bind to [::], only 0.0.0.0 #163

rmartine-ias opened this issue Jan 31, 2024 · 6 comments · Fixed by #170

Comments

@rmartine-ias
Copy link

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Confirmed this is the right place to raise the issue - only issues related to the Dockerization of the Pact Broker should be raised here. Issues related to the Pact Broker application itself should be raised in the Pact Broker project.
  • Upgraded to the latest Pact Broker Docker image OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Software versions

  • pact-broker docker version: 2.111.0-pactbroker2.107.1
  • OS: Any

Expected behaviour

Pact broker binds to ipv6 "any" address.

Actual behaviour

The containerized pact broker is not reachable in an ipv6-only environment.

Steps to reproduce

docker-compose -f docker-compose.yml up pact-broker # using example conf in this repo's root
curl [::1]:9292 # fails
curl 127.0.0.1:9292 # succeeds

Context

See also: https://pact-foundation.slack.com/archives/C9VPNUJR2/p1706574031623059

We're moving to ipv6-only kubernetes clusters.
We're using https://github.com/pact-foundation/pact-broker-docker via the https://github.com/pact-foundation/pact-broker-chart.
The container was failing to be reachable, because puma was only binding to the ipv4 port. We saw this by kubectl execing in and running netstat -nl:

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:9292            0.0.0.0:*               LISTEN

This is resolved by modifying entrypoint.sh to read bundle exec puma --bind 'tcp://[::]:9292' (note: --bind 'tcp://[::]' --port 9292 does NOT work.)
Then we get:

tcp        0      0 :::9292                 :::*                    LISTEN

and everything works.
Ideally, I think puma should bind to both the ipv4 and ipv6 "any" addresses.

@bethesque
Copy link
Member

Thanks for the report. If you would like to submit the PR to fix this, I will approve it.

@bethesque
Copy link
Member

The port is variable, btw, so the bind will need to go in https://github.com/pact-foundation/pact-broker-docker/blob/master/pact_broker/config/puma.rb and not be hardcoded to 9292

@bethesque
Copy link
Member

bethesque commented Feb 9, 2024

Docs for bind https://www.rubydoc.info/gems/puma/Puma%2FDSL:bind which will replace the port https://www.rubydoc.info/gems/puma/Puma/DSL#port-instance_method in the config file

@bethesque bethesque linked a pull request Feb 22, 2024 that will close this issue
@bethesque
Copy link
Member

The most recent release should support IPv6 any. Please try it out and let me know.

@YOU54F
Copy link
Member

YOU54F commented Mar 4, 2024

Release should be out shortly, we had a couple of issues holding it back but they've been resolved now (failing audit and gem update)

@YOU54F
Copy link
Member

YOU54F commented Mar 5, 2024

Going to reopen this, #170 introduced some test failures which we need to investigate further. I've pulled #170 from master for now

@YOU54F YOU54F reopened this Mar 5, 2024
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.

3 participants