Skip to content

Commit

Permalink
added broker + postgres as docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
ollin committed Mar 12, 2017
1 parent 5c5e920 commit bcc0e96
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
4 changes: 4 additions & 0 deletions broker/db/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM postgres:9.5.3
MAINTAINER Oliver Nautsch
ADD db-dump.sql /
ADD docker-entrypoint-initdb.d/*.sh /docker-entrypoint-initdb.d/
28 changes: 28 additions & 0 deletions broker/db/db-dump.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
SET default_transaction_read_only = off;

SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;

--
-- Drop databases
--
DROP DATABASE IF EXISTS broker;

--
-- Drop roles
--
DROP ROLE IF EXISTS broker;

--
-- Roles
--
CREATE ROLE broker;
ALTER ROLE broker WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN NOREPLICATION NOBYPASSRLS PASSWORD 'md50890f0db0b9da90a6dab40d41dff1f59'; -- pw: broker123

--
-- Database creation
--
CREATE DATABASE broker WITH TEMPLATE = template0 OWNER = broker;
GRANT ALL ON DATABASE broker TO broker;


5 changes: 5 additions & 0 deletions broker/db/docker-entrypoint-initdb.d/01-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

psql --username "$POSTGRES_USER" -f /db-dump.sql

55 changes: 55 additions & 0 deletions broker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '2'

volumes:
db-data:

networks:
nautsch.net:

services:
nginxedge:
image: jwilder/nginx-proxy
container_name: nginx-edge
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./nginxedge/my_proxy.conf:/etc/nginx/conf.d/my_proxy.conf:ro"
networks:
nautsch.net:
restart: always
broker:
image: dius/pact_broker
container_name: broker
environment:
- PACT_BROKER_DATABASE_USERNAME=broker
- PACT_BROKER_DATABASE_PASSWORD=broker123
- PACT_BROKER_DATABASE_HOST=db.nautsch.net
- PACT_BROKER_DATABASE_NAME=broker
- VIRTUAL_HOST=broker.nautsch.net
- VIRTUAL_PORT=80
networks:
nautsch.net:
aliases:
- broker.nautsch.net
links:
- db
db:
build:
context: ./db
container_name: db
hostname: db
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=admin123
- POSTGRES_USER=admin
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- db-data:/var/lib/postgresql/data/pgdata
networks:
nautsch.net:
aliases:
- db.nautsch.net
restart: always
2 changes: 2 additions & 0 deletions broker/nginxedge/my_proxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server_tokens off;
client_max_body_size 0;

0 comments on commit bcc0e96

Please sign in to comment.