0

Can someone point me in detail as for how to publish JSON pacts in step by step to Pact Broker?

Have installed docker, dius/pack_broker and well as Postgres (brew installation).

Missing the point of mending all the above in a proper way and the appropriate script that will publish the JSON pact to pact broker.

To add, I'm using JVM implementation at the consumer side. And simple gradle verification at the provider side.

arghtype
  • 4,376
  • 11
  • 45
  • 60
  • Happy to help, but would need to get more information as to what you've tried so we don't repeat yourself. You're right, it would be good to have a document to explain how to setup pact_broker. For the config, [please look at the database config file within the repository](https://github.com/DiUS/pact_broker/blob/master/config/database.yml) and change it accordingly. – J_A_X Feb 07 '17 at 06:14
  • Hi J_A_X, I'm trying to create dokcerised pact broker and postgres using the link - https://github.com/DiUS/pact_broker-docker/blob/master/POSTGRESQL.md. Getting the following error on running the first command in it... docker: Error response from daemon: Mounts denied: The path /var/lib/postgresql/data is not shared from OS X and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> File Sharing. See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info. .. – Janani Sampath Kumar Feb 07 '17 at 06:54
  • I think you should update your question, as it currently stands, it reads as if you have a broker but can't connect the dots to publish/retrieve. From this comment, it appears you can't even start the broker. Secondly, this is more of a Docker question - it looks like you're trying to mount a volume in docker incorrectly. – Matthew Fellows Feb 07 '17 at 22:00
  • @JananiSampathKumar Let's tackle one question at a time. I see you create a new question around configuring pact_broker on Docker, which is good. Might be a good idea to delete this question until after you fixed your docker pact_broker issue, and ask a new one if something else arises. – J_A_X Feb 08 '17 at 01:30

2 Answers2

5

The Pact Broker is a restful API over a repository of pacts, so the simplest way to publish is to just do a PUT request to the broker with the contents of the generated pact files.

As you have mentioned you're using Gradle, the Pact JVM Gradle plugin has a publish task which you could use. You just need to include the configuration in your consumer project and then execute the pactPublish task after running your tests.

See https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-gradle#publishing-pact-files-to-a-pact-broker-version-227 for more information.

Matthew Fellows
  • 3,669
  • 1
  • 15
  • 18
  • Hi Ronald, Thanks for your reply ! But still I have not configured my pact broker and postgres to receive/store my pacts. I have just installed it... Please explain in detail the steps to configure the pact broker and postgres to store pacts, so that when I execute the publish task, it will store there... Please provide me some insight !! – Janani Sampath Kumar Feb 07 '17 at 07:06
0

PACT Broker Setup Download Dockerized Pact Broker Image from Docker HUB https://hub.docker.com/r/dius/pact-broker/ And follow the Prerequisites & Getting Started section which is provided by PACT Foundation. In addition you need Postgres Docker Image. I recommend prepare docker compose file and run. By default PACT Broker run on PUMA which uses default port 9292. Here is the PACT Broker repository from PACT Foundation you can copy Docker Compose file from here. https://github.com/pact-foundation/pact-broker-docker

Kanthishere
  • 173
  • 3
  • 7