feat: 异步解析大文件WPS报备资料
This commit is contained in:
@@ -206,7 +206,7 @@ SQL
|
||||
|
||||
write_env() {
|
||||
log "Writing production environment"
|
||||
mkdir -p /etc/cmpp-platform "$APP_DIR" "$APP_DIR/logs/api" "$APP_DIR/logs/send-worker" "$APP_DIR/logs/gateway" "$APP_DIR/backups" "$OBJECT_STORAGE_LOCAL_ROOT"
|
||||
mkdir -p /etc/cmpp-platform "$APP_DIR" "$APP_DIR/logs/api" "$APP_DIR/logs/send-worker" "$APP_DIR/logs/report-material-worker" "$APP_DIR/logs/gateway" "$APP_DIR/backups" "$OBJECT_STORAGE_LOCAL_ROOT"
|
||||
cat >/etc/cmpp-platform/cmpp-platform.env <<EOF
|
||||
NODE_ENV=production
|
||||
API_PORT=${API_PORT}
|
||||
@@ -332,6 +332,27 @@ RestartSec=5
|
||||
StandardOutput=append:${APP_DIR}/logs/send-worker/stdout.log
|
||||
StandardError=append:${APP_DIR}/logs/send-worker/stderr.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat >/etc/systemd/system/cmpp-report-material-worker.service <<EOF
|
||||
[Unit]
|
||||
Description=CMPP report material workbook analysis worker
|
||||
After=network.target postgresql.service cmpp-minio.service
|
||||
|
||||
[Service]
|
||||
User=cmpp-api
|
||||
Group=cmpp-security
|
||||
WorkingDirectory=${APP_DIR}/api
|
||||
EnvironmentFile=/etc/cmpp-platform/cmpp-platform.env
|
||||
Environment=CMPP_PROCESS_ROLE=report-material-worker
|
||||
ExecStart=${node_bin} dist/report-material-analysis-worker.js
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=append:${APP_DIR}/logs/report-material-worker/stdout.log
|
||||
StandardError=append:${APP_DIR}/logs/report-material-worker/stderr.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
@@ -129,7 +129,7 @@ PROD_ADMIN_CREDENTIAL_FILE="$ADMIN_CREDENTIAL_FILE" node tools/deploy/ensure-pro
|
||||
chmod 600 "$ADMIN_CREDENTIAL_FILE" || true
|
||||
|
||||
echo "[deploy] Ensuring runtime log directories"
|
||||
install -d -m 0755 "$APP_DIR/logs/api" "$APP_DIR/logs/send-worker" "$APP_DIR/logs/submit-outbox" "$APP_DIR/logs/gateway-callback" "$APP_DIR/logs/protocol-log-worker" "$APP_DIR/logs/gateway"
|
||||
install -d -m 0755 "$APP_DIR/logs/api" "$APP_DIR/logs/send-worker" "$APP_DIR/logs/report-material-worker" "$APP_DIR/logs/submit-outbox" "$APP_DIR/logs/gateway-callback" "$APP_DIR/logs/protocol-log-worker" "$APP_DIR/logs/gateway"
|
||||
|
||||
echo "[deploy] Installing split API and send-worker services"
|
||||
node_bin="$(command -v node)"
|
||||
@@ -155,6 +155,26 @@ RestartSec=5
|
||||
StandardOutput=append:$APP_DIR/logs/send-worker/stdout.log
|
||||
StandardError=append:$APP_DIR/logs/send-worker/stderr.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
cat >/etc/systemd/system/cmpp-report-material-worker.service <<EOF
|
||||
[Unit]
|
||||
Description=CMPP report material workbook analysis worker
|
||||
After=network.target postgresql.service cmpp-minio.service
|
||||
|
||||
[Service]
|
||||
User=cmpp-api
|
||||
Group=cmpp-security
|
||||
WorkingDirectory=$APP_DIR/api
|
||||
EnvironmentFile=$ENV_FILE
|
||||
Environment=CMPP_PROCESS_ROLE=report-material-worker
|
||||
ExecStart=$node_bin dist/report-material-analysis-worker.js
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=append:$APP_DIR/logs/report-material-worker/stdout.log
|
||||
StandardError=append:$APP_DIR/logs/report-material-worker/stderr.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
@@ -243,11 +263,11 @@ echo "[deploy] Restarting services"
|
||||
systemctl daemon-reload
|
||||
if [[ "${OBJECT_STORAGE_DRIVER:-minio}" == "local" ]]; then
|
||||
systemctl disable --now cmpp-minio 2>/dev/null || true
|
||||
systemctl enable --now cmpp-api cmpp-send-worker cmpp-gateway nginx
|
||||
systemctl enable --now cmpp-api cmpp-send-worker cmpp-report-material-worker cmpp-gateway nginx
|
||||
else
|
||||
systemctl enable --now cmpp-minio
|
||||
systemctl restart cmpp-minio
|
||||
systemctl enable --now cmpp-api cmpp-send-worker cmpp-gateway nginx
|
||||
systemctl enable --now cmpp-api cmpp-send-worker cmpp-report-material-worker cmpp-gateway nginx
|
||||
fi
|
||||
systemctl restart cmpp-security-agent
|
||||
if [[ "${SEND_SUBMIT_OUTBOX_SEPARATE_PROCESS_ENABLED:-false}" == "true" ]]; then
|
||||
@@ -273,6 +293,7 @@ fi
|
||||
systemctl restart cmpp-gateway
|
||||
systemctl restart cmpp-api
|
||||
systemctl restart cmpp-send-worker
|
||||
systemctl restart cmpp-report-material-worker
|
||||
systemctl restart nginx
|
||||
|
||||
echo "[deploy] Health checks"
|
||||
@@ -292,6 +313,7 @@ wait_for_http() {
|
||||
}
|
||||
wait_for_http "API" "http://127.0.0.1:${API_PORT:-3000}/api/health"
|
||||
wait_for_http "Send worker metrics" "http://127.0.0.1:${API_WORKER_METRICS_PORT:-9465}/metrics"
|
||||
systemctl is-active --quiet cmpp-report-material-worker
|
||||
if [[ "${SEND_SUBMIT_OUTBOX_SEPARATE_PROCESS_ENABLED:-false}" == "true" ]]; then
|
||||
wait_for_http "Submit Outbox metrics" "http://127.0.0.1:${API_OUTBOX_METRICS_PORT:-9467}/metrics"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user