Files
trunk-server/nginx-proxy/test/vhosts/site.template
Luke Berndt 6825aaf9a4 Reduce backend per-upload CPU to relieve upload timeouts
The Node main thread was saturated at about 39 uploads/s, overflowing the
listen queue so uploads timed out connecting from nginx.

- Enable keepAlive on the S3 agent; every upload did a full TLS handshake
- Remove OpenTelemetry tracing
- Cache the system key lookup for 60s
- Use lean queries when listing calls
- Serialize each call once in notify_clients, not per recipient
- Add an nginx upstream keepalive pool, and hold Node's keepAliveTimeout
  above it so nginx never reuses a connection Node has closed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 18:06:48 -05:00

115 lines
2.3 KiB
Plaintext

# Only send "Connection: upgrade" for real WebSocket requests, so ordinary
# requests can reuse the upstream keepalive pool.
map $http_upgrade $backend_connection {
default upgrade;
'' '';
}
upstream backend_api {
server backend:3005;
keepalive 64;
keepalive_timeout 60s;
}
server {
listen 80;
server_name ${DOMAIN_NAME} www.${DOMAIN_NAME};
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location /static {
proxy_pass http://frontend:3000;
access_log off;
}
location /favicon.ico {
proxy_pass http://frontend:3000;
expires 1M;
add_header Surrogate-Control "public, max-age=604800";
add_header Cache-Control "max-age=604800, public";
access_log /dev/stdout main;
}
location ~* \.(gif|jpg|png)$ {
proxy_pass http://frontend:3000;
add_header Pragma public;
add_header Surrogate-Control "public, max-age=604800";
add_header Cache-Control "max-age=604800, public";
expires 1M;
}
location /silence.m4a {
proxy_pass http://frontend:3000;
access_log /dev/stdout main;
add_header Surrogate-Control "public, max-age=604800";
add_header Cache-Control "max-age=604800, public";
expires 1M;
}
location / {
proxy_pass http://frontend:3000;
include /etc/nginx/proxy.conf;
access_log /dev/stdout main;
}
}
server {
listen 80;
server_name account.${DOMAIN_NAME};
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
proxy_pass http://account:3009;
include /etc/nginx/proxy.conf;
access_log off;
}
}
server {
listen 80;
server_name admin.${DOMAIN_NAME};
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
proxy_pass http://admin:3008;
include /etc/nginx/proxy.conf;
access_log off;
}
}
server {
listen 80;
server_name api.${DOMAIN_NAME};
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
proxy_pass http://backend_api;
include /etc/nginx/proxy.conf;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $backend_connection;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
access_log /dev/stdout main;
}
}