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

Add Additional Senty context and timings #2304

Open
wants to merge 2 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
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"grecaptcha": true,
"onRecaptchaLoad": true,
"assert": true,
"R": true
"R": true,
"Sentry": true
},
"rules": {
"import/no-amd": "off",
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ src/config/discovery.vars.js
!.gitmodules

test/test_manual.html

# Sentry Config File
.sentryclirc
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ $ git submodule update --init
# install assets
$ npm install -g grunt-cli
$ npm install
$ grunt setup

# start the server
$ ./server
$ npm run dev
```

You should then be able to access the application locally at `http://localhost:8000`.
Expand All @@ -35,10 +34,10 @@ Create a `src/config/discovery.vars.js` file, based on `discovery.vars.js.defaul
#### Building

```bash
$ grunt release
$ npm run release
# full build will be in dist/ directory
# point the dev server to there:
$ ./server dist
$ npm start
```

### Testing
Expand All @@ -49,10 +48,10 @@ During testing, you can add `debugger` statements and use mocha's `only` to isol

```bash
# Run everything
$ grunt test
$ npm run test

# Run with puppeteer window open
$ grunt test:debug
$ npm run test:debug
```

### Documentation
Expand Down
1 change: 1 addition & 0 deletions grunt/uglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
module.exports = {
release: {
options: {
sourceMap: true,
mangle: true,
compress: {
sequences: true,
Expand Down
172 changes: 0 additions & 172 deletions nginx.conf

This file was deleted.

9 changes: 9 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM nginx:latest
EXPOSE 80

RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log

RUN echo "load_module modules/ngx_http_subs_filter_module.so;" > /etc/nginx/modules/subs-filter.conf

CMD ["nginx"]
19 changes: 19 additions & 0 deletions nginx/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
nginx:
container_name: bbb-nginx
build:
context: .
dockerfile: ./Dockerfile
args:
ENABLE_MODULES: 'subs-filter'
ports:
- "8000:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./default.conf:/etc/nginx/templates/default.conf.template:ro
- ${APP_DIR:-../dist}:/app/production:ro
environment:
ENVIRONMENT: "${ENV:-production}"
NGINX_ENTRYPOINT_QUIET_LOGS: 1
healthcheck:
test: 'curl --fail http://localhost:8000/ready || exit 1'
60 changes: 60 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
server {
listen 80;
server_name localhost;

# Root location with CORS and ENV variable for scripts
location / {
add_header 'Access-Control-Allow-Origin' "http://localhost:8000" always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type';

root /app/production;
index index.html;

# Inject environment variable as a script tag in the HTML
sub_filter '</head>' '<script>window.ENV="${ENVIRONMENT}";</script></head>';
sub_filter_once on;

include /etc/nginx/mime.types;
expires 6M;

# Prevent caching of specific files
location ^~ /discovery.config {
expires 0;
add_header Cache-Control "public";
}

location ^~ /index {
expires 0;
add_header Cache-Control "public";
}
}

# Additional paths with CORS headers
location ~ ^/(search|abs|user|index|feedback|execute-query|public-libraries|classic-form|paper-form)/ {
root /app/production;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;

add_header 'Access-Control-Allow-Origin' "http://localhost:8000" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Content-Type';

# Inject environment variable as a script tag in the HTML
sub_filter '</head>' '<script>window.ENV="${ENVIRONMENT}";</script></head>';
sub_filter_once on;
}

# Health check endpoints
location /ready {
access_log off;
return 200 "{\"ready\": true}";
}

location /alive {
access_log off;
return 200 "{\"alive\": true}";
}
}
32 changes: 32 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
daemon off;
worker_processes auto;
worker_rlimit_nofile 10000;
user nobody nogroup;
pid /tmp/nginx.pid;

events {
worker_connections 2048;
accept_mutex off;
use epoll;
}

http {
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 500;

log_format main '{"remote_addr": "$remote_addr","X-Original-Forwarded-For": "$proxy_add_x_forwarded_for","X-Forwarded-For": "$remote_user","time_local": "$time_local","request": "$request","status": "$status","body_bytes_sent": "$body_bytes_sent","http_referer": "$http_referer","http_user_agent": "$http_user_agent","request_length": "$request_length","Authorization": "$http_Authorization","url-path": "$document_uri","query-string": "$query_string","X-Original-Uri": "$request_uri" ,"http_cookie": "$http_cookie","X-Amzn-Trace-Id": "$http_x_amzn_trace_id"}';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;

include conf.d/default.conf;
}
Loading
Loading