Skip to content

System Configuration

**Referenced Files in This Document** - [[nacos/config.go]](file/bi-common/registry/nacos/config.go) - [[nacos/nacos-default.yaml]](file/bi-common/registry/nacos/nacos-default.yaml) - [[redisx/config.go]](file/bi-common/cache/redisx/config.go) - [[redisx/redisx-default.yaml]](file/bi-common/cache/redisx/redisx-default.yaml) - [[logger/setup.go]](file/bi-common/observability/logger/setup.go) - [[logger/options.go]](file/bi-common/observability/logger/options.go) - [[bi-sys/configs/application-dev.yaml]](file/bi-sys/configs/application-dev.yaml) - [[bi-sys/configs/application-prod.yaml]](file/bi-sys/configs/application-prod.yaml) - [[bi-sys/configs/application-test.yaml]](file/bi-sys/configs/application-test.yaml) - [[bi-template/configs/application-dev.yaml]](file/bi-template/configs/application-dev.yaml) - [[bi-template/configs/application-prod.yaml]](file/bi-template/configs/application-prod.yaml) - [[bi-template/configs/application-test.yaml]](file/bi-template/configs/application-test.yaml) - [[bi-basic/configs/application-dev.yaml]](file/bi-basic/configs/application-dev.yaml) - [[bi-basic/configs/application-prod.yaml]](file/bi-basic/configs/application-prod.yaml) - [[bi-basic/configs/application-test.yaml]](file/bi-basic/configs/application-test.yaml) - [[bi-api-jushuitan/configs/application-dev.yaml]](file/bi-api-jushuitan/configs/application-dev.yaml) - [[bi-api-jushuitan/configs/application-prod.yaml]](file/bi-api-jushuitan/configs/application-prod.yaml) - [[bi-api-jushuitan/configs/application-test.yaml]](file/bi-api-jushuitan/configs/application-test.yaml) - [[bi-api-leke/configs/application-dev.yaml]](file/bi-api-leke/configs/application-dev.yaml) - [[bi-api-leke/configs/application-prod.yaml]](file/bi-api-leke/configs/application-prod.yaml) - [[bi-api-leke/configs/application-test.yaml]](file/bi-api-leke/configs/application-test.yaml) - [[bi-chat-asktable/configs/nacos-config.yaml]](file/bi-chat-asktable/configs/nacos-config.yaml)

Table of Contents

  1. Introduction
  2. Project Structure
  3. Core Components
  4. Architecture Overview
  5. Detailed Component Analysis
  6. Dependency Analysis
  7. Performance Considerations
  8. Troubleshooting Guide
  9. Conclusion
  10. Appendices

Introduction

This document describes the System Configuration management within the Admin Panel and broader platform. It covers the configuration model, hierarchy, validation, and operational controls for:

  • Environment settings and feature toggles
  • Service discovery via registry (Nacos)
  • Logging, monitoring, and alerting configuration
  • Health checks and service registration
  • Deployment workflows, change management, and approvals

It also provides practical examples for enabling/disabling features, adjusting service limits, and modifying system behavior.

Project Structure

Configuration is organized around:

  • Environment-specific application YAML files per service
  • Registry configuration (Nacos) for service discovery and configuration center
  • Logging subsystem with structured JSON, file rotation, and optional cloud sink
  • Optional registry-backed configuration for specific services (e.g., AskTable chat)

Diagram sources

Section sources

Core Components

  • Nacos Registry and Configuration Center
    • Provides server endpoints, client identity, group, namespace, and advanced tuning
    • Supports single DataID or multiple DataIDs with merge semantics
    • Includes validation for host/port/timeout and defaults for safe operation
  • Redis Configuration
    • Supports single, sentinel, and cluster modes with connection pools, timeouts, TLS, and routing
    • Defaults for local development and tunable production parameters
  • Logging Subsystem
    • Structured JSON logging, file rotation, and optional Alibaba Cloud SLS sink
    • Global fields injection (service info, tracing IDs), lifecycle management, and cleanup
  • Environment Application YAMLs
    • Per-service environment files define runtime behavior, feature flags, and operational parameters
    • Admin Panel services include bi-sys, bi-template, bi-basic, bi-api-jushuitan, bi-api-leke

Section sources

Architecture Overview

The configuration architecture combines static environment YAMLs with dynamic registry-backed configuration and centralized logging.

Diagram sources

Detailed Component Analysis

Nacos Configuration Model

Nacos configuration supports:

  • Server endpoint scheme, address, HTTP and gRPC ports, context path
  • Client identity (namespace, group, app name), heartbeat, timeouts, logging, cache
  • Configuration center binding via single or multiple DataIDs
  • Authentication (username/password or access keys)
  • Advanced tuning (cache loading, snapshot usage, update threads)

Diagram sources

Key behaviors:

  • Default resolution: embedded YAML defaults plus automatic DataID derivation when none provided
  • Merge semantics: non-zero/empty overrides during merge
  • Validation: host, port, and timeout checks
  • Getter helpers for common fields

Section sources

Redis Configuration Model

Redis configuration supports:

  • Modes: single, sentinel, cluster
  • Addresses, credentials, database selection (single/sentinel)
  • Protocol, retries, sentinel master name, and cluster routing
  • Connection pool sizing, idle timeouts, and lifetime
  • Dial/read/write timeouts and TLS settings

Diagram sources

Defaults and cloning ensure safe initialization and isolation across services.

Section sources

Logging Configuration and Lifecycle

Logging supports:

  • Structured JSON output
  • File rotation (size, age, backups, daily rotation)
  • Optional Alibaba Cloud SLS sink
  • Global field injection (service info, tracing IDs)
  • Lifecycle management with cleanup and shutdown

Diagram sources

Operational parameters:

  • Output target (stdout or file)
  • Format (json)
  • Level (info by default)
  • File rotation parameters (when configured)
  • Optional SLS endpoint/project/logstore

Section sources

Environment Application YAMLs (Per-Service)

Each service maintains environment-specific YAML files that define:

  • Feature flags and toggles
  • Operational parameters (timeouts, limits, queues)
  • External integrations (Nacos, Redis, SLS)
  • Health check and readiness settings

Examples of typical fields (descriptive):

  • Feature toggles: enable/disable modules, A/B experiments
  • Limits: concurrency, batch sizes, queue depths
  • External endpoints: registry URL, Redis hosts, SLS credentials
  • Health: liveness/readiness probes, thresholds

These files are consumed by services at startup to configure runtime behavior.

Section sources

Registry-backed Configuration Example (AskTable)

Some services load configuration from Nacos DataID(s) using a dedicated configuration file. This enables centralized, dynamic updates without redeployment.

Diagram sources

Section sources

Dependency Analysis

  • Nacos configuration depends on:
    • Embedded default YAML for fallback
    • Validation utilities for host/port/timeout
    • Merge logic for layered overrides
  • Redis configuration depends on:
    • Embedded default YAML for fallback
    • Safe cloning to avoid shared mutable state
  • Logging subsystem depends on:
    • Protobuf-compatible config conversion
    • TracerProvider initialization
    • File rotation and optional SLS sink

Diagram sources

Section sources

Performance Considerations

  • Nacos
    • Tune update thread count and cache behavior for high-frequency updates
    • Prefer single DataID for simplicity; use multiple DataIDs for modular configuration
  • Redis
    • Adjust pool size and idle lifetimes according to workload concurrency
    • Enable TLS only when required; consider latency impact
  • Logging
    • Use JSON format for structured ingestion; enable file rotation to control disk usage
    • Avoid excessive global fields to reduce payload size

[No sources needed since this section provides general guidance]

Troubleshooting Guide

  • Nacos connectivity
    • Verify server address and ports; confirm context path alignment
    • Check authentication credentials and namespace/group
  • Validation failures
    • Host/Port/Timeout validation errors indicate misconfiguration
  • Logging issues
    • Ensure cleanup/shutdown are called to prevent resource leaks
    • Confirm SLS credentials and project/logstore when using cloud sink
  • Registry-backed config
    • Confirm DataID(s) exist and are readable by the service
    • Validate merge precedence and override behavior

Section sources

Conclusion

The System Configuration framework integrates static environment YAMLs with dynamic registry-backed configuration, robust logging, and validated infrastructure components. This combination provides a flexible, observable, and operable foundation for Admin Panel services across environments.

[No sources needed since this section summarizes without analyzing specific files]

Appendices

Configuration Hierarchy and Override Mechanisms

  • Static environment YAMLs provide baseline configuration per environment
  • Registry-backed configuration (Nacos) overlays and merges with static settings
  • Local defaults ensure safe operation when external configuration is unavailable
  • Validation ensures minimal correctness guarantees at startup

Section sources

Backup and Rollback Procedures

  • Backup
    • Snapshot Nacos DataID(s) and local environment YAMLs
    • Record current versions and timestamps
  • Rollback
    • Re-apply previous DataID snapshot or revert YAML to known-good commit
    • Validate service health and logs after rollback

[No sources needed since this section provides general guidance]

Health Checks and Service Discovery Settings

  • Heartbeat interval and timeout are configurable in Nacos client settings
  • Service registration and discovery are managed via Nacos registry
  • Logging and tracing support aid in diagnosing connectivity and latency

Section sources

Monitoring and Alerting Parameters

  • Logging level and output targets are configurable
  • Optional SLS sink enables centralized log aggregation and alerting
  • Tracing IDs are injected automatically for correlation

Section sources

Change Management and Approval Workflows

  • Proposed process outline:
    • Create/update DataID(s) in Nacos with proposed values
    • Tag and record the change with reviewers/approvers
    • Deploy new environment YAMLs if applicable
    • Validate in lower environments before production
    • Roll forward or roll back based on health and metrics

[No sources needed since this section provides general guidance]

Examples of Common Configuration Tasks

  • Enabling/disabling features
    • Modify feature toggle flags in environment YAMLs or Nacos DataIDs
    • Validate behavior and logs after rollout
  • Adjusting service limits
    • Update concurrency, timeouts, and queue depths in environment YAMLs
    • Reconfigure Redis pool and timeouts as needed
  • Modifying system behavior settings
    • Switch logging level and output targets
    • Configure SLS sink for centralized monitoring

[No sources needed since this section provides general guidance]