Skip to content

virtuozzo/cloudblue-connector

Repository files navigation

CloudBlue Connector for VHI

CloudBlue Connector enables integration between CloudBlue Connect platform and Virtuozzo Hybrid Infrastructure (VHI), allowing for automated provisioning and management of cloud resources.

Installation

# Install the package
yum install vz-python39-cloudblue-connector

# Copy configuration files
cp /etc/cloudblue-connector/config-example.yaml /etc/cloudblue-connector/config.yaml
cp /etc/cloudblue-connector/connector-logger-example.json /etc/cloudblue-connector/connector-logger.json

# Enable and start the service
systemctl enable cloudblue-connector
systemctl start cloudblue-connector

Configuration

API Configuration

The configuration file is located at /etc/cloudblue-connector/config.yaml. Here's a detailed breakdown of the configuration options:

api:
  cloudblue:
    url: "https://api.connect.cloud.im/public/v1"
    # Main key for manage products, can be set via CLI tool for security
    vendorKey: "ApiKey YOUR_API_KEY"
    # Key for manage distributor usage acceptance
    distributorKey: "ApiKey YOUR_API"

  vhi:
    url: "https://[KEYSTONE_URL]:5000/v3"
    username: "vstorage-service-user"
    password: "PASSWORD"  # Can be set via CLI tool
    domain: "Default"
    project: "admin"
    verify: false

  onapp:
    url: "https://onapp.com"
    username: "[email protected]"
    token: "YOUR_TOKEN"  # Can be set via CLI tool

Application Configuration

appConfig:
  daemon:
    interval: 30      # Interval of connector processing fulfillments and usage
    timeout: 3600     # Timeout of one cycle of processing

  rootPathUsage: "/var/lib/cloudblue-connector/usage"
  connectorDbPath: "/var/lib/cloudblue-connector/connector_db.sqlite3"
  
  # Data retention period in days (0 to disable)
  dataRetentionPeriod: 0
  
  # List of marketplaces and contracts (can be empty)
  marketplaces:
    - "MP-0000"
  contracts:
    - "CRD-00000-00000-00000"

  # Product Configuration
  products:
    PRD-000-000-001: # Product ID which gets from CloudBlue Connect
      approveTemplate: "TL-613-866-807" # Template ID for approval, gets from CloudBlue Connect product configuration
      name: "pVHI"
      type: "vhi"
      reportUsage: true
      reportUnitsIn: "MB"  # MB, GB
      reportUsageAutoAccept: true  # Requires distributorKey
      reportPeriod: "daily"  # hourly, daily, monthly
      uploadImages: true # allow user to upload images to VHI project
      paidImages: # optional, paid images for which user will be charged
        img1: "UUID"
        img2: "UUID"
        img3: "UUID"

    PRD-000-000-002: # Product ID which gets from CloudBlue Connect
      approveTemplate: "TL-989-070-904" # Template ID for approval, gets from CloudBlue Connect product configuration
      name: "VHS7-OnApp-Cloud"
      type: "onapp"
      bucketId: 1   # OnApp bucket ID, gets from OnApp configuration
      userRoleId: 2 # OnApp user role ID, gets from OnApp configuration
      groupId: 17   # OnApp group ID, gets from OnApp configuration
      reportUsage: true # Enable usage reporting if product have Pay-As-You-Go billing model
      reportUsageAutoAccept: false # Enable auto-acceptance of usage reports from Distributor
      reportPeriod: "daily"

Using cloudblue-connector-cli

The CLI tool provides comprehensive management of reports and authentication credentials.

Report Management

# List reports
cloudblue-connector-cli report list [--product_id PRD-XXX] [--is_valid 0|1] [--is_submitted 0|1]

# Create report
cloudblue-connector-cli report create <product_id> <report_name> <start_time> <end_time> [--is_valid 0|1] [--is_submitted 0|1] [--report_path PATH]

# Edit report
cloudblue-connector-cli report edit <report_id> [--product_id PRD-XXX] [--report_name NAME] [--start_report_time TIME] [--end_report_time TIME] [--is_valid 0|1] [--is_submitted 0|1] [--report_path PATH]

# Delete report
cloudblue-connector-cli report delete <report_id>

# Clear reports
cloudblue-connector-cli report clear [--product_id PRD-XXX]

Authentication Management

# Set credentials
cloudblue-connector-cli auth set [--service SERVICE]
# Available services:
# - cloudblue (sets both vendor and distributor tokens)
# - vhi
# - vhs (sets both VA and PowerPanel passwords)
# - onapp
# - vap

# List credentials
cloudblue-connector-cli auth list [--service SERVICE]

# Delete credentials
cloudblue-connector-cli auth delete <credential_id>

Service Management

# Start service
systemctl start cloudblue-connector

# Stop service
systemctl stop cloudblue-connector

# Check status
systemctl status cloudblue-connector

# View logs
journalctl -u cloudblue-connector -f

Security Notes

  1. Sensitive credentials (API keys, passwords, tokens) should be set using the CLI tool rather than storing them directly in the configuration file.

  2. Use the following commands to secure configuration files:

chmod 600 /etc/cloudblue-connector/config.yaml
chmod 600 /etc/cloudblue-connector/connector-logger.json

Troubleshooting

  • Service logs: journalctl -u cloudblue-connector
  • Application logs: /var/log/cloudblue-connector/connector.log
  • Database location: /var/lib/cloudblue-connector/connector_db.sqlite3
  • Usage data: /var/lib/cloudblue-connector/usage

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages