Skip to content
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
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_PROD_NGINX_PORT=8081
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ COPY . .
RUN npm run build

FROM nginx:1.24.0-alpine AS production
COPY nginx.conf /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/templates/default.conf.template
COPY --from=builder /app/build /usr/share/nginx/html
EXPOSE 80
EXPOSE 8081
6 changes: 4 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ services:
context: .
dockerfile: Dockerfile
ports:
- 8000:80
- 8081:8081
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "http://127.0.0.1:80/healthz"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "http://127.0.0.1:8081/healthz"]
restart: unless-stopped
environment:
- API_PORT=8080
98 changes: 51 additions & 47 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,56 +1,60 @@
events {}
http {
include mime.types;
server_tokens off;

server_tokens off;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server {
listen 8081;
server_name localhost;
charset utf-8;
root /usr/share/nginx/html;
index index.html;
autoindex off;

server {
listen 80;
server_name localhost;
charset utf-8;
root /usr/share/nginx/html;
index index.html;
autoindex off;
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
set_real_ip_from 192.168.0.0/16;
real_ip_header X-Real-IP;

set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
set_real_ip_from 192.168.0.0/16;
real_ip_header X-Real-IP;
location / {
try_files $uri $uri/ =404;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/javascript
text/x-js
text/xml
application/json
application/x-javascript
application/javascript
application/xml
application/xml+rss
image/svg+xml;
gzip_buffers 16 8k;
add_header Cache-Control public;
}

location / {
try_files $uri $uri/ =404;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/javascript
text/x-js
text/xml
application/json
application/x-javascript
application/javascript
application/xml
application/xml+rss
image/svg+xml;
gzip_buffers 16 8k;
add_header Cache-Control public;
}
location /api/ {
proxy_pass http://${API_ADDR}/api/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

location = /healthz {
add_header 'Content-Type' 'text/plain';
return 200 'Ok';
}
location = /healthz {
add_header 'Content-Type' 'text/plain';
return 200 'Ok';
}

location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
}
3 changes: 0 additions & 3 deletions public/env.js

This file was deleted.

1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet">
<title>eUPF API UI</title>
<script src="%PUBLIC_URL%/env.js"></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const getEmptyChartMeasurementsArray = () => {
const updateTime = 1000

function App() {
const apiPort = process.env.NODE_ENV === 'development' ? process.env.REACT_APP_DEV_API_PORT : window.env.API_PORT
const apiPort = process.env.NODE_ENV === 'development' ? process.env.REACT_APP_DEV_API_PORT : process.env.REACT_APP_PROD_NGINX_PORT
const { height, width } = useWindowDimensions();

// Trackers to maintain responsive design.
Expand Down