Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatvig committed Aug 20, 2016
0 parents commit a7a4143
Show file tree
Hide file tree
Showing 17 changed files with 490 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# Linux trash folder which might appear on any partition or disk
.Trash-*

### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.1
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ruby:2.3.1

ENV APP_DIR /var/run
ENV LOG_DIR /var/log/pactbroker
ENV NGINX_DIR /etc/nginx
ENV PID_FILE /var/run/supervisord.pid

RUN mkdir -p $LOG_DIR && \
apt-get update && \
apt-get install -y supervisor nginx jq && \
rm -rf /var/lib/apt/lists/*

WORKDIR /var/run

COPY supervisord.conf $APP_DIR
COPY nginx.conf $NGINX_DIR
COPY proxy.conf $NGINX_DIR/conf.d

RUN rm $NGINX_DIR/sites-enabled/default

COPY pactbroker $APP_DIR/pactbroker

RUN cd $APP_DIR/pactbroker && \
gem install bundler && \
bundle install --deployment --without='development test'

EXPOSE 80

CMD ["supervisord", "-n"]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Pact Broker

#### Overview
This image run the [Pact Broker](https://github.com/bethesque/pact_broker) in a Docker Container.
To run the container, an instance of postgresql is required.

This uses Puma with Nginx and is inspired by the existing docker image for [Pact Broker](https://github.com/DiUS/pact_broker-docker)

#### How-to/usage
```bash
make run
```
27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '2'
services:
pact_broker:
build: .
hostname: broker
domainname: docker.local
environment:
PACT_BROKER_DATABASE_USERNAME: pactbroker
PACT_BROKER_DATABASE_PASSWORD: password
PACT_BROKER_DATABASE_HOST: db.docker.local
PACT_BROKER_DATABASE_NAME: pactbroker
ports:
- "80:80"
depends_on:
- db
links:
- db:db.docker.local
db:
image: postgres
hostname: db
domainname: docker.local
environment:
POSTGRES_PASSWORD: password
POSTGRES_USER: pactbroker
POSTGRES_DB: pactbroker
ports:
- "5432:5432"
28 changes: 28 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
OWNER=rajatvig
IMAGE_NAME=pactbroker
QNAME=$(OWNER)/$(IMAGE_NAME)

GIT_TAG=$(QNAME):$(CIRCLE_SHA1)
BUILD_TAG=$(QNAME):0.1.0-b$(CIRCLE_BUILD_NUM)
LATEST_TAG=$(QNAME):latest

build:
docker build -t $(GIT_TAG) .

lint:
docker run -it --rm -v "$(PWD)/Dockerfile:/Dockerfile:ro" redcoolbeans/dockerlint

tag:
docker tag $(GIT_TAG) $(BUILD_TAG)
docker tag $(GIT_TAG) $(LATEST_TAG)

run:
docker-compose up

login:
@docker login -u "$(DOCKER_USER)" -p "$(DOCKER_PASS)"

push: login
docker push $(GIT_TAG)
docker push $(BUILD_TAG)
docker push $(LATEST_TAG)
65 changes: 65 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
user www-data;
daemon off;
worker_processes auto;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##
log_format healthd '$msec"$uri"$status"$request_time"$upstream_response_time"$http_x_forwarded_for';

access_log /var/log/pactbroker/nginx_access.log;
error_log /var/log/pactbroker/nginx_error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
5 changes: 5 additions & 0 deletions pactbroker/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'pact_broker', '~> 1.9.3'
gem 'pg', '~> 0.18.4'
gem 'puma', '~> 3.6.0'
188 changes: 188 additions & 0 deletions pactbroker/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
GEM
remote: https://rubygems.org/
specs:
actionpack (4.2.7)
actionview (= 4.2.7)
activesupport (= 4.2.7)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.7)
activesupport (= 4.2.7)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activemodel (4.2.7)
activesupport (= 4.2.7)
builder (~> 3.1)
activesupport (4.2.7)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
as-notifications (1.0.1)
awesome_print (1.7.0)
blockenspiel (0.5.0)
builder (3.2.2)
diff-lcs (1.2.5)
disposable (0.0.9)
representable (~> 2.0)
uber
erubis (2.7.0)
find_a_port (1.0.1)
haml (4.0.7)
tilt
http_router (0.11.2)
rack (>= 1.0.0)
url_mount (~> 0.2.1)
httparty (0.14.0)
multi_xml (>= 0.5.2)
i18n (0.7.0)
json (1.8.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mini_portile2 (2.1.0)
minitest (5.9.0)
multi_json (1.12.1)
multi_xml (0.5.5)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
pact (1.9.3)
awesome_print (~> 1.1)
json
pact-mock_service (~> 0.8)
pact-support (~> 0.5.7)
rack-test (~> 0.6.2)
randexp (~> 0.1.7)
rspec (>= 2.14)
term-ansicolor (~> 1.0)
thor
webrick
pact-mock_service (0.10.1)
find_a_port (~> 1.0.1)
json
pact-support (~> 0.5.8)
rack
rack-test (~> 0.6.2)
rspec (>= 2.14)
term-ansicolor (~> 1.0)
thor
webrick
pact-support (0.5.9)
awesome_print (~> 1.1)
find_a_port (~> 1.0.1)
json
rack-test (~> 0.6.2)
randexp (~> 0.1.7)
rspec (>= 2.14)
term-ansicolor (~> 1.0)
thor
pact_broker (1.9.3)
haml
httparty
json
pact (~> 1.4)
pact-support (~> 0.4, >= 0.4.2)
padrino-core (~> 0.12.4)
rack
redcarpet (~> 3.1)
reform (~> 1.0)
roar (~> 1.0.0.beta2)
sequel (~> 4.23)
trailblazer (~> 0.1.0)
versionomy (~> 0.4)
webmachine (= 1.4.0)
padrino-core (0.12.4)
activesupport (>= 3.1)
http_router (~> 0.11.0)
padrino-support (= 0.12.4)
rack-protection (>= 1.5.0)
sinatra (~> 1.4.2)
thor (~> 0.18)
padrino-support (0.12.4)
activesupport (>= 3.1)
pg (0.18.4)
pkg-config (1.1.7)
puma (3.6.0)
rack (1.6.4)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
randexp (0.1.7)
redcarpet (3.3.4)
reform (1.2.6)
activemodel
disposable (~> 0.0.5)
representable (~> 2.1.0)
uber (~> 0.0.11)
representable (2.1.8)
multi_json
nokogiri
uber (~> 0.0.7)
roar (1.0.4)
representable (>= 2.0.1, < 2.4.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.1)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
sequel (4.36.0)
sinatra (1.4.2)
rack (~> 1.5, >= 1.5.2)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
term-ansicolor (1.3.2)
tins (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
tins (1.11.0)
trailblazer (0.1.2)
actionpack (>= 3.0.0)
reform (~> 1.2.0)
representable (>= 2.1.1, < 2.2.0)
uber (>= 0.0.10)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uber (0.0.15)
url_mount (0.2.1)
rack
versionomy (0.5.0)
blockenspiel (~> 0.5)
webmachine (1.4.0)
as-notifications (~> 1.0)
i18n (>= 0.4.0)
multi_json
webrick (1.3.1)

PLATFORMS
ruby

DEPENDENCIES
pact_broker (~> 1.9.3)
pg (~> 0.18.4)
puma (~> 3.6.0)

BUNDLED WITH
1.12.5
Loading

0 comments on commit a7a4143

Please sign in to comment.