跳转到内容
RailWise KB已发布

TSM Platform Quick Deployment

Complete deployment guide for RAILWISE-TSM Total Station Automated Deformation Monitoring Platform using Docker Compose, environment configuration, service management, and initialization

复核 2026-07-09入门公开可引用RailWise 技术团队
learning-path

Estimated Reading Time: 25 minutes
Goal: Complete full-stack RAILWISE-TSM deployment locally or on server and verify total station connection


RAILWISE-TSM adopts a frontend-backend separation + edge computing architecture:

┌─────────────────────────────────────────────────────────────┐
│ User Layer │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Web Console │ │ WorkWise │ │ CLI Tool │ │
│ │ (Next.js) │ │ Desktop │ │ (Bun/TS) │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
└─────────┼─────────────────┼─────────────────┼───────────────┘
│ │ │
└─────────────────┼─────────────────┘
│ HTTPS / WebSocket
┌───────────────────────────┼─────────────────────────────────┐
│ API Gateway Layer │
│ ┌─────────────────────────┐ │
│ │ Nginx (Reverse Proxy)│ │
│ │ + SSL Termination │ │
│ └────────────┬────────────┘ │
└───────────────────────────┼─────────────────────────────────┘
┌───────────────────────────┼─────────────────────────────────┐
│ Application Layer (NestJS) │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ Monitoring │ │ Data │ │ Alert │ │
│ │ Scheduler │ │ Storage │ │ Engine │ │
│ └────────────┘ └────────────┘ └────────────┘ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ User Auth │ │ Report │ │ WebSocket │ │
│ │ Service │ │ Generator │ │ Push │ │
│ └────────────┘ └────────────┘ └────────────┘ │
└───────────────────────────┼─────────────────────────────────┘
┌───────────────────────────┼─────────────────────────────────┐
│ Data Storage Layer │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ PostgreSQL │ │ Redis │ │ MinIO │ │
│ │ (Main DB) │ │ (Cache/Q) │ │ (Object) │ │
│ └────────────┘ └────────────┘ └────────────┘ │
└───────────────────────────┼─────────────────────────────────┘
┌───────────────────────────┼─────────────────────────────────┐
│ Edge Computing (Rust/WASM) │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Total Station Gateway (TS-Gateway) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Leica │ │ Topcon │ │ Sokkia │ ... │ │
│ │ │ Driver │ │ Driver │ │ Driver │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ WASM Real-Time Compute Engine │ │ │
│ │ │ (Coord Transform / Adjustment / Deformation)│ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘

Environment CPU Memory Disk Network
Dev/Test 4 cores 8 GB 50 GB SSD 100 Mbps
Production (<50 stations) 8 cores 16 GB 200 GB SSD 1 Gbps
Production (50-200 stations) 16 cores 32 GB 500 GB SSD 1 Gbps
Production (200+ stations) 32+ cores 64+ GB 1 TB SSD 10 Gbps
Software Minimum Version Purpose
Docker 24.0+ Container runtime
Docker Compose 2.20+ Multi-service orchestration
Git 2.30+ Fetch deployment scripts

If Docker is not installed, refer to official documentation:


Terminal window
git clone https://github.com/railwise/tsm-deploy.git
cd tsm-deploy

Directory structure:

tsm-deploy/
├── docker-compose.yml # Main orchestration file
├── .env.example # Environment variable template
├── nginx/
│ ├── nginx.conf # Reverse proxy config
│ └── ssl/ # SSL certificate directory
├── init-scripts/
│ ├── init-db.sql # Database initialization
│ └── init-minio.sh # Object storage initialization
└── scripts/
├── start.sh # One-click start
├── stop.sh # One-click stop
└── backup.sh # Data backup
Terminal window
cp .env.example .env
nano .env # or vim / any editor

Core configuration items:

Terminal window
# ==========================================
# Basic Config
# ==========================================
COMPOSE_PROJECT_NAME=railwise-tsm
TZ=Asia/Shanghai
# ==========================================
# Database Config
# ==========================================
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=railwise_tsm
POSTGRES_USER=railwise
POSTGRES_PASSWORD=CHANGE_THIS_STRONG_PASSWORD
# ==========================================
# Redis Config
# ==========================================
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=CHANGE_THIS_REDIS_PASSWORD
# ==========================================
# MinIO Object Storage Config
# ==========================================
MINIO_ROOT_USER=railwise
MINIO_ROOT_PASSWORD=CHANGE_THIS_MINIO_PASSWORD
MINIO_BUCKET_NAME=tsm-data
# ==========================================
# API Service Config
# ==========================================
API_PORT=3000
API_JWT_SECRET=CHANGE_THIS_JWT_SECRET_32_CHAR_MIN
API_CORS_ORIGIN=https://tsm.yourdomain.com
# ==========================================
# Web Frontend Config
# ==========================================
WEB_PORT=3001
NEXT_PUBLIC_API_URL=https://tsm.yourdomain.com/api
# ==========================================
# Edge Gateway Config
# ==========================================
GATEWAY_PORT=50051
GATEWAY_LOG_LEVEL=info

For production environments, please change all default passwords, especially POSTGRES_PASSWORD, JWT_SECRET, and MINIO_ROOT_PASSWORD. Use random strings of 32+ characters.

Terminal window
chmod +x scripts/*.sh
./scripts/start.sh

start.sh execution flow:

  1. Check Docker and Docker Compose availability
  2. Load .env environment variables
  3. Create necessary local directories (data volumes, log directories)
  4. Pull latest images (first time) or build local images (dev mode)
  5. Start services in dependency order: PostgreSQL → Redis → MinIO → API → Web → Gateway
  6. Wait for health checks to pass
  7. Output access addresses and initial account info

Expected output:

[RailWise TSM] Starting...
✓ Docker version: 26.1.0
✓ Docker Compose version: 2.27.0
✓ Environment variables loaded
✓ Data directories created
✓ Images pulled
✓ PostgreSQL health check passed (3/3)
✓ Redis health check passed (3/3)
✓ MinIO health check passed (3/3)
✓ API service health check passed (5/5)
✓ Web service health check passed (5/5)
✓ Gateway service health check passed (5/5)
═══════════════════════════════════════════
RAILWISE-TSM Deployment Successful
═══════════════════════════════════════════
Web Console: http://localhost:3001
API Docs: http://localhost:3000/api/docs
MinIO Console: http://localhost:9001
Initial admin account:
Username: admin@railwise.cn
Password: RailWise@2025
Please log in immediately and change the default password!
═══════════════════════════════════════════

Open browser and visit http://localhost:3001, log in with initial account.

Terminal window
curl http://localhost:3000/api/health

Expected response:

{
"status": "ok",
"version": "2.3.1",
"timestamp": "2025-06-05T14:32:18+08:00",
"services": {
"database": "connected",
"redis": "connected",
"minio": "connected",
"gateway": "connected"
}
}

Operation Command Description
Start ./scripts/start.sh Start all services
Stop ./scripts/stop.sh Stop all services
Restart docker compose restart api Restart single service
View Logs docker compose logs -f api Real-time API logs
View All Logs docker compose logs -f Real-time all service logs
Enter Container docker compose exec api sh Enter API container for debugging
Data Backup ./scripts/backup.sh Backup database and object storage
Update Version ./scripts/update.sh Pull latest images and restart

Log in to Web Console → System Settings → Instrument Management → Add Instrument

Field Example Value Description
Instrument Name TS-16-001 Custom identifier
Brand/Model Leica TS16 Dropdown selection
Connection Type TCP/IP TCP / Serial / Bluetooth
IP Address 192.168.1.100 Total station network address
Port 8080 GeoCOM port
Station ID ZD01 Corresponding monitoring station
Coordinate System CGCS2000 Consistent with project

Click “Test Connection” button. Console will send GET_INSTRUMENT_NAME command to verify communication.


Place certificate files in nginx/ssl/ directory:

nginx/ssl/
├── tsm.yourdomain.com.crt
└── tsm.yourdomain.com.key

Edit nginx/nginx.conf to enable HTTPS listening.

Add cron job:

Terminal window
# Auto backup at 2:00 AM daily
0 2 * * * /opt/tsm-deploy/scripts/backup.sh >> /var/log/tsm-backup.log 2>&1



Last updated: 2025-06-05 | Version v1.0.0 | © Ningbo RailWise Engineering Technology Co., Ltd.