Skip to content

Commit

Permalink
Merge a6330f2 into 806f60f
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhenry committed Feb 2, 2016
2 parents 806f60f + a6330f2 commit 4451c04
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 59 deletions.
1 change: 1 addition & 0 deletions Vagrantfile
Expand Up @@ -10,6 +10,7 @@ Vagrant.configure(2) do |config|
# webserver
config.vm.network "forwarded_port", guest: 80, host: 80
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 8081, host: 8081
# postgres
config.vm.network "forwarded_port", guest: 5432, host: 5432
# elastic search
Expand Down
5 changes: 5 additions & 0 deletions api/docker/Dockerfile
@@ -0,0 +1,5 @@
FROM spira/docker-nginx-php:latest

MAINTAINER "Zak Henry" <zak.henry@gmail.com>

ADD . /data
33 changes: 33 additions & 0 deletions api/docker/config/vhosts/spira-api.conf
@@ -0,0 +1,33 @@
server {
client_max_body_size 20M;
listen 8080;

root /data/public;
index index.php index.html index.htm;

access_log /var/log/nginx/access-api.log;
error_log /var/log/nginx/error-api.log warn;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

# location /api/ {
# proxy_pass http://127.0.0.1:8080/;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-for $remote_addr;
# port_in_redirect off;
# proxy_connect_timeout 300;
# }

location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass fastgci_backend;
fastcgi_param SCRIPT_FILENAME $request_filename;
}

location ~ /\.ht {
deny all;
}
}
5 changes: 5 additions & 0 deletions app/docker/Dockerfile
@@ -0,0 +1,5 @@
FROM spira/docker-nginx-php:latest

MAINTAINER "Zak Henry" <zak.henry@gmail.com>

ADD . /data
40 changes: 40 additions & 0 deletions app/docker/config/vhosts/spira-app.conf
@@ -0,0 +1,40 @@
server {
client_max_body_size 20M;
listen 8081;

# rewrite ^/forum(/.*)$ http://%HOSTNAME_FORUM%$1 permanent;


access_log /var/log/nginx/access-app.log;
error_log /var/log/nginx/error-app.log warn;

# allow the source files to be read by the browser for sourcemapping
location /data/src {
root /;
try_files $uri $uri/ =404;
}

location /data/bower_components {
root /;
try_files $uri $uri/ =404;
}

location / {
root /data/build;
index index.html;
try_files $uri $uri/ /index.html =404;
}

# location /auth/social/ {
# proxy_pass http://127.0.0.1:8080/auth/social/;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-for $remote_addr;
# port_in_redirect off;
# proxy_connect_timeout 300;
# }

location ~ /\.ht {
deny all;
}
}
99 changes: 49 additions & 50 deletions docker-compose.yml
@@ -1,19 +1,23 @@

data:
lbhaproxy:
extends:
file: ./docker/common-services.yml
service: datavolume
service: lbhaproxy
links:
- api
- app
- mailcatcher
env_file:
- ./docker/.local.env

logviewer:
extends:
file: ./docker/common-services.yml
service: logviewer
volumes_from:
- data
env_file:
- ./docker/.local.env
#logviewer:
# extends:
# file: ./docker/common-services.yml
# service: logviewer
# volumes_from:
# - data
# env_file:
# - ./docker/.local.env

database:
extends:
Expand All @@ -34,21 +38,21 @@ vanilladatabase:
- ./docker/.local.env

cache:
ports:
- "6379:6379"
extends:
file: ./docker/common-services.yml
service: cache
ports:
- "6379:6379"
env_file:
- ./docker/.local.env

elasticsearch:
ports:
- "9200:9200"
- "9300:9300"
extends:
file: ./docker/common-services.yml
service: elasticsearch
ports:
- "9200:9200"
- "9300:9300"
env_file:
- ./docker/.local.env

Expand All @@ -59,73 +63,68 @@ queue:
env_file:
- ./docker/.local.env

queuerunner:
api:
extends:
file: ./docker/common-services.yml
service: queuerunner
service: api
links:
- mailcatcher:mailcatcher
- queue:queue
- cache:cache
- database:database
- web:web
volumes_from:
- data
- mailcatcher
- queue
- cache
- database
env_file:
- ./docker/.local.env
environment:
- VIRTUAL_HOST=local.api.spira.io, local.spira.io/api/*
- NGINX_VHOSTS=/data/docker/config/vhosts/*.conf
- EXCLUDE_PORTS=9000

mailcatcher:
app:
extends:
file: ./docker/common-services.yml
service: mailcatcher
service: app
env_file:
- ./docker/.local.env
environment:
- VIRTUAL_HOST=local.spira.io
- NGINX_VHOSTS=/data/docker/config/vhosts/*.conf
- EXCLUDE_PORTS=9000

php:
queuerunner:
extends:
file: ./docker/common-services.yml
service: php
service: queuerunner
links:
- database:database
- vanilladatabase:vanilladatabase
- cache:cache
- queue:queue
- mailcatcher:mailcatcher
- elasticsearch:elasticsearch
- mailcatcher
- queue
- cache
- database
volumes_from:
- data
- api
env_file:
- ./docker/.local.env

web:
mailcatcher:
extends:
file: ./docker/common-services.yml
service: web
ports:
- "80:80"
- "8080:8080"
links:
- php:php
- logviewer:logviewer
- mailcatcher:mailcatcher
volumes_from:
- data
env_file: ./docker/.local.env
service: mailcatcher
env_file:
- ./docker/.local.env
environment:
- VIRTUAL_HOST=local.mailcatcher.spira.io
- EXCLUDE_PORTS=1025

devtools:
extends:
file: ./docker/common-services.yml
service: devtools
links:
- web:web
- mailcatcher:mailcatcher
- database:database
- vanilladatabase:vanilladatabase
- cache:cache
- queue:queue
- elasticsearch:elasticsearch
volumes_from:
- data
volumes:
- /cache:/cache
env_file:
Expand Down
6 changes: 5 additions & 1 deletion docker/.local.env
Expand Up @@ -52,4 +52,8 @@ MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=api@local.api.spira.io
MAIL_FROM_NAME=Local Spira API
MAIL_FROM_NAME=Local Spira API

#haproxy
MODE=tcp
STATS_AUTH=spira:password
51 changes: 44 additions & 7 deletions docker/common-services.yml
@@ -1,14 +1,23 @@
# This common-services.yml definition holds all the image definitions and environment linking for the images.
# It is intended to use the docker-compose extends functionality to use these definitions to build a docker-compose file

lbhaproxy:
image: 'tutum/haproxy:0.2.4.1'
environment:
- MODE=tcp
- 'STATS_AUTH=spira:'
ports:
- '80:80'
- '1936:1936'

datavolume:
image: spira/docker-data
volumes:
- /data:/data
privileged: true

logviewer:
image: spira/docker-clarity
#logviewer:
# image: spira/docker-clarity

database:
image: postgres:9.4
Expand Down Expand Up @@ -41,20 +50,48 @@ php:
- .secret.env
privileged: true

web:
image: spira/docker-nginx
#web:
# image: spira/docker-nginx
# expose:
# - "80"
# - "8080"
# - "8008"
# env_file:
# - .common.env
# privileged: true

api:
image: spira/docker-nginx-php
env_file:
- .common.env
- .secret.env
volumes:
- ../api:/data
expose:
- "80"
- "8080"
- "8008"
- "8080"
ports:
- "8080:8080"
privileged: true

app:
image: spira/docker-nginx-php
env_file:
- .common.env
- .secret.env
volumes:
- ../app:/data
expose:
- "8081"
ports:
- "8081:8081"
privileged: true

devtools:
image: spira/docker-dev-tools
working_dir: /data
privileged: true
volumes:
- ../:/data
env_file:
- .common.env
- .secret.env
Expand Down
1 change: 0 additions & 1 deletion vhosts/nginx/dev/spira-app.conf
@@ -1,7 +1,6 @@
server {
client_max_body_size 20M;
listen 80;
server_name %HOSTNAME_BASE%;
server_name %HOSTNAME_APP%;

rewrite ^/forum(/.*)$ http://%HOSTNAME_FORUM%$1 permanent;
Expand Down

0 comments on commit 4451c04

Please sign in to comment.