GoWindGoWind
Home
Framework
GoWind Toolkit
  • Open Source

    • GoWind Admin (Admin Platform)
    • GoWind CMS (Content Management)
    • GoWind UBA (Behavior Analytics)
    • GoWind Shop (E-commerce)
    • GoWind Kanban (Kanban Boards)
    • GoWind Ledger (Personal Finance)
    • GoWind ShortPlay (Short Drama)
    • GoWind Ops (Operations Platform)
    • RushWind (Rust Ecosystem)
  • Open Core (Community + Enterprise)

    • GoWind OA (Office Collaboration)
    • GoWind ERP (Procure-to-Pay)
    • GoWind WMS (Warehousing)
  • Commercial

    • GoWind IM (Instant Messaging)
    • GoWind IoT (IoT Platform)
    • GoWind Edu (AI Education)
    • GoWind MES (Manufacturing Execution)
    • GoWind CDC (Data Pipeline)
    • GoWind SDP (Zero-Trust Gateway)
    • GoWind Quant (Quant Research)
    • GoWind Trade Radar (Export Sourcing)
    • GoWind Game Radar (Game Greenlight)
  • 简体中文
  • English
GitHub
Home
Framework
GoWind Toolkit
  • Open Source

    • GoWind Admin (Admin Platform)
    • GoWind CMS (Content Management)
    • GoWind UBA (Behavior Analytics)
    • GoWind Shop (E-commerce)
    • GoWind Kanban (Kanban Boards)
    • GoWind Ledger (Personal Finance)
    • GoWind ShortPlay (Short Drama)
    • GoWind Ops (Operations Platform)
    • RushWind (Rust Ecosystem)
  • Open Core (Community + Enterprise)

    • GoWind OA (Office Collaboration)
    • GoWind ERP (Procure-to-Pay)
    • GoWind WMS (Warehousing)
  • Commercial

    • GoWind IM (Instant Messaging)
    • GoWind IoT (IoT Platform)
    • GoWind Edu (AI Education)
    • GoWind MES (Manufacturing Execution)
    • GoWind CDC (Data Pipeline)
    • GoWind SDP (Zero-Trust Gateway)
    • GoWind Quant (Quant Research)
    • GoWind Trade Radar (Export Sourcing)
    • GoWind Game Radar (Game Greenlight)
  • 简体中文
  • English
GitHub
  • Introduction

    • GoWind UBA Product Introduction
  • Architecture Reference

    • UBA System Architecture
    • UBA Backend Module Overview
    • UBA Backend API Contract
    • UBA Frontend Architecture
  • Developer Guide

    • UBA Installation Guide
    • UBA Code Generation Pipeline Tutorial
    • Adding an External Service Tutorial
    • Adding a Business Entity Tutorial
    • Adding a Frontend Page Tutorial
  • Operations Guide

    • UBA Docker Deployment Guide
    • UBA Configuration Reference & Security Checklist
    • UBA PM2 Deployment Guide
    • UBA Superset BI Deployment Guide
  • Analyst Guide

    • Data Analyst Getting Started Guide
    • Basic Aggregation

      • Event Trend Analysis
      • Active Users Analysis
      • Group By Aggregation
    • Conversion & Paths

      • Funnel Analysis
      • Retention Analysis
      • Top Conversion Paths
      • Behavior Sequence Analysis
    • User Depth

      • Attribution Analysis
      • Distribution Analysis
      • User Segmentation
      • Click Heatmap
      • Interval Analysis
    • Lifecycle

      • User Lifecycle
      • Churn & Reactivation Analysis
      • New vs Returning Users
      • Matrix Quadrant Analysis
    • Revenue & Value

      • Revenue Analysis
      • Whale Tier (Payer Segmentation)
      • Historical LTV Analysis
    • Sessions & Anomalies

      • Session Analysis
      • Period-over-Period Comparison and Anomaly Detection
    • Gaming

      • Level Analysis (Game)
      • Server Retention (Game)
      • Online Stats Analysis (Game)
      • Economy Analysis (Game)
    • OLAP Cookbook
  • SDK Integration

    • Web SDK Integration Guide
    • C# SDK Integration Guide (Unity / Godot / .NET)
  • Appendix

    • UBA Appendix: Ports, Glossary, Known Limitations & FAQ

UBA PM2 Deployment Guide

This document is aimed at operations engineers, describing the process of deploying the three GoWind UBA services on bare metal/virtual machines with PM2 (scripts/deploy/pm2_service.sh). Suitable for scenarios without Docker or requiring PM2 process management.

Read System Architecture and the Configuration Reference first. In PM2 mode, the middleware (PG/Redis/Kafka/Doris/Etcd/MinIO/Jaeger) must be prepared by yourself.


1. PM2 Deployment Script Overview

Script: backend/scripts/deploy/pm2_service.sh

Workflow:

Key Behaviors

  • Reads .env (project root, automatically strips CRLF and exports), taking PROJECT_NAME from it (default gwua).
  • Compiles: make build_only (compile only, no code generation).
  • Installation root: ~/$PROJECT_NAME/ (default ~/gwua/).
  • Service discovery: iterates over the first-level subdirectories of app/ (i.e. admin, collector, core).
  • Distribution: copies <svc>/service/bin/server to ~/gwua/<svc>/service/bin/server, and the *.yaml configs to ~/gwua/<svc>/service/configs/.
  • PM2 registration: process name ${PROJECT_NAME}-${svc}, namespace $PROJECT_NAME; runs pm2 delete before starting to replace old instances, and finishes with pm2 save.

2. Process Naming

ServiceProcess nameNamespace
Admingwua-admingwua
Collectorgwua-collectorgwua
Coregwua-coregwua

No ecosystem.config.js is used — PM2 is driven entirely by CLI flags inside the script (--name, --namespace, --cwd, --output, --error, --update-env). Each process has its own stdout/stderr logs.


3. Running the Deployment

cd backend

# 1. Prepare .env (project root)
cat > .env <<'EOF'
PROJECT_NAME=gwua
# add other environment variables as needed
EOF

# 2. One-click PM2 deployment (the script runs make build_only first)
make pm2-deploy
# or directly: ./scripts/deploy/pm2_service.sh

After deployment completes, check with:

pm2 list                    # view the status of the three processes
pm2 logs gwua-core          # view core logs
pm2 monit                   # live monitoring

The services start with the argument -c <configs relative path>, i.e. loading ../configs/*.yaml from the bin directory.


4. Prerequisites (bring your own middleware)

The PM2 mode only manages the three application services; the middleware must be deployed by yourself (bare metal or separate containers both work):

MiddlewarePurposeDefault address
PostgreSQLBusiness/config entitiesdata.yaml's database.dsn
RedisCache + Asynq queueredis:6379
KafkaEvent bufferingcollector data.yaml's kafka.endpoints
Apache Doris (or ClickHouse)OLAP analytics enginecore data.yaml
EtcdService discoveryregistry.yaml
MinIOObject storageoss.yaml
JaegerDistributed tracing (optional)trace.yaml

Before deployment, make sure each service's data.yaml / registry.yaml / oss.yaml point to real addresses.


5. Configuration Center (etcd export)

The project supports exporting configuration to etcd (make export, powered by cfgexp under the hood):

cd backend
make export   # cfgexp --type=etcd --addr=localhost:2379 --proj=$PROJECT_NAME

Combined with kratos's hot config reload, some configuration can be updated without restarting processes.


6. Daily Operations

pm2 restart gwua-core        # restart a single service
pm2 reload gwua-admin        # zero-downtime reload (if supported)
pm2 stop gwua-collector      # stop
pm2 delete gwua-core         # delete
pm2 save                     # persist the process list (prerequisite for start on boot)
pm2 startup                  # configure start on boot (run the command it prints)

Log Locations

PM2 logs are by default in ~/.pm2/logs/:

  • gwua-admin-out.log / gwua-admin-error.log
  • gwua-collector-out.log / gwua-collector-error.log
  • gwua-core-out.log / gwua-core-error.log

7. Updating Releases

cd backend
git pull                     # pull the latest code
make build_only              # recompile
./scripts/deploy/pm2_service.sh   # redistribute and restart (the script runs pm2 delete before starting)

Script deployment is "replacement-style": every run deletes the old instances with pm2 delete before starting new ones, with no blue-green/canary releases. For canary deployments, Docker multi-instance + etcd discovery is recommended instead.


8. Related Documentation

  • System Architecture
  • Docker Deployment
  • Configuration Reference
  • Appendix · Port Reference
Edit this page
Last Updated:: 11/3/26, 2:14 PM
Contributors: Bobo
Prev
UBA Configuration Reference & Security Checklist
Next
UBA Superset BI Deployment Guide