mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-09-16 12:02:35 +00:00
Splits the monolithic app container into: - backend: Node.js handling MQTT, WebSocket, API, DB (no static files) - app: Nginx serving the React SPA, proxying /api and /ws to backend This means future dashboards (app.ukmesh.com etc.) can be added as additional Nginx containers pointing at the same backend with no duplicate calculations or DB connections. Also updates nginx.website.conf to proxy to backend instead of app, and bumps website host port from 3001 to 3002 to avoid conflict. NOTE: Cloudflare Zero Trust tunnel route for app.teessidemesh.com must be updated from http://app:3000 to http://app:80. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
30 lines
785 B
Plaintext
30 lines
785 B
Plaintext
server {
|
|
listen 80;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# WebSocket upgrade — must come before the /api block
|
|
location /ws {
|
|
proxy_pass http://backend:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_read_timeout 3600s;
|
|
}
|
|
|
|
# API and health check proxy to backend
|
|
location ~ ^/(api|healthz)(/|$) {
|
|
proxy_pass http://backend:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
|
|
# SPA fallback
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|