Chuan Chuan Law

DevOps | Software Automation | Continuous Integration

Tag: Docker

Docker – How To Set Locale In Ubuntu

Add the following in your Dockerfile to set Locale in Ubuntu

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

How To Setup Pact Broker

Setting up Dockerized Pact Broker

The easiest and fastest way to do this is via Dockerized Pact Broker.

By following Step 1 to Step 4 in this document, you will be able to have a Dockerized Pact Broker linking to a Dockerized PSQL in your localhost within minutes!

All you then need is to publish the JSON file generated by your consumer test via Curl command:

curl -v -XPUT -H “Content-Type: application/json” -d @<path to JSON file> <http://localhost/pacts/provider/<Provider Name>I/consumer/<Consumer Name>/version/<App Version No.>>

  • Provider Name and Consumer Name can be found in the beginning of a Pact file
  • App version number is found in your consumer project’s code base

Older Version of Mac

A few things to share with my own experience is that (if you’re using Mac)

Pact Broker will be running on http://localhost

  • If you’re using an earlier Mac, therefore will be on Docker Toolbox, then will need to do the following to view the Pact Broker app:

docker-machine ip default

The command will enable the ip to be returned where you can view Pact Broker on port 80

Using Physical Database

If you do not wish yo use Dockerized PSQL, create your own database and set up the tables and users as explained. To link Pact Broker Docker to the physical database, do:

docker run –name pactbroker -e PACT_BROKER_DATABASE_USERNAME='{{user}}’ -e PACT_BROKER_DATABASE_PASSWORD='{{password}}’ -e PACT_BROKER_DATABASE_HOST='{{host}}’ -e PACT_BROKER_DATABASE_NAME='{{name}}’ -d -p 80:80 dius/pact_broker

 

© 2019 Chuan Chuan Law

Theme by Anders NorenUp ↑