Hey. Could anyone advice why I can’t upload/publis...
# pactflow
s
Hey. Could anyone advice why I can’t upload/publish provider contract to my own local pact broker server? It return 404 response
Error making request to <http://127.0.0.1:9292/contracts/provider/KAPI/version/5015> status=404
But when I’m trying to upload to my own pact broker on pactflow.io all work as expected (using token) Pact broker docker-compose config
Copy code
version: "3"

services:
  postgres:
    image: postgres
    healthcheck:
      test: psql postgres --command "select 1" -U postgres
    volumes:
      - postgres-volume:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      POSTGRES_DB: postgres

  pact-broker:
    image: pactfoundation/pact-broker:2.105.0.1
    ports:
      - "9292:9292"
    depends_on:
      - postgres
    environment:
      PACT_BROKER_BASIC_AUTH_ENABLED: "true"
      PACT_BROKER_BASIC_AUTH_USERNAME: "un"
      PACT_BROKER_BASIC_AUTH_PASSWORD: "pwd"
      PACT_BROKER_ALLOW_PUBLIC_READ: "false"
      PACT_BROKER_BASIC_AUTH_READ_ONLY_USERNAME": "unr"
      PACT_BROKER_BASIC_AUTH_READ_ONLY_PASSWORD: "pwdr"
      PACT_BROKER_DATABASE_URL: "<postgres://postgres:password@postgres/postgres>"
      PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES: "2"
      PACT_BROKER_BASE_URL: "<http://localhost>"
      PACT_BROKER_BASE_URLS: "<http://localhost:9292> <http://127.0.0.1:9292> <https://localhost> <https://127.0.0.1>"
      PACT_BROKER_PORT: "9292"
      PACT_BROKER_USE_HAL_BROWSER": "true"

volumes:
  postgres-volume:
uploading script
Copy code
for file in "$PWD"/*.yaml
do
  PROVIDER_NAME=$(yq eval .info.x-pact-name "$file" )
  if [[ "$PROVIDER_NAME" != null ]]
  then
    echo "Publish '$PROVIDER_NAME' from $file"
    pactflow publish-provider-contract \
          "${file}" \
          --content-type=application/yaml \
          --provider="$PROVIDER_NAME" \
          --provider-app-version="$RANDOM" \
          --broker-base-url="<http://127.0.0.1:9292>" \
          --broker-username="un" \
          --broker-password="pwd"
  fi
done
yaml file
Copy code
openapi: 3.0.3
info:
  title: k API
  version: "0.1"
  description: k API
  x-pact-name: KAPI

paths:
  /users/{userId}:
    get:
      summary: Returns user
      parameters:
        - in: path
          name: userId
          description: User ID
          schema:
            type: string
          required: true
      responses:
        '200':
          description: OK
        '401':
          description: Unauthorized
y
Provider driven contract testing is a PactFlow only feature
bow tie 1
1
d
and never expected in self-hosted broker ?
y
PactFlow self hosted yes Pact self hosted no
d
so, for money only ? and then it doesn’t matter if it is self-hosted PactFlow or not ?
y
The self hosted PactFlow broker is part of a paid plan yes The feature is expected as part of your free starter plan which is a cloud hosted version of PactFlow. On prem is part of the enterprise plan I believe
sadpepe 1
All this information is on our docs