Skip to content

Commit

Permalink
Separated virtual hosts into production and dev, added tutum.staging.…
Browse files Browse the repository at this point in the history
…yml file.
  • Loading branch information
zakhenry committed Aug 26, 2015
1 parent d901fd3 commit c9988c4
Show file tree
Hide file tree
Showing 13 changed files with 239 additions and 1 deletion.
1 change: 0 additions & 1 deletion docker/.common.env
@@ -1,5 +1,4 @@
API_PATH=/api
NGINX_VHOSTS=vhosts/nginx/*.conf
APIB_PATH=/data/api/storage/app/apiary.apib
DATA_ROOT=/data
COOKIE_DOMAIN=spira.io
4 changes: 4 additions & 0 deletions docker/.local.env
@@ -1,3 +1,7 @@
# Local environment ENV vars

NGINX_VHOSTS=vhosts/nginx/dev/*.conf

HOSTNAME_BASE=local.spira.io
HOSTNAME_APP=local.app.spira.io
HOSTNAME_API=local.api.spira.io
Expand Down
4 changes: 4 additions & 0 deletions docker/.qa.env
@@ -1,3 +1,7 @@
# QA environment ENV vars

NGINX_VHOSTS=vhosts/nginx/dev/*.conf

# these hosts will likely be rewritten for the relevant QA merge id details
API_HOST=http://qa.api.spira.io:8080
APP_HOST=http://qa.app.spira.io
Expand Down
124 changes: 124 additions & 0 deletions docker/tutum.staging.yml
@@ -0,0 +1,124 @@
spira:
image: tutum.co/iqsadmin/spira:production
deployment_strategy: high_availability
ports:
- "80"
tags:
- staging
volumes:
- /data

cache:
image: redis:3.0.3
tags:
- staging

php:
image: spira/docker-hhvm:latest
environment:
- APIB_PATH=/data/api/storage/app/apiary.apib
- API_HOST=http://api.staging.iqstech.net:8080
- APP_HOST=http://app.staging.iqstech.net
- API_PATH=/api
- COOKIE_DOMAIN=spira.io
- DATA_ROOT=/data
- HOSTNAME_API=api.staging.iqstech.net
- HOSTNAME_APP=app.staging.iqstech.net
- HOSTNAME_BASE=staging.iqstech.net
- HOSTNAME_FORUM=forum.staging.iqstech.net
- HOSTNAME_LOGS=logs.staging.iqstech.net
- HOSTNAME_MAILCATCHER=mailcatcher.staging.iqstech.net

This comment has been minimized.

Copy link
@roshangn88

roshangn88 Aug 26, 2015

Contributor

Do we need mailcather and logs URLs?
Same question applies to queuerunner

- MYSQL_DATABASE=spira_vanilla
- MYSQL_PASSWORD=spira_vanilla
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=spira_vanilla
- POSTGRES_DB=spira
- POSTGRES_PASSWORD=spira
- POSTGRES_USER=spira
- PROVIDER_FACEBOOK_CLIENT_ID=1677556862475688
- PROVIDER_FACEBOOK_CLIENT_SECRET=c14de8480fbf8925fa9ab3ad1a59c6cd
- PROVIDER_GOOGLE_CLIENT_ID=1055178154133-3u2un47dahaghli65uh727uff2co5cbi.apps.googleusercontent.com
- PROVIDER_GOOGLE_CLIENT_SECRET=5Fp3qjVzqIuaJVh9_lR9Q-Mq
- PROVIDER_TWITTER_CLIENT_ID=false
- PROVIDER_TWITTER_CLIENT_SECRET=false
- VANILLA_JSCONNECT_CLIENT_ID=a-client-id-random-string
- VANILLA_JSCONNECT_SECRET=a-secret-phrase-random-string
- VANILLA_SERVER_PORT=80
- XDEBUG_ENABLED=false
links:
- cache
- mailcatcher

This comment has been minimized.

Copy link
@roshangn88

roshangn88 Aug 26, 2015

Contributor

mailcatcher link is not required since mailcatcher container is removed.

- queue
privileged: true
tags:
- staging
volumes_from:
- spira

queue:
image: spira/docker-beanstalkd:latest
tags:
- staging

queuerunner:
image: spira/docker-artisan-queue-runner:latest
environment:
- APIB_PATH=/data/api/storage/app/apiary.apib
- API_HOST=http://api.staging.iqstech.net:8080
- APP_HOST=http://app.staging.iqstech.net
- API_PATH=/api
- COOKIE_DOMAIN=spira.io
- DATA_ROOT=/data
- HOSTNAME_API=api.staging.iqstech.net
- HOSTNAME_APP=app.staging.iqstech.net
- HOSTNAME_BASE=staging.iqstech.net
- HOSTNAME_FORUM=forum.staging.iqstech.net
- HOSTNAME_LOGS=logs.staging.iqstech.net
- HOSTNAME_MAILCATCHER=mailcatcher.staging.iqstech.net
- MYSQL_DATABASE=spira_vanilla
- MYSQL_PASSWORD=spira_vanilla
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=spira_vanilla
- POSTGRES_DB=spira
- POSTGRES_PASSWORD=spira
- POSTGRES_USER=spira
- PROVIDER_FACEBOOK_CLIENT_ID=1677556862475688
- PROVIDER_FACEBOOK_CLIENT_SECRET=c14de8480fbf8925fa9ab3ad1a59c6cd
- PROVIDER_GOOGLE_CLIENT_ID=1055178154133-3u2un47dahaghli65uh727uff2co5cbi.apps.googleusercontent.com
- PROVIDER_GOOGLE_CLIENT_SECRET=5Fp3qjVzqIuaJVh9_lR9Q-Mq
- PROVIDER_TWITTER_CLIENT_ID=false
- PROVIDER_TWITTER_CLIENT_SECRET=false
- VANILLA_JSCONNECT_CLIENT_ID=a-client-id-random-string
- VANILLA_JSCONNECT_SECRET=a-secret-phrase-random-string
- VANILLA_SERVER_PORT=80
- XDEBUG_ENABLED=false
links:
- cache
- queue
- web
tags:
- staging
volumes_from:
- spira

web:
image: spira/docker-nginx:latest
environment:
- DATA_ROOT=/data
- HOSTNAME_API=api.staging.iqstech.net
- HOSTNAME_APP=app.staging.iqstech.net
- HOSTNAME_BASE=staging.iqstech.net
- HOSTNAME_FORUM=forum.staging.iqstech.net
- NGINX_VHOSTS=vhosts/nginx/production/*.conf
links:
- apimock
- logviewer
- mailcatcher

This comment has been minimized.

Copy link
@roshangn88

roshangn88 Aug 26, 2015

Contributor

apimock, logviewer and mailcatcher links needs to be removed.

- php
ports:
- "80:80"
privileged: true
tags:
- staging
volumes_from:
- spira
4 changes: 4 additions & 0 deletions vhosts/nginx/README.md
@@ -0,0 +1,4 @@
# Virtual Hosts
Ensure when you add a feature to a vhost that you check the other folders if they need to have the config added there
too. In general they will be identical, but there are some distinct differences between production and dev such as
production doesn't have the api mock proxy pass, and none of the dev vhosts.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions vhosts/nginx/production/spira-api.conf
@@ -0,0 +1,25 @@
server {
client_max_body_size 20M;
listen 8080;
server_name %HOSTNAME_API%;

root %data-root%/api/public;
index index.php index.html index.htm;

access_log %data-root%/logs/access-api.log;
error_log %data-root%/logs/error-api.log warn;

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

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

location ~ /\.ht {
deny all;
}
}
48 changes: 48 additions & 0 deletions vhosts/nginx/production/spira-app.conf
@@ -0,0 +1,48 @@
server {
client_max_body_size 20M;
listen 80;
server_name %HOSTNAME_BASE%;
server_name %HOSTNAME_APP%;

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

access_log %data-root%/logs/access-app.log;
error_log %data-root%/logs/error-app.log warn;

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

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

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_redirect http://127.0.0.1:8080 /api;
proxy_connect_timeout 300;
}

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_redirect http://127.0.0.1:8080 /api;
proxy_connect_timeout 300;
}


location ~ /\.ht {
deny all;
}
}
30 changes: 30 additions & 0 deletions vhosts/nginx/production/spira-forum.conf
@@ -0,0 +1,30 @@
server {
client_max_body_size 20M;
listen 80;
listen 8008;
server_name %HOSTNAME_FORUM%;

root %data-root%/forum/public;
index index.php index.html index.htm;

access_log %data-root%/logs/access-forum.log;
error_log %data-root%/logs/error-forum.log warn;

location / {
try_files $uri $uri/ @forum;
}

location @forum {
rewrite ^/(.+)$ /index.php?p=$1 last;
}

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

location ~ /\.ht {
deny all;
}
}

0 comments on commit c9988c4

Please sign in to comment.