Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

Deployment #92

Merged
merged 4 commits into from
Jun 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions lib/cli/deployment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@

FROM ubuntu:14.04

RUN sudo add-apt-repository ppa:chris-lea/node.js
RUN sudo apt-get update
RUN sudo apt-get install nodejs
RUN sudo apt-get install npm
RUN sudo apt-get update

ADD . /anvil
RUN cd /anvil; npm install
RUN sudo apt-get install -y curl build-essential python
RUN curl -sL https://deb.nodesource.com/setup_dev | sudo bash -
RUN sudo apt-get install -y nodejs

EXPOSE 8080
COPY package.json /tmp/package.json
RUN cd /tmp && npm install

CMD ["NODE_ENV=production", "node", "/anvil/server.js"]
COPY . /opt/anvil
WORKDIR /opt/anvil

RUN rm -rf ./node_modules && cp -a /tmp/node_modules ./

RUN npm install

EXPOSE 3000

CMD ["node", "server.js"]
11 changes: 11 additions & 0 deletions lib/cli/deployment/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
web0:
image: "[YOUR IMAGE URL HERE]"
command: node server.js
environment:
- SERVICE_NAME=web0
- NODE_ENV=production
volumes:
- [CONFIG_DIR_PATH_ON_HOST]:/opt/anvil/config:ro
- [TEMP_DIR_PATH_ON_HOST]:/opt/anvil/tmp/
ports:
- "5200:3000"
58 changes: 58 additions & 0 deletions lib/cli/deployment/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
upstream anvil {
server 127.0.0.1:5200;
# ... add other IP:PORT combinations here if desired
}


# Sets redirect up for all port-80 requests
# Denying/requiring SSL
server {
listen *:80;
server_name [YOUR_HOSTNAME_HERE];
rewrite ^ https://$server_name$request_uri? redirect;
}

server {
listen *:443;
server_name [YOUR_HOSTNAME_HERE];

# Set up SSL
ssl on;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_certificate [PATH_TO_CRT_FILE];
ssl_certificate_key [PATH_TO_KEY_FILE];

# Settings to avoid SSL warnings in browser
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE
ssl_prefer_server_ciphers on;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";



# Logging
access_log /var/log/nginx/anvil.access.log main; # could also put these into 1 file
error_log /var/log/nginx/anvil.error.log main;

# Allow empty bodies
client_max_body_size 0;


location / {
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# untested, but taken from https://gist.github.com/nikmartin/5902176#file-nginx-ssl-conf-L25
# and seems useful
proxy_set_header X-NginX-Proxy true;
proxy_read_timeout 5m;
proxy_connect_timeout 5m;

proxy_pass http://anvil;
proxy_redirect off;
}
}