Add the two runtime images and their compose file: `api` (Bun bundle, runs `prisma migrate deploy` before `bun run start`) and `web` (Vite build served by nginx, which proxies `/api/*` to the API and keeps the SSE streams unbuffered with a long read timeout). The database is external and both services join the `dokploy-network` for Traefik. Remove the GitHub Actions workflow: there is no hosted CI, so the verification scripts run locally.
48 lines
1.3 KiB
Nginx Configuration File
48 lines
1.3 KiB
Nginx Configuration File
# Serves the built SPA and proxies /api/* to the Bun API container.
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript application/json image/svg+xml;
|
|
|
|
# API proxy: no path rewrite, /api/* reaches the API as-is. `proxy_buffering
|
|
# off` and the long read timeout keep the SSE streams (/lists/:id/events)
|
|
# flowing in realtime instead of being batched or cut off.
|
|
location /api/ {
|
|
proxy_pass http://api:4100;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
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;
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 1h;
|
|
proxy_send_timeout 1h;
|
|
}
|
|
|
|
# PWA: hashed build output is safe to cache forever, the service worker and
|
|
# the app shell must always be revalidated so new releases reach clients.
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
location = /sw.js {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
# SPA fallback so deep links (/lists/:id, /invitations, ...) work on reload.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|