DiUS / pact_broker-docker

'Dockerised' pact broker
http://pact.io
MIT License
76 stars 102 forks source link

Need help with configuration steps ? #22

Closed kumarSC closed 8 years ago

kumarSC commented 8 years ago

Hi @bethesque and @adamtsis ,

I am an mobile developer spiking out Pact for writing some contracts and found this docker container to setup broker.As a noob to docker and containers, trying to figure out exact steps I need to follow to get broker image up and running.Here are steps I have executed,

1.Installed Docker toolkit. 2.Got my local instance of Postgres DB (Referred POSTGRESQL.md) 2.Executed 'docker pull dius/pact_broker' . {Successful} 3.Executed 'docker run dius/pact_broker' . {Successful} 4.Executed ''docker exec -i -t fa6f0965e5ef bash'. {Successful}

Now I am stuck at steps which says "prepare your environment" , "setup broker connection with DB" and "executing script/test.sh". Not sure how to execute these steps.Could you please bail me out?

neilcampbell commented 8 years ago

Hi @kumarSC, Below are some instructions that I have sent to a couple of friends that asked a very similar question. Can we use you as a test candidate for the instructions, as I would like to update the README?

To set it up, you will want to run something like below:

  1. Start the PostgreSQL container via docker run --name pactbroker-db -e POSTGRES_PASSWORD=ThePostgresPassword -e POSTGRES_USER=admin -e PGDATA=/var/lib/postgresql/data/pgdata -v /var/lib/postgresql/data:/var/lib/postgresql/data -d postgres
  2. Connect to the container and execute psql via docker run -it --link pactbroker-db:postgres --rm postgres sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U admin'
  3. Run the follow SQL configuration scripts CREATE USER pactbrokeruser WITH PASSWORD 'TheUserPassword'; CREATE DATABASE pactbroker WITH OWNER pactbrokeruser; GRANT ALL PRIVILEGES ON DATABASE pactbroker TO pactbrokeruser;
  4. Start the PactBroker container via docker run --name pactbroker --link pactbroker-db:postgres -e PACT_BROKER_DATABASE_USERNAME=pactbrokeruser -e PACT_BROKER_DATABASE_PASSWORD=TheUserPassword -e PACT_BROKER_DATABASE_HOST=postgres -e PACT_BROKER_DATABASE_NAME=pactbroker -d -p 80:80 dius/pact_broker
  5. (Don't need to run this) Finally if you want to reconfigure/remove the container you will need to use docker rm pactbroker-db docker rm pactbroker

Keep us posted with how you go and any feedback you can give would be much appreciated.

kumarSC commented 8 years ago

Awesome, I will get going with these instructions and update my findings soon. Thanks for the quick response @neilcampbell .

neilcampbell commented 8 years ago

@kumarSC No problems! Thank you for the reminder, it has been on my list to do this for a while.

kumarSC commented 8 years ago

Hey @neilcampbell ,

Thanks a lot for the details.I was able to get pact broker up and running with Docker images.Something that might create confusion is POSTGRESQL.md talks about setting up a local postgres instance while your instructions advise using a docker image (which worked for me). Cheers for the good work !

neilcampbell commented 8 years ago

@kumarSC Didn't even know that was there. Thanks for the feedback!

neilcampbell commented 8 years ago

@uglyog What do you think of the above setup instructions? Do you think it's reasonable to recommend running the Postgres instance in a container as well, and remove POSTGRESQL.md?

uglyog commented 8 years ago

I've never actually read the instructions :-D, I've always just run the database in a docker container!

neilcampbell commented 8 years ago

@uglyog Haha me too actually. Thanks for updating!