CB‐Spider Server Configuration - cloud-barista/cb-spider GitHub Wiki

CB-Spider Server Configuration

Language: English | 한국어

How to Configure the CB-Spider Server


• Configures CB-Spider server access methods, passwords, and other settings.
• In most cases, only setting SPIDER_PASSWORD is sufficient for local operation.
  • Configuration Information

    Environment Variables Descriptions Default
    CBSPIDER_ROOT Set the root path of the installed CB-Spider package Automatically set to the location of the setup.env file
    SERVER_ADDRESS Set the server address and port. cf) CB-Spider Service Address Configuration Not set (localhost, no external access)
    SERVICE_ADDRESS Set the service access address and port (only required for dual-network environments, etc.). cf) CB-Spider Service Address Configuration Not set (localhost, no external access)
    PLUGIN_SW Option for dynamically adding and linking cloud infrastructure drivers. When set to ON, dynamically registers and manages drivers built as shared libraries. PLUGIN_SW=OFF
    ID_TRANSFORM_MODE Option to set whether to perform ID transformation when creating resources. When set to OFF, requests the ID entered by the user to the CSP without converting it to UUID format (When set to OFF, the user must consider CSP-specific naming restrictions). cf) ID Transform ON/OFF Guide ID_TRANSFORM_MODE=ON
    CBLOG_ROOT Set the root path of cb-log for log output; used by cb-log to locate configuration files, etc. CBSTORE_ROOT=$CBSPIDER_ROOT
    ADMINWEB Option to enable or disable the AdminWeb UI and Swagger UI. When set to OFF, both AdminWeb and Swagger UI are disabled. cf) [AdminWeb ON/OFF Guide] ADMINWEB=ON
    MC_INSIGHT_API_TOKEN Set the MC-Insight API token for multi-cloud metadata search. Obtain the token from the MC-Insight service administrator. If empty, MC-Insight features will be disabled. MC_INSIGHT_API_TOKEN=c72df1af9b1f0c29
    SPIDER_METADB_URL Meta DB connection URL for PostgreSQL URL mode. Use only one mode: URL mode (SPIDER_METADB_URL) or key-value mode (SPIDER_METADB_USER, SPIDER_METADB_PASSWORD, SPIDER_METADB_ENDPOINT, SPIDER_METADB_DATABASE). If PostgreSQL mode is used, Spider treats MetaDB as user-managed and backup scheduler is automatically disabled. Not set (embedded SQLite mode)
    SPIDER_METADB_USER PostgreSQL username for Meta DB key-value mode. Not set
    SPIDER_METADB_PASSWORD PostgreSQL password for Meta DB key-value mode. Not set
    SPIDER_METADB_ENDPOINT PostgreSQL endpoint for Meta DB key-value mode (e.g., localhost:5432). Not set
    SPIDER_METADB_DATABASE PostgreSQL database name for Meta DB key-value mode. Not set
    SPIDER_METADB_SSLMODE Optional SSL mode for Meta DB key-value mode (e.g., disable). Not set
    SPIDER_METADB_CONNECT_TIMEOUT Optional connect timeout (seconds) for Meta DB key-value mode (e.g., 10). Not set
    SPIDER_BACKUP_ENABLED Enable or disable automatic meta DB backup. cf) Meta DB Backup Guide true
    SPIDER_BACKUP_INTERVAL Backup interval in Go duration format (e.g., 6h, 1h, 30m). 6h
    SPIDER_BACKUP_DIR Directory path where backup files are stored. $CBSPIDER_ROOT/meta_db/backups
    SPIDER_BACKUP_MAX_COUNT Maximum number of backup files to keep. 10
    SPIDER_USERNAME / SPIDER_PASSWORD Set ID/PW for REST API authentication (Basic Auth). ⚠️ IMPORTANT: Both must be set. The server will not start if either is empty. cf) Authentication Guide SPIDER_USERNAME=admin SPIDER_PASSWORD=
  • Configuration File: ./setup.env

     #!/bin/bash
    
     # root path of cb-spider
     SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}`
     export CBSPIDER_ROOT=`cd $SCRIPT_DIR && pwd`
    
     ### Set Spider server Address of Service Address
     # cf) https://github.com/cloud-barista/cb-spider/wiki/CB-Spider-Service-Address-Configuration
     # default: unset SERVER_ADDRESS and unset SERVICE_ADDRESS
     # examples for other service port
     #export SERVER_ADDRESS=":3000"
    
     # examples for K8S env
     #export SERVER_ADDRESS=":1024"
     #export SERVICE_ADDRESS="1.2.3.4:31024"
    
     ### Set the library type of Cloud Driver pkg.
     # ON is a shared library type.
     # default: OFF (will be deprecated)
     export PLUGIN_SW=OFF
    
     ## If the value is OFF, Spider does not perform ID transformation.
     # default: ON
     export ID_TRANSFORM_MODE=ON
    
     # root path of cb-log
     export CBLOG_ROOT=$CBSPIDER_ROOT
    
     # AdminWeb ON/OFF setting
     # ON: Enable AdminWeb, OFF: Disable AdminWeb
     # default: ON
     export ADMINWEB=ON
    
     # MC-Insight API Token for multi-cloud metadata search
     # Get token from MC-Insight service administrator
     # If empty, MC-Insight features will be disabled
     export MC_INSIGHT_API_TOKEN=c72df1af9b1f0c29
    
     # Meta DB Configuration (Choose one mode only)
     # Default: if neither mode is set, Spider uses embedded SQLite.
     # SQLite(default) file: $CBSPIDER_ROOT/meta_db/cb-spider.db
     #
     # Option A) URL mode
     #export SPIDER_METADB_URL="postgresql://postgres:password123@localhost:5432/cb_spider"
     #export SPIDER_METADB_URL="postgresql://postgres:password123@localhost:5432/cb_spider?sslmode=disable&connect_timeout=10"
     #
     # Option B) Key-value mode
     #export SPIDER_METADB_USER=postgres
     #export SPIDER_METADB_PASSWORD=password123
     #export SPIDER_METADB_ENDPOINT=localhost:5432
     #export SPIDER_METADB_DATABASE=cb_spider
     # Optional for key-value mode
     #export SPIDER_METADB_SSLMODE=disable
     #export SPIDER_METADB_CONNECT_TIMEOUT=10
     #
     # NOTE:
     # - Use only one mode (URL or key-value), not both.
     # - If PostgreSQL mode is used, Spider treats MetaDB as user-managed.
     # - In PostgreSQL mode, Spider MetaDB backup scheduler is automatically disabled.
    
     # Meta DB Backup Configuration
     # All settings are optional. If not set, defaults are used without errors.
     # SPIDER_BACKUP_ENABLED: true/false (default: true)
     # SPIDER_BACKUP_INTERVAL: Go duration format, e.g., 6h, 1h, 30m (default: 6h)
     # SPIDER_BACKUP_DIR: Backup directory path (default: $CBSPIDER_ROOT/meta_db/backups)
     # SPIDER_BACKUP_MAX_COUNT: Max number of backup files to keep (default: 10)
     #export SPIDER_BACKUP_ENABLED=true
     #export SPIDER_BACKUP_INTERVAL=6h
     #export SPIDER_BACKUP_DIR=$CBSPIDER_ROOT/meta_db/backups
     #export SPIDER_BACKUP_MAX_COUNT=10
     # Note: SPIDER_BACKUP_* settings are applied only in embedded SQLite MetaDB mode.
    
     # REST API Authentication (Basic Auth) - REQUIRED
     # - Both SPIDER_USERNAME and SPIDER_PASSWORD must be set. Server will not start without them.
     export SPIDER_USERNAME=admin
     export SPIDER_PASSWORD=
    

⚠️ Authentication Required: Both SPIDER_USERNAME and SPIDER_PASSWORD must be set for the server to start.
If either is missing, the server will terminate with log.Fatal.
For the CLI (spctl), credentials can be provided via environment variables or -u/-p flags.
See the Authentication Guide and CLI Install Guide for details.

  • If you modify the setup.env file, you must restart the server for the changes to take effect.