Giter Club home page Giter Club logo

pact_broker-docker's Introduction

Dockerised Pact Broker

Build Status

This repository contains a Dockerized Pact Broker. You can pull the dius/pact-broker image from Dockerhub.

A smaller and sexier Docker image has now been built in the Pact Foundation organization. The new image can be run without root permissions, and is only 98MB compressed! All environment variable configurations are the same, so you should just be able to switch from dius/pact-broker to pactfoundation/pact-broker and run with it - note that the default port has changed from 80 to 9292 though.

Which one should I use?

Please read https://github.com/phusion/passenger/wiki/Puma-vs-Phusion-Passenger for information on which server will suit your needs best. The tl;dr is that if you want to run the docker image in a managed architecture which will make your application highly available (eg. ECS, Kubernetes) then use the pactfoundation/pact-broker. Puma will not restart itself if it crashes, so you will need external monitoring to ensure the Pact Broker stays available.

If you want to run the container as a standalone instance, then the dius/pact-broker image which uses Phusion Passenger may serve you better, as Passenger will restart any crashed processes.

Note: On 12 May 2018, the format of the docker tag changed from M.m.p-RELEASE to M.m.p.RELEASE (where M.m.p is the semantic version of the underlying Pact Broker package) so that Dependabot can recognise when the version has been incremented.

In a hurry?

If you want to try out a Pact Broker that can be accessed by all your teams, without having to fill in requisition forms and wait for 3 months, you can get a free trial at pactflow.io. Built by a group of core Pact maintainers, Pactflow is a fork of the OSS Pact Broker with extra goodies like an improved UI, field level verification results and federated login. It's also fully supported, and that means when something goes wrong, someone else gets woken up in the middle of the afternoon to fix it...

Prerequisites

  • A running postgresql database and the ability to connect to it (see POSTGRESQL.md).
  • If on Mac, you will need the timeout or gtimeout function. You can install gtimeout using brew install coreutils.

Getting Started

  1. Install Docker

Create the database

On an instance of Postgres version 10 or later, connect as a user with administrator privileges and run:

CREATE DATABASE pact_broker;
CREATE ROLE pact_broker WITH LOGIN PASSWORD 'CHANGE_ME';
GRANT ALL PRIVILEGES ON DATABASE pact_broker TO pact_broker;

Configure the connection details

You can either set the PACT_BROKER_DATABASE_URL in the format driver://username:password@host:port/database (eg. postgres://user1:pass1@myhost/mydb) or, you can set the credentials individually using the following environment variables:

* `PACT_BROKER_DATABASE_ADAPTER` (optional, defaults to 'postgres', see note below.)
* `PACT_BROKER_DATABASE_USERNAME`
* `PACT_BROKER_DATABASE_PASSWORD`
* `PACT_BROKER_DATABASE_HOST`
* `PACT_BROKER_DATABASE_NAME`
* `PACT_BROKER_DATABASE_PORT` (optional, defaults to the default port for the specified adapter)

Adapter can be 'postgres' (recommended) or 'sqlite'. SQLite will work for spikes, but it is NOT supported as a production database.

For an SQLite database (only recommended for investigation/spikes, as it will be disposed of with the container unless you mount it from an external file system):

  • PACT_BROKER_DATABASE_ADAPTER (set to 'sqlite')
  • PACT_BROKER_DATABASE_NAME (arbitrary name eg. /tmp/pact_broker.sqlite)

You can additionally set:

* `PACT_BROKER_DATABASE_SSLMODE` - optional, possible values: 'disable', 'allow', 'prefer', 'require', 'verify-ca', or 'verify-full' to choose how to treat SSL (only respected if using the postgres database adapter. See https://www.postgresql.org/docs/9.1/libpq-ssl.html for more information.)
* `PACT_BROKER_SQL_LOG_LEVEL` - optional, defaults to debug. The level at which to log SQL statements.
* `PACT_BROKER_SQL_LOG_WARN_DURATION` - optional, defaults to 5 seconds. Log the SQL for queries that take longer than this number of seconds.
* `PACT_BROKER_DATABASE_MAX_CONNECTIONS` - optional, defaults to 4. The maximum size of the connection pool.
* `PACT_BROKER_DATABASE_POOL_TIMEOUT` - optional, 5 seconds by default. The number of seconds to wait if a connection cannot be acquired before raising an error.

Notes

  • Use -p 80:80 to start the docker image, as some of the Rack middleware gets confused by receiving requests for other ports and will return a 404 otherwise (port forwarding does not rewrite headers).
  • On OSX, if you are not using Docker native, use docker-machine ip $(docker-machine active) to get the IP of the VirtualBox, and connect on port 80.
  • The application makes use of the phusion passenger application server.
  • Apart from creating a database no further preparation is required.

Using basic auth

To enable basic auth, run your container with:

  • PACT_BROKER_BASIC_AUTH_USERNAME
  • PACT_BROKER_BASIC_AUTH_PASSWORD
  • PACT_BROKER_BASIC_AUTH_READ_ONLY_USERNAME
  • PACT_BROKER_BASIC_AUTH_READ_ONLY_PASSWORD

If you want to allow public read access (but still require credentials for writing), then omit setting the READ_ONLY credentials and set PACT_BROKER_ALLOW_PUBLIC_READ=true.

Developers should use the read only credentials on their local machines, and the CI should use the read/write credentials. This will ensure that pacts and verification results are only published from your CI.

Note that the verification status badges are not protected by basic auth, so that you may embed them in README markdown.

Heartbeat URL

If you are using the docker container within an AWS autoscaling group, and you need to make a heartbeat URL publicly available, set PACT_BROKER_PUBLIC_HEARTBEAT=true. No database connection will be made during the execution of this endpoint.

The heartbeat is available at /diagnostic/status/heartbeat.

Healthcheck URL

See Heartbeat URL.

Using SSL

See the Pact Broker configuration documentation.

Setting the log level

Set the environment variable PACT_BROKER_LOG_LEVEL to one of DEBUG, INFO, WARN, ERROR, or FATAL.

Webhook whitelists

  • PACT_BROKER_WEBHOOK_HOST_WHITELIST - a space delimited list of hosts (eg. github.com), network ranges (eg. 10.2.3.41/24, or regular expressions (eg. /.*\\.foo\\.com$/). Regular expressions should start and end with a / to differentiate them from Strings. Note that backslashes need to be escaped with a second backslash. Please read the Webhook whitelists section of the Pact Broker configuration documentation to understand how the whitelist is used. Remember to use quotes around this value as it may have spaces in it.
  • PACT_BROKER_WEBHOOK_SCHEME_WHITELIST - a space delimited list (eg. http https). Defaults to https.

Other environment variables

  • PACT_BROKER_BASE_URL - optional but strongly recommended when deploying the Pact Broker to production as it prevents some security vulnerabilities. If you find that the URLs generated by the API are using an IP instead of a hostname, you can set this environment variable to force the desired base URL. Must include the port if it's a non-standard one. eg. https://my-broker:9292. This can also be used if you are mounting the Docker container so that it runs on a non root context eg. https://my-company.com/pact-broker. Not that this setting does not change where the application is mounted within the Docker container - it just changes the links.
  • PACT_BROKER_BASE_EQUALITY_ONLY_ON_CONTENT_THAT_AFFECTS_VERIFICATION_RESULTS - true by default, may be set to false.
  • PACT_BROKER_ORDER_VERSIONS_BY_DATE - true by default. Setting this to false is deprecated.
  • PACT_BROKER_DISABLE_SSL_VERIFICATION - false by default, may be set to true. Disables SSL verification for webhook endpoints.

General Pact Broker configuration and usage

Documentation for the Pact Broker application itself can be found in the Pact Broker docs.

Running with Docker Compose

For a quick start with the Pact Broker and Postgres, we have an example Docker Compose setup you can use:

  1. Modify the docker-compose.yml file as required.
  2. Run docker-compose up to get a running Pact Broker and a clean Postgres database

Now you can access your local broker:

curl -v http://localhost # you can visit in your browser too!

# SSL endpoint, note that URLs in response contain https:// protocol
curl -v -k https://localhost:8443

NOTE: this image should be modified before using in Production, in particular, the use of hard-coded credentials

Running with Openshift

See pact-broker-openshift for an example config file.

Troubleshooting

See the Troubleshooting page on the wiki.

pact_broker-docker's People

Contributors

amitojduggal avatar bethesque avatar cah-andrew-fitzgerald avatar conf avatar dependabot[bot] avatar elgalu avatar itsmenandess avatar k-ong avatar lucasandersson avatar mefellows avatar nateg-gladly avatar neilcampbell avatar pkubowicz avatar pniederlag avatar rafaelhdr avatar srizzling avatar you54f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pact_broker-docker's Issues

Make heartbeat url unprotected by basic auth

Hi guys!

We're using this docker image on Amazon ECS, which wants an URL for healtchecking the container. We turned on basic auth, and it seems the healtcheck url is behind basic auth https://pact-broker.example.com/diagnostic/status/heartbeat. For me it meant the container never became healthy (401).

I found a workaround and used this url for a badge, which returns a 200 even though the pact is not found. https://pact-broker.example.com/pacts/provider/PROVIDER/consumer/CONSUMER/latest/badge.svg

This works, but it would be nice to be able to reach /diagnostic/status/heartbeat without having to authenticate. Is it possible? 😃

Cheers!
Marius

Turn on basic auth?

I've had a look through this repo and the actual broker repo and can't seem to find instructions to turn on basic auth and set the credentials for the broker (as opposed to the database user/pass). I am guessing its going to be something to do with pact_broker/config.ru?

build.sh is missing

The readme references a build.sh file but it is not present in the repo. I found the build_and_publish.sh, but it seems that it is not intended for the same purpose.

Support mysql

Hi,

I was hoping to run pact_broker with mysql and would like to use your base image. However currently it supports only postgres. What do you think about supporting both postgres and mysql? fwict, this code is the only one that is database dependent.

Cheers!
Saroj

Pact Broker SSL Certificates for Webhooks

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • [x ] Confirmed this is the right place to raise the issue - issues for the Pact Broker application itself should be raised in the Pact Broker project.
  • [x ] Upgraded to the latest Pact Broker Docker image OR
  • [ x] Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • [ X] Read the Troubleshooting page

I am facing issues with triggering webhooks from inside the broker.Currently the weebhook link has a corporate certificate,so if I try with config config.disable_ssl_verification = true it gives me HTTP 400.

and if I try to trigger the webhook with config.disable_ssl_verification = false
Error executing webhook OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 state=error: certificate verify failed.

I have the corporate certificates,But I am not sure where should I add the certificates.

A curl from inside the docker to the webhook is successful,but when triggered from within the pact broker fails on pact publish

unable to load broker ui

After getting the docker container up and running and connecting to the database, I'm now left with a message of Not Found: / (similar for other routes).

I am not very strong with ruby or passenger, so I'm not very sure where to start to debug the issue. docker logs shows the database setup and what appears to be successful loading of several components, including the UI.

I have deployed the non-containerized broker to heroku for a different project without issue, but expected the container to be even simpler. Could you help me understand where to start looking?

Idiomatic port assigning

With the caveat that I'm completely new to ruby. How would I assign a non-default port in the config.ru using env vars?

pg_password = ENV['PACT_BROKER_DATABASE_PASSWORD']
pg_host = ENV['PACT_BROKER_DATABASE_HOST']
pg_port = ENV['PACT_BROKER_DATABASE_PORT']
pg_database = ENV['PACT_BROKER_DATABASE_NAME']

connection_string = "postgres://#{pg_user}:#{pg_password}@#{pg_host}:#{pg_port}/#{pg_database}"
puts "#{connection_string}"

Whenever I set a custom env var it isn't picked up and the code above prints
postgres://user:password@host:/database (without the port passed in via docker)

This may be some ruby nuance but I would expect to see a correctly formed url there, but any custom env var (not in the default config.ru) I use doesn't show up.

I have similar problems with the other issue I raised (#32) when trying to specify a PACT_USERNAME and PACT_PASSWORD as env vars and try to use them in my config.ru

Run application as app user instead of root user?

We're interested in running the pact broker application as the app rather than root user in the Docker container. I looked into opening a PR but noticed that this maybe was already implemented based on the Dockerfile:

Just wondering what the story is behind these changes, is the project interested in PRs to run as app rather than root?

Thank you!

404 Not Found when trying to load Pact Broker

Hi, I'm trying to get the pact broker working, but when I run the container I get a 404 page from nginx. I would appreciate some guidance on this.

image

I've attached part of the logs:

Status: Downloaded newer image for dius/pact-broker:latest
2017-05-23T01:46:16.256549997Z May 23 01:46:15 136ed7e7dc55 syslog-ng[23]: syslog-ng starting up; version='3.5.3'
2017-05-23T01:46:16.266815405Z ok: run: /etc/service/nginx-log-forwarder: (pid 33) 0s
2017-05-23T01:46:26.285570357Z [ 2017-05-23 01:46:16.5525 37/7feea7a347c0 age/Cor/Main.cpp:957 ]: Starting Passenger core...
2017-05-23T01:46:26.285599869Z [ 2017-05-23 01:46:16.5532 37/7feea7a347c0 age/Cor/Main.cpp:234 ]: Passenger core running in multi-application mode.
2017-05-23T01:46:26.285607572Z [ 2017-05-23 01:46:16.5608 37/7feea7a347c0 age/Cor/Main.cpp:707 ]: Passenger core online, PID 37
2017-05-23T01:46:26.285614575Z [ 2017-05-23 01:46:16.5903 42/7ff8bb5c57c0 age/Ust/Main.cpp:430 ]: Starting Passenger UstRouter...
2017-05-23T01:46:26.285621078Z [ 2017-05-23 01:46:16.5948 42/7ff8bb5c57c0 age/Ust/Main.cpp:311 ]: Passenger UstRouter online, PID 42
2017-05-23T01:46:26.285636684Z 2017/05/23 01:46:16 [error] 51#0: *1 open() "/home/app/pact_broker/public/robots933456.txt" failed (2: No such file or directory), client: <redacted>, server: , request: "HEAD /robots933456.txt HTTP/1.1", host: "<redacted>"
2017-05-23T01:46:26.285648689Z 2017/05/23 01:46:16 [error] 51#0: *2 "/home/app/pact_broker/public/index.html" is not found (2: No such file or directory), client: <redacted>, server: , request: "GET / HTTP/1.1", host: "<redacted>"
2017-05-23T01:46:26.285656592Z 2017/05/23 01:46:16 [error] 51#0: *3 "/home/app/pact_broker/public/index.html" is not found (2: No such file or directory), client: <redacted>, server: , request: "GET / HTTP/1.1", host: "<redacted>"
2017-05-23T01:46:26.285663995Z 2017/05/23 01:46:16 [error] 51#0: *4 "/home/app/pact_broker/public/index.html" is not found (2: No such file or directory), client: <redacted>, server: , request: "GET / HTTP/1.1", host: "<redacted>"
2017-05-23T01:46:26.285671298Z 2017/05/23 01:46:17 [error] 51#0: *5 open() "/home/app/pact_broker/public/favicon.ico" failed (2: No such file or directory), client: <redacted>, server: , request: "GET /favicon.ico HTTP/1.1", host: "<redacted>", referrer: "<redacted>"
2017-05-23T01:46:42.283010369Z 2017/05/23 01:46:42 [error] 51#0: *6 "/home/app/pact_broker/public/index.html" is not found (2: No such file or directory), client: <redacted>, server: , request: "GET / HTTP/1.1", host: "<redacted>"
2017-05-23T01:47:39.275701702Z 2017/05/23 01:47:38 [error] 51#0: *7 "/home/app/pact_broker/public/index.html" is not found (2: No such file or directory), client: <redacted>, server: , request: "GET / HTTP/1.1", host: "<redacted>"

Error when follow the instructions of POSTGRESQL.md

Hi guys, I followed the instructions on postgresql.md:

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
Change ThePostgresPassword as required.

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'
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;
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

Now, my pact-broker is running and I'm able to push a contract to pact-broker, but, when I click on view pact button, I got the following stacktrace:

{"message":"incompatible character encodings: UTF-8 and US-ASCII","backtrace":["/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact-1.9.0/lib/pact/doc/markdown/consumer_contract_renderer.rb:18:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact-1.9.0/lib/pact/doc/markdown/consumer_contract_renderer.rb:14:incall'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/api/renderers/html_pact_renderer.rb:76:in markdown'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/api/renderers/html_pact_renderer.rb:85:inhtml'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/api/renderers/html_pact_renderer.rb:30:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/api/renderers/html_pact_renderer.rb:18:incall'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/configuration.rb:35:in block in default_html_pact_render'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/api/resources/latest_pact.rb:29:incall'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/api/resources/latest_pact.rb:29:in to_html'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/decision/flow.rb:475:ino18'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:30:in block (2 levels) in run'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:50:inhandle_exceptions'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:30:in block in run'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:28:inloop'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/decision/fsm.rb:28:in run'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/dispatcher.rb:46:inblock in dispatch'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/as-notifications-1.0.1/lib/as/notifications.rb:161:in instrument'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/events.rb:75:ininstrument'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/dispatcher.rb:45:in dispatch'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/webmachine-1.4.0/lib/webmachine/adapters/rack.rb:68:incall'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/cascade.rb:33:in block in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/cascade.rb:24:ineach'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/cascade.rb:24:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:inblock in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in each'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:incall'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/static.rb:124:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/rack/hal_browser/redirect.rb:19:incall'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/rack/pact_broker/convert_file_extension_to_accept_header.rb:22:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/static.rb:124:incall'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:153:in call'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/pact_broker-1.9.0/lib/pact_broker/app.rb:21:incall'","/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:74:in process_request'","/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:141:inaccept_and_process_next_request'","/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:109:in main_loop'","/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:455:inblock (3 levels) in start_threads'"]}

I don't know how to proceed, could someone help me?

Pact-broker will not start on Kubernetes with Google Cloud

I am trying to start the docker image on Google Cloud using Kubernetes.

I am however enountering a problem where runit cannot start new services because of a missing file.

[pact-broker] *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
[pact-broker] *** Running /etc/my_init.d/30_presetup_nginx.sh...
[pact-broker] *** Running /etc/rc.local...
[pact-broker] *** Booting runit daemon...
[pact-broker] *** Runit started as PID 10
[pact-broker] warning: /etc/service/nginx-log-forwarder: unable to open supervise/ok: file does not exist
[pact-broker] ok: run: /etc/service/nginx-log-forwarder: (pid 29) 0s

The line in questions is [pact-broker] warning: /etc/service/nginx-log-forwarder: unable to open supervise/ok: file does not exist.

This error does not happen if I try to launch the application locally on my computer.

Here is my demployment file for k8s.

apiVersion: apps/v1beta1 # for versions before 1.6.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: pact-broker
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: pact-broker
    spec:
      containers:
      - name: pact-broker
        image: dius/pact-broker:latest
        imagePullPolicy: Always
        ports:
        - name: api
          containerPort: 80
          protocol: TCP
        resources:
          limits:
            memory: 512Mi
            cpu: 100m
          requests:
            memory: 256Mi
            cpu: 50m
        envFrom:
          - configMapRef:
              name: pact-broker-config
        env:
          - name: PACT_BROKER_DATABASE_HOST
            value: "127.0.0.1:5432"
          - name: PACT_BROKER_DATABASE_NAME
            value: "pactbroker"
          - name: PACT_BROKER_DATABASE_USERNAME
            valueFrom:
              secretKeyRef:
                name: pact-broker-db-credentials
                key: username
          - name: PACT_BROKER_DATABASE_PASSWORD
            valueFrom:
              secretKeyRef:
                name: pact-broker-db-credentials
                key: password
      - image: gcr.io/cloudsql-docker/gce-proxy:1.11
        name: cloudsql-proxy
        command: ["/cloud_sql_proxy", "--dir=/cloudsql",
                  "-instances=entur-1287:europe-west1:pact-broker-db-dev=tcp:5432",
                  "-credential_file=/secrets/cloudsql/credentials.json"]
        volumeMounts:
          - name: pact-broker-instance-credentials
            mountPath: /secrets/cloudsql
            readOnly: true
          - name: ssl-certs
            mountPath: /etc/ssl/certs
          - name: cloudsql
            mountPath: /cloudsql
      volumes:
        - name: pact-broker-instance-credentials
          secret:
            secretName: pact-broker-instance-credentials
        - name: ssl-certs
          hostPath:
            path: /etc/ssl/certs
        - name: cloudsql
          emptyDir:

TL;DR
Seems like the docker image behaves differently on Kubernetes than on a local computer.

schema migration table missing in pact-broker:2.23.0-1

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Confirmed this is the right place to raise the issue - issues for the Pact Broker application itself should be raised in the Pact Broker project.
  • Upgraded to the latest Pact Broker Docker image OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Software versions

  • pact-broker gem version: eg 2.23.0
  • pact-broker docker version: eg 2.23.0-1
  • OS: Mac OSX 10.13.4

Expected behaviour

The pact broker web page is displayed after starting the image

Actual behaviour

When I open the the web ui I get ´We're sorry, but something went wrong´

Steps to reproduce

Here is my docker-compose.yml.

Without any prior state I started the database with docker-compose up postgres and started the broker with docker-compose up broker_app.

Relevent log files

broker_app_1  | App 49 stdout: 
broker_app_1  | App 49 stdout: E, [2018-06-22T19:54:45.786606 #49] ERROR -- : PG::UndefinedTable: ERROR:  relation "schema_migrations" does not exist
broker_app_1  | App 49 stdout: LINE 1: SELECT NULL AS "nil" FROM "schema_migrations" LIMIT 1
broker_app_1  | App 49 stdout:                                   ^: SELECT NULL AS "nil" FROM "schema_migrations" LIMIT 1
broker_app_1  | App 49 stdout: E, [2018-06-22T19:54:45.810695 #49] ERROR -- : PG::UndefinedTable: ERROR:  relation "schema_info" does not exist
broker_app_1  | App 49 stdout: LINE 1: SELECT NULL AS "nil" FROM "schema_info" LIMIT 1
broker_app_1  | App 49 stdout:                                   ^: SELECT NULL AS "nil" FROM "schema_info" LIMIT 1
broker_app_1  | App 49 stderr: 
broker_app_1  | App 49 stderr: Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see:
broker_app_1  | App 49 stderr:     https://github.com/rvm/rvm/issues/3212
broker_app_1  | App 49 stderr: 
broker_app_1  | App 49 stdout: 
broker_app_1  | [ E 2018-06-22 19:54:48.8202 28/Te age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/app/pact_broker: An error occurred while starting up the preloader.
broker_app_1  |   Error ID: 7834aac7
broker_app_1  |   Error details saved to: /tmp/passenger-error-73uuPC.html
broker_app_1  |   Message from application: uninitialized constant PactBroker::Api::Resources::BaseResource (NameError)
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources/pact_triggered_webhooks.rb:6:in `<module:Resources>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources/pact_triggered_webhooks.rb:5:in `<module:Api>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources/pact_triggered_webhooks.rb:4:in `<module:PactBroker>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources/pact_triggered_webhooks.rb:3:in `<top (required)>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources.rb:9:in `require'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources.rb:9:in `block in <top (required)>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources.rb:8:in `glob'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api/resources.rb:8:in `<top (required)>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api.rb:2:in `require'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/api.rb:2:in `<top (required)>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/app.rb:137:in `require'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/app.rb:137:in `build_api'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/app.rb:103:in `prepare_app'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/pact_broker-2.23.0/lib/pact_broker/app.rb:32:in `initialize'
broker_app_1  |   config.ru:12:in `new'
broker_app_1  |   config.ru:12:in `block in <main>'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `instance_eval'
broker_app_1  |   /home/app/pact_broker/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `initialize'
broker_app_1  |   config.ru:1:in `new'
broker_app_1  |   config.ru:1:in `<main>'
broker_app_1  |   /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval'
broker_app_1  |   /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app'
broker_app_1  |   /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
broker_app_1  |   /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
broker_app_1  |   /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
broker_app_1  | 
broker_app_1  | 
broker_app_1  | [ E 2018-06-22 19:54:48.8289 28/T7 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 7834aac7. Please see earlier logs for details about the error.

Support other port than 80

Only when mapping port 80 of the docker host to port 80 of the docker container will pact broker work.
This is not ideal, because at our company, we want to be able to run multiple services on a single docker host.
The host should be able to display a default page on port 80 that shows how to request a new service for example.
Not being able to set the port is not really workable.

EDIT
I didn't check the pull requests before creating this issue.
#17 looks promising.

I hope it can be merged...

Need help with configuration steps ?

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?

Can't spin up pact_broker-docker:latest, 2.7.0.beta.2-1, or 2.7.0.beta.3-1

Following #46, I got a fresh docker install of 2.4.0-2.

For latest, 2.7.0.beta.2-1, or 2.7.0.beta.3-1, I repeatedly ran into ...

Could not spawn process for application /home/app/pact_broker: An error occured while starting up the preloader.
Error ID: 66ef0932 Error details saved to: /tmp/passenger-error-xHOaHz.html Message from application: uninitialized constant PactBroker::Api::Resources::BaseResource (NameError)

In 2.7.0.beta.3-1, I also got
App 45 stderr: Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see: App 45 stderr: https://github.com/rvm/rvm/issues/3212

To replicate this:

  1. Spin up an entirely new environment (in my case a basic Amazon Linux AMI 2017.09.0 (HVM), SSD Volume Type )
  2. Follow POSTGRESQL.md exactly up until the next step
  3. Run 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:2.7.0.beta.2-1
  4. Hit the url, see the error page
  5. In the docker container, cat /var/log/nginx/error.log

Here is the full error log:
error.log

runit daemon is shut down after passenger starts & connects to db

Software versions

  • pact-broker docker version: dius/pact-broker:2.27.3-2
  • OS: Kubernetes

Issue

We working on setting up pact-broker running in Docker on a Kubernetes cluster, using postgres for the database.

We're running into an issue where after the application starts up, the runit daemon is shut down, which causes the entire Docker container to shut down. We've confirmed that previous to this, the app connects successfully to the postgres db via the db logs. We're wondering if you have tips on debugging what's happening here: we weren't able to find any exact matches of previous issues. Thank you for any pointers!

cc @mkj28

*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_syslog-ng.init...
Jan  3 00:18:37 pact-broker-pod syslog-ng[27]: syslog-ng starting up; version='3.13.2'
*** Running /etc/my_init.d/30_presetup_nginx.sh...
*** Booting runit daemon...
*** Runit started as PID 35
ok: run: /etc/service/nginx-log-forwarder: (pid 42) 0s
Jan  3 00:18:37 pact-broker-pod cron[41]: (CRON) INFO (pidfile fd = 3)
Jan  3 00:18:37 pact-broker-pod cron[41]: (*system*) NUMBER OF HARD LINKS > 1 (/etc/crontab)
Jan  3 00:18:37 pact-broker-pod cron[41]: (CRON) INFO (Running @reboot jobs)
[ N 2019-01-03 00:18:37.8487 44/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
[ N 2019-01-03 00:18:37.8626 47/T1 age/Cor/CoreMain.cpp:1310 ]: Starting Passenger core...
[ N 2019-01-03 00:18:37.8627 47/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2019-01-03 00:18:37.8839 47/T1 age/Cor/CoreMain.cpp:985 ]: Passenger core online, PID 47
[ N 2019-01-03 00:18:40.6052 47/T5 age/Cor/SecurityUpdateChecker.h:517 ]: Security update check: no update found (next check in 24 hours)
*** Shutting down runit daemon (PID 35)...
*** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...
Jan  3 00:18:51 pact-broker-pod syslog-ng[27]: syslog-ng shutting down; version='3.13.2'
*** Init system aborted.
*** Killing all processes...

ERROR: for pact_broker_app_1 Cannot start service broker_app: driver failed programming external connectivity on endpoint pact_broker_app_1

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • [x ] Confirmed this is the right place to raise the issue - only issues related to the Dockerization of the Pact Broker should be raised here. Issues related to the Pact Broker application itself should be raised in the Pact Broker project.
  • [ x] Upgraded to the latest Pact Broker Docker image OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Software versions

  • pact-broker docker version: f62083f7d787 -> Image ID
  • OS: Windows 10

Expected behaviour

Should be able to run docker-compose up from the provide docker compose file

Actual behaviour

$ docker-compose up
pact_postgres_1 is up-to-date
Starting pact_broker_app_1 ... error

ERROR: for pact_broker_app_1 Cannot start service broker_app: driver failed pro gramming external connectivity on endpoint pact_broker_app_1 (06f93d122fceeb62b8 a320ceea2d939c1ed3cde5285456dd00d23c52bafb0c6f): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error Permission denied

ERROR: for broker_app Cannot start service broker_app: driver failed programmin g external connectivity on endpoint pact_broker_app_1 (06f93d122fceeb62b8a320cee a2d939c1ed3cde5285456dd00d23c52bafb0c6f): Error starting userland proxy: Bind fo r 0.0.0.0:80: unexpected error Permission denied
Encountered errors while bringing up the project.

Steps to reproduce

Reran the docker-compose up command several times. Got the same error message.

Relevent log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

What volumes should I mount on my docker-compose to persist data

I'm deploying pact broker docker but I don't see docs on what volumes should I mount to persist data between container restarts/destroy of pact-broker container. What volume should I mount?

For the postgres container, I assume it's pgdata:/var/lib/postgresql/data postgres same as the container docs say, can we confirm this?

@bethesque , Any help on nginx ? or can i get without nginx configuration docker image in separate branch?

Our Kubernetes Team increased the security level blueprint 1.7.2. So our current deployment getting failed. i am not able to sort out it further.

Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
Running /etc/my_init.d/30_presetup_nginx.sh...
Running /etc/rc.local...
Booting runit daemon...
Runit started as PID 11
ok: run: /etc/service/nginx-log-forwarder: (pid 21) 0s
chown: changing ownership of '/dev/xconsole': Operation not permitted
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/03/14 09:10:29 [emerg] 19#19: chown("/var/lib/nginx/body", 33) failed (1: Operation not permitted)
tail: cannot open '/var/log/nginx/error.log' for reading: Permission denied
ok: run: /etc/service/nginx-log-forwarder: (pid 28) 0s
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/03/14 09:10:30 [emerg] 32#32: chown("/var/lib/nginx/body", 33) failed (1: Operation not permitted)
tail: cannot open '/var/log/nginx/error.log' for reading: Permission denied

Run pact broker in a subfolder

Running pact-broker in our kubernetes environment and works very well and have managed very nicely to deploy it using our own helm template.

The downside is that with our template all our service are deployed in a subfolder.

All links in the pact broker are referenced with the urls starting with / which makes all links broken.

It would more reliable if all links including css and js to be relative instead of coded with / to support both running in an own domain or in an subfolder.

Webhook not triggered with multiple providers after deleting one webhook

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Confirmed this is the right place to raise the issue - only issues related to the Dockerization of the Pact Broker should be raised here. Issues related to the Pact Broker application itself should be raised in the Pact Broker project.
  • Upgraded to the latest Pact Broker Docker image OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Software versions

  • pact-broker gem version: Not sure
  • pact-broker docker version: Sorry I don't have access to check the version on our deployment, but this is the docker image ID we were using: dius/pact-broker@sha256:dd913cc51d8cc10587d0ce771a5e2fb37fde9ff2c09fa651330aaa70e09a0687
  • OS: e.g. Mac OSX 10.11.5
  • pact broker client details: We were using HAL browser to create and delete webhooks. For consumer side, we are using: Pact with JavaScript: "@pact-foundation/pact": "7.2.0"

Expected behaviour

Webhook for contract change is triggered on provider

Actual behaviour

Webhook is not triggered on provider

Steps to reproduce

  1. Consumer C has two providers, P1 and P2.
  2. Pacts and contract_content_changed webhooks are created for both C-P1 and C-P2 combinations.
  3. Delete the webhook and latest pact version between C and P1.
  4. Recreate the webhook between C and P1.
  5. Publish a contract with contract change.

Our webhook for contract change:

  "consumer": {
    "name": "..."
  },
  "provider": {
    "name": "..."
  },
  "request": {
    "method": "POST",
    "url": "{provider build link}",
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded",
      "Accept": "application/json",
      "Jenkins-Crumb": "..."
    },
    "body": "json={\"parameter\":[{\"name\": \"CONSUMER_GITHUB_PROJECT\",\"value\": \"...\"},{\"name\": \"CONSUMER_NAME\",\"value\": \"${pactbroker.consumerName}\"},{\"name\": \"VERIFICATION_URL\",\"value\": \"${pactbroker.verificationResultUrl}\"},{\"name\": \"PROVIDER_VERSION\",\"value\": \"${pactbroker.providerVersionNumber}\"},{\"name\": \"CONSUMER_VERSION\",\"value\": \"${pactbroker.consumerVersionNumber}\"},{\"name\": \"PROVIDER_TAGS\",\"value\": \"${pactbroker.providerVersionTags}\"},{\"name\": \"CONSUMER_TAGS\",\"value\": \"${pactbroker.consumerVersionTags}\"}]}}",
    "username": "...",
    "password": "..."
  },
  "events": [
    {
      "name": "contract_content_changed"
    }
  ]
}```

To fix this issue:
Delete webhooks between both `C` and `P1` and between `C` and `P2` at step 3. And then do the steps above. The webhook then created will be triggered.

## Relevent log files
```App 373 output: E, [2019-04-04T10:17:37.341770 #373] ERROR -- : PG::ForeignKeyViolation: ERROR:  update or delete on table "pact_publications" violates foreign key constraint "triggered_webhooks_pact_publication_id_fkey" on table "triggered_webhooks"
App 373 output: DETAIL:  Key (id)=(1172) is still referenced from table "triggered_webhooks".: DELETE FROM "pact_publications" WHERE ("consumer_version_id" = 755)
App 373 output: E, [2019-04-04T10:17:37.342049 #373] ERROR -- : PG::ForeignKeyViolation: ERROR:  update or delete on table "pact_publications" violates foreign key constraint "triggered_webhooks_pact_publication_id_fkey" on table "triggered_webhooks"
App 373 output: DETAIL:  Key (id)=(1172) is still referenced from table "triggered_webhooks".```

Port different than 80 still not working

Expected behaviour:

I can map the internal port to any external port that I want with docker

Actual behaviour:

Mapping to anything else than 80 causes Rack to refuse the connection

Versions tested:

Latest, 2.11.0-1

Related issues:

#24
#17
#11

Example `docker-compose up` does not start successfully due to passenger/RVM.

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Confirmed this is the right place to raise the issue - only issues related to the Dockerization of the Pact Broker should be raised here. Issues related to the Pact Broker application itself should be raised in the Pact Broker project.
  • Upgraded to the latest Pact Broker Docker image OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Software versions

  • pact-broker gem version: 2.27.2
  • pact-broker docker version: 2.27.2-1
  • OS: Ubuntu 18.04
  • Docker-Compose version: docker-compose version 1.22.0
  • Docker version: Docker version 18.06.1-ce

Expected behaviour

When I use the example docker-compose here I should have a working pact-broker.

docker-compose up

I changed the nginx ports to the following as I am not running this as root and do not need SSL yet:

    ports:
      - "8080:80"

Actual behaviour

It appears Passenger shuts down on startup but the container doesn't finish?

broker_app_1  | [ N 2018-10-22 10:12:06.9462 29/T1 age/Cor/CoreMain.cpp:1080 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
broker_app_1  | [ N 2018-10-22 10:12:06.9462 29/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 471, application /home/app/pact_broker/public
broker_app_1  | [ N 2018-10-22 10:12:06.9463 29/T9 Ser/Server.h:886 ]: [ApiServer] Freed 0 spare client objects
broker_app_1  | [ N 2018-10-22 10:12:06.9463 29/T9 Ser/Server.h:531 ]: [ApiServer] Shutdown finished
broker_app_1  | [ N 2018-10-22 10:12:06.9464 29/T4 Ser/Server.h:886 ]: [ServerThr.1] Freed 128 spare client objects
broker_app_1  | [ N 2018-10-22 10:12:06.9465 29/T4 Ser/Server.h:531 ]: [ServerThr.1] Shutdown finished
broker_app_1  | [ N 2018-10-22 10:12:06.9465 29/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 471, application /home/app/pact_broker/public
broker_app_1  |
broker_app_1  | [ N 2018-10-22 10:12:07.3723 29/T4 age/Cor/CoreMain.cpp:589 ]: Signal received. Gracefully shutting down... (send signal 1 more time(s) to force shutdown)
broker_app_1  | [ N 2018-10-22 10:12:07.4707 29/T1 age/Cor/CoreMain.cpp:1150 ]: Passenger core shutdown finished
broker_app_1  | Oct 22 10:12:31 cf33b1761c91 syslog-ng[20]: syslog-ng starting up; version='3.5.6'
broker_app_1  | ok: run: /etc/service/nginx-log-forwarder: (pid 25) 0s
broker_app_1  | [ N 2018-10-22 10:12:32.2939 26/T1 age/Wat/WatchdogMain.cpp:1267 ]: Starting Passenger watchdog...
broker_app_1  | [ N 2018-10-22 10:12:32.3028 29/T1 age/Cor/CoreMain.cpp:1165 ]: Starting Passenger core...
broker_app_1  | [ N 2018-10-22 10:12:32.3029 29/T1 age/Cor/CoreMain.cpp:249 ]: Passenger core running in multi-application mode.
broker_app_1  | [ N 2018-10-22 10:12:32.3070 29/T1 age/Cor/CoreMain.cpp:905 ]: Passenger core online, PID 29
broker_app_1  | [ E 2018-10-22 10:12:34.4163 29/T8 age/Cor/SecurityUpdateChecker.h:376 ]: A security update is available for your version (5.1.11) of Passenger, we strongly recommend upgrading to version 5.3.5.
broker_app_1  | [ E 2018-10-22 10:12:34.4164 29/T8 age/Cor/SecurityUpdateChecker.h:381 ]:  Additional information:
broker_app_1  | - [Fixed in 5.3.2] [CVE-2018-12026, 12027, and 12028] These are local denial of service, local information disclosure and local privilege escalation vulnerabilities that could be exploited by malicious applications or malicious users on the system.
broker_app_1  | - [Fixed in 5.3.2] [CVE-2018-12029] A local privilege escalation vulnerability existed in the Nginx module that occurs when `passenger_instance_registry_dir` is configured to a directory with lax permissions.
broker_app_1  | App 45 stdout:
broker_app_1  | App 45 stderr:
broker_app_1  | App 45 stderr: Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see:
broker_app_1  | App 45 stderr:     https://github.com/rvm/rvm/issues/3212
broker_app_1  | App 45 stderr:
nginx_1       | 192.168.112.1 - - [22/Oct/2018:10:12:40 +0000] "GET / HTTP/1.1" 401 0 "-" "curl/7.58.0" "-"
broker_app_1  | App 471 stdout:

I also believe the postgres DB has never been migrated.

postgres_1    | 2018-10-22 10:19:13.310 UTC [55] ERROR:  relation "schema_migrations" does not exist at character 27
postgres_1    | 2018-10-22 10:19:13.310 UTC [55] STATEMENT:  SELECT NULL AS "nil" FROM "schema_migrations" LIMIT 1
postgres_1    | 2018-10-22 10:19:13.322 UTC [55] ERROR:  relation "schema_info" does not exist at character 27
postgres_1    | 2018-10-22 10:19:13.322 UTC [55] STATEMENT:  SELECT NULL AS "nil" FROM "schema_info" LIMIT 1

Edit:
If I'm using a sqlite db I get a similar issue, but more debug logs:

App 46 stdout:
broker_app_1  | App 46 stdout: E, [2018-10-22T10:49:26.215719 #46] ERROR -- : SQLite3::SQLException: no such table: schema_migrations: SELECT NULL AS 'nil' FROM `schema_migrations` LIMIT 1
broker_app_1  | App 46 stdout: E, [2018-10-22T10:49:26.221352 #46] ERROR -- : SQLite3::SQLException: no such table: schema_info: SELECT NULL AS 'nil' FROM `schema_info` LIMIT 1
broker_app_1  | App 46 stdout: E, [2018-10-22T10:49:26.319264 #46] ERROR -- : SQLite3::SQLException: no such table: tags_backup0: SELECT NULL AS 'nil' FROM `tags_backup0` LIMIT 1

Steps to reproduce

docker-compose up on the example docker-compose.

Relevent log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

Error when running test.sh

Hi guys, I'm trying to build pact-broker on docker, so, I have the postgres running in a container, as I understood, the next step was run the test.sh to create the pact-broker, right?

So, I runned, and it gave me that error:

Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/gems/url_mount-0.2.1.gem)
An error occurred while installing url_mount (0.2.1), and Bundler cannot
continue.
Make sure that `gem install url_mount -v '0.2.1'` succeeds before bundling.
The command '/bin/sh -c su app -c "cd $APP_HOME && bundle install --deployment --without='development test'"' returned a non-zero code: 5

It was during the execution of step: Step 11 : RUN su app -c "cd $APP_HOME && bundle install --deployment --without='development test'"

Could someone help me?

Errors when I build docker image

Gem::RemoteFetcher::FetchError: Errno::ECONNREFUSED: Connection refused - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/i18n-0.7.0.gem)
An error occurred while installing i18n (0.7.0), and Bundler cannot continue.
Make sure that `gem install i18n -v '0.7.0'` succeeds before bundling.
The command '/bin/sh -c su app -c "cd $APP_HOME && bundle install --deployment --without='development test'"' returned a non-zero code: 5

Webhook Execution Status not visible

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Confirmed this is the right place to raise the issue - issues for the Pact Broker application itself should be raised in the Pact Broker project.
  • Upgraded to the latest Pact Broker Docker image OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Expected behaviour

If I have created the webhook for a particular provider then all the pacts for that provider should have their updated web hook status.In this case if the webhook is created using API Browser-> pb:webhooks-> pb:create,then the webhook execution status is not present in the corresponding rows

Actual behaviour

I have created a webhook for a particular provider

{
"provider": {
"name": "providername"
},
"events": [{
"name": "contract_content_changed"
}],
"request": {

}
}

Now this webhook is supposed to run as and when any pacts with the provider name is being changed.
The webhook is running in the background and the last verified is getting updated,but the webhook status column shows create though there is a webhook created.
The webhook was created from API Browser-> pb:webhooks-> pb:create
If I create the webhook using Create(in the pact table in home) with the same payload,then the webhook run status is updated properly updated in corresponding row.

Error when starting pactbroker docker container

I have installed and configured the PostgresSQL DB in a Docker container (pactbroker-db) as per the instructions in POSTGRESQL.md and created the pactbroker Docker container (pactbroker) but when I come to start the pactbroker I receive the following error. Can you offer any advice?

$ docker start --attach pactbroker
*** Killing all processes...
Traceback (most recent call last):
File "/sbin/my_init", line 346, in
main(args)
File "/sbin/my_init", line 265, in main
export_envvars()
File "/sbin/my_init", line 88, in export_envvars
f.write(value)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-5: ordinal not in range(128)

Add docker-compose

  • Push pact-broker images to docker-hub.
  • Add docker-compose file to the repo for better setup.

Just thought this would make the setup easier and if we had official images pushed to docker-hub.

Need to bind to 0.0.0.0

See comment on the docker registry (copied below)

Running this image as is rejects any connections from outside the container:

$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ca0d88f95f15 dius/pact_broker:latest “/etc/service/app/ru 5 seconds ago Up 4 seconds 0.0.0.0:80->80/tcp pact-broker 9d159aa8409f postgres:9 ”/docker-entrypoint. 3 days ago Up 58 minutes 0.0.0.0:5432->5432/tcp pact-postgres

$ wget localhost:80 –2015-05-18 14:53:49– http://localhost/ Resolving localhost (localhost)… ::1, 127.0.0.1 Connecting to localhost (localhost)|::1|:80… connected. HTTP request sent, awaiting response… Read error (Connection reset by peer) in headers. Retrying.

However updating the CMD to listen on any address works:

FROM dius/pact_broker CMD /usr/local/bin/rackup -o 0.0.0.0 -p 80

$ wget localhost:80 –2015-05-18 14:56:37– http://localhost/ Resolving localhost (localhost)… ::1, 127.0.0.1 Connecting to localhost (localhost)|::1|:80… connected. HTTP request sent, awaiting response… 200 OK Length: 463 [application/hal+json] Saving to: ‘index.html’ ……..

LICENSE

Hi, could you add an open source license? like apache 2.0 for example.
thanks

Dockerfile does not work for OpenShift image ruby-23-rhel7

I'm trying to run pact_broker-docker on OpenShift for several days now, but I have to use the ruby-23-rhel7 image (or another OpenShift ruby image...). Of course that makes everything a bit more complicated.
Maybe it's possible for you to provide a Dockerfile for an OpenShift image (e.g. for ruby-23-rhel7)?
It seems I'm not talented enough to create one by my own.

Check if we need to upgrade the OS inside the container

From https://github.com/phusion/passenger-docker#upgrading-the-operating-system-inside-the-container

Upgrading the operating system inside the container

passenger-docker images contain an Ubuntu 16.04 operating system. You may want to update this OS from time to time, for example to pull in the latest security updates. OpenSSL is a notorious example. Vulnerabilities are discovered in OpenSSL on a regular basis, so you should keep OpenSSL up-to-date as much as you can.

While we release passenger-docker images with the latest OS updates from time to time, you do not have to rely on us. You can update the OS inside passenger-docker images yourself, and it is recommend that you do this instead of waiting for us.

To upgrade the OS in the image, run this in your Dockerfile:

RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.