Skip to content

Commit

Permalink
feat(example): simplify docker-compose
Browse files Browse the repository at this point in the history
For the purposes of showcasing an example, the previous `docker-compose`
was rather excessive running the Pact Broker behind a Nginx proxy with a
PostgreSQL backend. This simplifies the containers to just use the core
Pact broker image and uses `sqlite` for the database.

This commit also drops SSL/TLS from the example as it does not
meaningfully contribute to the example.

Signed-off-by: JP-Ellis <[email protected]>
  • Loading branch information
JP-Ellis committed Sep 27, 2023
1 parent 7c60dd5 commit 8ee2eb0
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 132 deletions.
61 changes: 0 additions & 61 deletions examples/broker/docker-compose.yml

This file was deleted.

21 changes: 0 additions & 21 deletions examples/broker/ssl/nginx-selfsigned.crt

This file was deleted.

27 changes: 0 additions & 27 deletions examples/broker/ssl/nginx-selfsigned.key

This file was deleted.

23 changes: 0 additions & 23 deletions examples/broker/ssl/nginx.conf

This file was deleted.

42 changes: 42 additions & 0 deletions examples/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: "3.9"

services:
postgres:
image: postgres
ports:
- "5432:5432"
healthcheck:
test: psql postgres -U postgres --command 'SELECT 1'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres

broker:
image: pactfoundation/pact-broker:latest-multi
depends_on:
- postgres
ports:
- "9292:9292"
environment:
# Basic auth credentials for the Broker
PACT_BROKER_ALLOW_PUBLIC_READ: "true"
PACT_BROKER_BASIC_AUTH_USERNAME: pactbroker
PACT_BROKER_BASIC_AUTH_PASSWORD: pactbroker
# Database
PACT_BROKER_DATABASE_URL: "postgres://postgres:postgres@postgres/postgres"
# PACT_BROKER_DATABASE_URL: sqlite:////tmp/pact_broker.sqlite # Pending pact-foundation/pact-broker-docker#148

healthcheck:
test:
[
"CMD",
"curl",
"--silent",
"--show-error",
"--fail",
"http://pactbroker:pactbroker@localhost:9292/diagnostic/status/heartbeat",
]
interval: 1s
timeout: 2s
retries: 5

0 comments on commit 8ee2eb0

Please sign in to comment.