ci: 完善 CI/CD 流程,添加实际生产部署工作流

This commit is contained in:
2026-07-17 22:18:34 +08:00
parent ffd9b0c8f0
commit 3ca87aa159
5 changed files with 272 additions and 8 deletions

61
frontend/nginx.prod.conf Normal file
View File

@@ -0,0 +1,61 @@
server {
listen 80;
server_name _;
# Allow large uploads (e.g. videos)
client_max_body_size 300m;
root /usr/share/nginx/html;
index index.html;
# SSE notification stream — must disable buffering for real-time push
location /notification/ {
proxy_pass http://backend:8080;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_buffering off;
proxy_cache off;
proxy_set_header Host $http_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_read_timeout 3600s;
proxy_send_timeout 3600s;
}
# Health check
location /healthz {
proxy_pass http://backend:8080;
proxy_http_version 1.1;
proxy_set_header Host $http_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;
}
# SPA routing (Vue Router history mode)
location / {
try_files $uri $uri/ /index.html;
}
# Reverse proxy to backend (strip /api prefix)
location /api/ {
proxy_pass http://backend:8080/;
proxy_http_version 1.1;
proxy_set_header Host $http_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;
}
# Serve uploaded files via backend static route
location /static/ {
proxy_pass http://backend:8080/static/;
proxy_http_version 1.1;
proxy_set_header Host $http_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;
}
}