Skip to content

Commit

Permalink
add production config #128
Browse files Browse the repository at this point in the history
  • Loading branch information
WanderingStar committed Apr 3, 2017
1 parent 019c1fe commit 71e25a0
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 2 deletions.
5 changes: 5 additions & 0 deletions PRODUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To run in Production:

1. Make sure that the correct DB password appears in `production.env`

2. ```docker-compose -f production-compose.yml up -d```
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
version: '3'
services:
localdb:
build: localdb
build: docker/localdb
image: localdb
jupyter:
build: .
image: internal-displacement
command: sh -c "jupyter notebook --no-browser --ip=0.0.0.0 --port 3323 /internal-displacement/notebooks"
env_file: docker.env
stdin_open: true
tty: true
volumes:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx
RUN rm /etc/nginx/conf.d/default.conf
ADD conf.d/ /etc/nginx/conf.d
15 changes: 15 additions & 0 deletions docker/nginx/conf.d/node.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {

listen 80;
server_name internal-displacement.datafordemocracy.org;
access_log /var/log/nginx/node.access.log main;
charset utf-8;

location / {
proxy_pass http://nodejs:3322;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}
32 changes: 32 additions & 0 deletions docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


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

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}
30 changes: 30 additions & 0 deletions production-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
services:
jupyter:
build: .
image: internal-displacement
command: sh -c "jupyter notebook --no-browser --ip=0.0.0.0 --port 3323 /internal-displacement/notebooks"
stdin_open: true
tty: true
volumes:
- .:/internal-displacement
ports:
- "3323:3323"
env_file: production.env
nodejs:
build: internal-displacement-web
image: internal-displacement-web
volumes:
- ./internal-displacement-web/src:/internal-displacement-web/src
- ./internal-displacement-web/package.json:/internal-displacement-web/package.json
- ./internal-displacement-web/index.html:/internal-displacement-web/index.html
ports:
- "3322:3322"
env_file: production.env
nginx:
build: docker/nginx
image: nginx
ports:
- "80:80"
depends_on:
- nodejs
6 changes: 6 additions & 0 deletions production.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DB_HOST=internal-displacement.cf1y5y4ffeey.us-west-2.rds.amazonaws.com
DB_USER=d4d
DB_PASS=
DB_NAME=id
PYTHONPATH=/internal-displacement
NODE_ENV=production

0 comments on commit 71e25a0

Please sign in to comment.