Smart Site
Home Docs Smart Data System Management

System Management

The System module covers global configuration, base service lifecycle, system information, and health checks. It is the operational cockpit for administrators.

Interface Screenshot

System Management - Settings (English UI)

Captured from the live Smart Site system with the English UI. See the zh-CN counterpart for the Chinese-UI screenshot.

1. System Configuration

Configuration is stored as key-value pairs in the system_configs table and exposed through SystemConfigService:

const value = await configService.get('alarm.notification.email.enabled')
await configService.set('alarm.notification.email.enabled', true)

1.1 Environment Variable Priority

SystemConfigService.get() resolves a key in this order:

  1. process.env[key] — environment variables always win
  2. system_configs table — persisted DB value
  3. Hardcoded default

This means an environment variable override takes effect without touching the database, which is useful for containerized deployments.

1.2 Common Config Keys

Key Purpose
PROJECTS_DIR Root directory for project DBs
PROJECT_DB_MODE isolated or shared
alarm.notification.email.enabled Toggle email notifications
alarm.escalation.tier1.minutes Delay before tier-1 escalation
collector.pool.size Default connection pool size
websocket.offline.cache.size Max buffered messages per room

1.3 Config Watcher

ConfigWatcherService watches JSON config files on disk and reloads them at runtime, so editing a config file does not require a restart. Changes are broadcast via the config.changed EventBus topic and pushed to subscribed frontends.

2. Base Service Management

Smart SCADA ships with bundled base services under ss-run/ss/base_services/:

  • InfluxDB 2.7 — time-series database
  • Redis — optional cache / pub-sub adapter

The System → Base Services page lets an administrator:

Action Description
Start Launch the service via its .bat script
Stop Stop the running service
Configure Edit the service's config file (e.g. config.yaml)
View Logs Tail the service log file

Useful scripts:

  • influxdb2-2.7.8/iot-influxdb.bat — start InfluxDB
  • influxdb2-2.7.8/backup.bat — back up buckets
  • redis/startup.bat — start Redis

3. System Information

The System → Settings → System Info page shows:

  • Application version (from generate-build-info.cjs)
  • Node.js and OS versions
  • Uptime
  • Memory and CPU usage
  • Loaded module list
  • Database file paths

This is the first place to look when reporting a support issue.

4. Health Check

The HealthCheckerService exposes:

  • GET /api/v1/health — overall status (up / degraded / down)
  • Per-component checks: SQLite, InfluxDB, Redis (if configured), collectors

A component is degraded if it is reachable but slow or partially failing; down if unreachable. The frontend status banner uses this endpoint to warn operators.

5. Operational Guidance

5.1 Changing the Listening Port

The backend port is controlled by PORT in .env.dev (default 4000):

PORT=4000

After changing it, update the frontend Vite proxy (VITE_API_BASE_URL) and the WebSocket URL (VITE_WS_URL) to match.

5.2 Restarting cleanly

# Stop the backend
.\ss-run\ss\services\ss-node\stop-service.bat

# Start the backend
.\ss-run\ss\services\ss-node\start.bat

5.3 Inspecting Logs

Logs are written by StructuredLogger to the console and to rolling log files. Each entry includes a correlation ID, timestamp, level, and context. Filter by deviceId or module for faster triage.

6. FAQ

Q: A config change is not taking effect. A: Environment variables override DB config. Check .env for a variable with the same key. For file-based config, confirm ConfigWatcherService is running and editing the watched file path.

Q: The health check reports InfluxDB down. A: Confirm InfluxDB is started (iot-influxdb.bat) and the URL/token in projectinfo.json or system config are correct. Check the InfluxDB log file for startup errors.

Q: How do I change the admin password? A: Use System → Users → Admin → Reset Password, or POST /api/v1/auth/change-password from the user's own session. The password must pass the validation rules in password-validation.util.ts.

Q: Base services will not start on Windows. A: Run the .bat files as Administrator the first time, and ensure the ports (8086, 6379) are not already in use. Check the service's readme.txt for prerequisites.