Francisco Barril
01/10/2024, 11:55 AMpact-broker publish ./pacts --consumer-app-version="1.0.0" --auto-detect-version-properties --broker-base-url=<http://localhost:9292>
/home/node/app/node_modules/@pact-foundation/pact-core/standalone/linux-arm64-2.0.3/pact/lib/ruby/lib/ruby/3.2.0/net/http.rb:1271:in `initialize': Failed to open TCP connection to localhost:9292 (Cannot assign requested address - connect(2) for "localhost" port 9292) (Errno::EADDRNOTAVAIL)
I am getting this error trying to publish the pact. My pact-broker is running in a docker container and my app is in another docker container.
They are both in the same network.
I am using a mac m1, my app is using node 20 image.
Should I open an issue for this?Francisco Barril
01/10/2024, 11:56 AMpact-broker:
container_name: local-environment-pact-broker
image: "pactfoundation/pact-broker:latest-multi"
ports:
- "9292:9292"
depends_on:
- postgres
environment:
PACT_BROKER_PORT: '9292'
PACT_BROKER_DATABASE_URL: "<postgres://postgres:password@postgres/postgres>"
PACT_BROKER_LOG_LEVEL: INFO
PACT_BROKER_SQL_LOG_LEVEL: DEBUG
# PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES is only needed for docker-compose
# because the database takes longer to start up than the puma process
# Should not be needed in production.
PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES: "5"
# The list of allowed base URLs (not setting this makes the app vulnerable to cache poisoning)
# This list allows the app to be addressed from the host and from within another docker container correctly
# Ngnix config below makes the app accessible on ports 443 and 80, while the Ruby application itself runs on port 9292
PACT_BROKER_BASE_URL: '<https://localhost> <http://localhost> <http://localhost:9292> <http://pact-broker:9292> <https://host.docker.internal> <http://host.docker.internal> <http://host.docker.internal:9292>'
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
localhost:9292
would only work if both containers are running the same network (usually not the case). So that could explain that problemFrancisco Barril
01/11/2024, 9:43 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
localhost
from the docker container running the publish is not likely to be able to access 9292
of the pact-broker docker container, unless you link them or explicitly set the network for them (which from the setup of docker compose doesn’t look to be the case)