diff --git a/docker-compose.yml b/docker-compose.yml index 18c7682..cae165b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ -version: '3' +version: "3" services: - postgres: image: postgres healthcheck: @@ -15,22 +14,27 @@ services: broker_app: image: dius/pact-broker - ports: - - "80:80" links: - postgres + # If you remove nginx, enable the following + #ports: + # - "80:80" environment: PACT_BROKER_DATABASE_USERNAME: postgres PACT_BROKER_DATABASE_PASSWORD: password PACT_BROKER_DATABASE_HOST: postgres PACT_BROKER_DATABASE_NAME: postgres + # Nginx is not necessary, but demonstrates how + # one might use a reverse proxy in front of the broker, + # and includes the use of a self-signed TLS certificate nginx: image: nginx:alpine links: - broker_app:broker volumes: - - ./ssl/nginx.conf:/etc/nginx/conf.d/default.conf:ro - - ./ssl:/etc/nginx/ssl + - ./ssl/nginx.conf:/etc/nginx/conf.d/default.conf:ro + - ./ssl:/etc/nginx/ssl ports: - - "8443:443" + - "8443:443" + - "80:80" diff --git a/ssl/nginx.conf b/ssl/nginx.conf index 83eea6c..83f5a21 100644 --- a/ssl/nginx.conf +++ b/ssl/nginx.conf @@ -19,3 +19,14 @@ server { proxy_set_header X-Real-IP $remote_addr; } } + +server { + listen 80 default_server; + server_name localhost; + + location / { + proxy_pass http://broker:80; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } +}