feat: 重构项目心跳数据结构并实现相关功能

- 重构Redis心跳数据结构,使用统一的项目列表键
- 新增数据迁移工具和API端点
- 更新前端以使用真实项目数据
- 添加系统部署配置和文档
- 修复代码格式和样式问题
This commit is contained in:
2026-01-15 14:14:10 +08:00
parent 282f7268ed
commit a8faa7dcaa
24 changed files with 307 additions and 560 deletions

View File

@@ -0,0 +1,21 @@
version: '3.8'
services:
app:
image: node:22-alpine
container_name: bls-project-console-app
working_dir: /app
volumes:
- /vol1/1000/Docker/nginx/project/bls/bls_project_console:/app
environment:
NODE_ENV: production
REDIS_HOST: 10.8.8.109
REDIS_PORT: 6379
REDIS_PASSWORD: ""
REDIS_DB: 0
HEARTBEAT_OFFLINE_THRESHOLD_MS: 10000
COMMAND_API_TIMEOUT_MS: 5000
command: ["node", "src/backend/server.js"]
restart: unless-stopped
ports:
- "3001:3001"

View File

@@ -0,0 +1,47 @@
# BLS Project Console - Nginx site (for nginx-in-docker)
#
# Place this file on SERVER:
# /vol1/1000/Docker/nginx/conf.d/bls_project_console.conf
#
# Assumptions (based on your Nginx project layout):
# - Host path /vol1/1000/Docker/nginx/sites is mounted into container as /var/www
# so this project static files should be copied to:
# /vol1/1000/Docker/nginx/sites/bls_project_console/
# and will be served from:
# /var/www/bls_project_console/
# - Backend runs on the HOST at 127.0.0.1:3001.
# Nginx container reaches host via host.docker.internal.
# On Linux you typically need in nginx docker-compose:
# extra_hosts:
# - "host.docker.internal:host-gateway"
server {
listen 80;
server_name blv-rd.tech;
root /var/www/bls_project_console;
index index.html;
# API reverse proxy
location /api/ {
proxy_pass http://host.docker.internal:3001;
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_connect_timeout 5s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
}
# SPA history mode
location / {
try_files $uri $uri/ /index.html;
}
access_log /var/log/nginx-custom/access.log;
error_log /var/log/nginx-custom/error.log warn;
}

View File

@@ -0,0 +1,23 @@
# Copy to: /etc/systemd/system/bls-project-console.service
# Then: systemctl daemon-reload && systemctl enable --now bls-project-console
[Unit]
Description=BLS Project Console (Node/Express)
After=network.target
[Service]
Type=simple
WorkingDirectory=/vol1/1000/Docker/nginx/project/bls/bls_project_console
# Use repo .env (copy .env.example -> .env)
EnvironmentFile=/vol1/1000/Docker/nginx/project/bls/bls_project_console/.env
Environment=NODE_ENV=production
# Node 22 is installed on host. If node path differs, replace /usr/bin/node.
ExecStart=/usr/bin/node src/backend/server.js
Restart=always
RestartSec=2
[Install]
WantedBy=multi-user.target