Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From Heroku Staging #43

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
57 changes: 57 additions & 0 deletions config/nginx.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
daemon off;
#Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;

events {
use epoll;
accept_mutex on;
worker_connections <%= ENV['NGINX_WORKER_CONNECTIONS'] || 1024 %>;
}

http {
gzip on;
gzip_comp_level 2;
gzip_min_length 512;

server_tokens off;

log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id';
access_log <%= ENV['NGINX_ACCESS_LOG_PATH'] || 'logs/nginx/access.log' %> l2met;
error_log <%= ENV['NGINX_ERROR_LOG_PATH'] || 'logs/nginx/error.log' %>;

include mime.types;
default_type application/octet-stream;
sendfile on;

#Must read the body in 5 seconds.
client_body_timeout 5;

upstream app_server {
server unix:/tmp/nginx.socket fail_timeout=0;
}

server {
listen <%= ENV['PORT'] %>;
server_name _;
keepalive_timeout 5;

add_header Strict-Transport-Security "max-age=31536000";
add_header Referrer-Policy "no-referrer, same-origin";

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}

<% if ENV['STATIC_PROXY'] %>
location /interactives/2019annualreport/static/ {
proxy_pass http://<%= ENV['STATIC_PROXY'] %>/interactives/2019annualreport/static/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
<% end %>
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@
"sass": "1.22.12",
"sass-lint": "1.13.1",
"sharp": "0.23.2",
"winston": "^3.2.1"
"winston": "3.2.1"
},
"engines": {
"node": "8.* || >= 10.*"
"node": "12.17.0",
"npm": "6.14.4"
}
}
7 changes: 7 additions & 0 deletions static.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"proxies": {
"/interactives/2019annualreport/static/": {
"origin": "https://${STATIC_PROXY}/"
}
}
}