5. Enabling integration¶
To enable integration with CloudBlue Connect, first, check that the Virtuozzo Hybrid Server CloudBlue connector packages are properly installed inside the VA MN container (see To install Virtuozzo Hybrid Server CloudBlue connector).
5.1. Configure a config.json file¶
To ensure the smooth connection of the CloudBlue Connect API with the virtual infrastructure managed by the VA API, adjust a config.json file, start and enable the following four applications:
cloudblue-fulfillmentsprocesses fulfillments; creates and manages domains, projects, and users.cloudblue-usagesends usage reports for active assets.cloudblue-usage-filesconfirms processed usage files.cloudblue-subscriptions-cleanerremoves a virtual environment and backups for a terminated subscription.
5.1.1. To adjust a config.json file¶
Copy the configuration file example to your
config.jsonfile and open the latter for editing:cp /etc/cloudblue-connector/config.json.example /etc/cloudblue-connector/config.json vi /etc/cloudblue-connector/config.json { "pva_socket": "/var/opt/pva/mn/mn.sock", "pva_connect_timeout": 600, "pva_socket_read_delay": 2, "keystone_endpoint": "https://power-panel.local:35357/v3", "pp_url": "https://power-panel.local/api/v1", "pp_login": "admin", "post_hook_script": "/etc/cloudblue-connector/posthook.sh", "post_hook_exec_timeout": 120, "misc": { "domainDeleteOnFail": true, "hidePasswordsInLog": true, "testMarketplaceId": "MP-43209", "testMode": false, "orderRamInMegabytes": false }, "apiEndpoint": "https://api.connect.cloud.im/public/v1", "products": ["PRD-718-365-521", "PRD-428-165-279", "PRD-713-462-300"], "report_usage": ["PRD-718-365-521"], "report_suspended": true, "dataRetentionPeriod": 15, "templates": { "PRD-718-365-521": {"grant": "TL-623-078-399", "revoke": "Access to VDC has been revoked"}, "PRD-428-165-279": {"grant": "TL-581-343-333", "revoke": "Access to VDC has been revoked"}, "PRD-713-462-300": {"grant": "TL-601-357-392", "revoke": "Access to Power Panel has been revoked"} } }Change the default parameters:
In
"pva_socket", specify the Virtuozzo Automator UNIX socket. If not changed previously, no additional modifications are required.In
"pva_connect_timeout", enter the maximum time (in seconds) while the Virtuozzo Hybrid Server CloudBlue connector waits for the response from Virtuozzo Automator.In
"pva_socket_read_delay", specify the delay between the reading data frame from the Virtuozzo Automator response.In
"keystone_endpoint", specify the default PowerPanel URL, including the keystone port and endpoint, for example,http://power-panel.com:35357/v3.In
"pp_url", enter the default PowerPanel URL, including the API endpoint, for example,http://power-panel.com/api/v1.In
"pp_login", specify the PowerPanel admin user name.In
"post_hook_script", specify a path to your script. The script should include thesubscription_id,action, andaction resultparameters. For example:#!/bin/bash # $1 - subscription_id # $2 - action ['purchase', 'resume', 'change', 'suspend', 'cancel'] # $3 - action result ['success', 'fail'] LOGFILE="/var/log/cloudblue-connector/post_hook.log" TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"` echo "[${TIMESTAMP}]: $1 $2 $3" >> ${LOGFILE} exit 0In
"post_hook_exec_timeout", specify the amount of time in seconds allocated for the execution of a post-hook script. When the allowed period of time has ended and the script has not finished executing, the system will forcefully terminate it. If the specified period of time is too short, increase the value or optimize the script.Note
The system will not start processing a new request for a subscription until the previous post-hook script is completed or forcefully terminated after the period of time specified in
"post_hook_exec_timeout". Then, the system will process the following subscription request in the queue, and the post-hook script will start running again."misc"contains additional configuration options to define the Virtuozzo Hybrid Server CloudBlue connector behavior:"domainDeleteOnFail"is a parameter used for debugging purposes. Setfalseif you want the virtual environment not deleted in case of a subscription failure. Otherwise, settrue."hidePasswordsInLog"wipes plain-text passwords in the Virtuozzo Hybrid Server CloudBlue connector events output. The default value istrue.In
"testMarketplaceId", specify the ID of a marketplace used to place asset requests for evaluation. If not set, all asset requests from all marketplaces will be processed, regardless of the"testMode"setting.In
"testMode", settrueto have requests made in"testMarketplaceId"processed only. Setfalseto have requests made in"testMarketplaceId"ignored. The default value isfalse.In
"orderRamInMegabytes", setfalseto have the requested amount of RAM defined in gigabytes (GB). Iftrue, the amount of RAM is specified in megabytes (MB).
In
"apiEndpoint", specify the API endpoint to interact with the CloudBlue Connect API copied on the vendor portal. For this:In
"products", specify the list of product IDs copied on the vendor portal. For this:In
"report_usage", specify the IDs of products with the pay-as-you-go resource model, copied on the vendor portal. For this:In
"report_suspended", settrueif you want a usage report to show data for a subscription when it is suspended. Otherwise, setfalse. The default value istrue."dataRetentionPeriod"is the number of days a virtual environment and its backups for a terminated subscription exist. During this period, the virtual environment is stopped, and the user cannot view and manage it via PowerPanel, except for the administrator. After the expiration of this period, the system removes the virtual environment and its existing backups for such a subscription. They are immediately removed during the cancellation request if"dataRetentionPeriod"is set to zero (0).In
"templates", specify template IDs for each product copied on the vendor portal. For this:
For security reasons, the Virtuozzo Hybrid Server CloudBlue connector does not store passwords in plain text. For specifying the CloudBlue API token and PowerPanel admin user password, run
cloudblue-password-manager.# cloudblue-password-manager [-h] [--set-cloudblue-token] [--set-pp-password]When specifying an API token, enter the ID and API key.
For example,
"ApiKey SU-469-692-689:*****************". Copy the ID and API key on the vendor portal:Enable and start all four services, such as
cloudblue-fulfillments.service,cloudblue-usage.service,cloudblue-usage-files.service, andcloudblue-subscriptions-cleaner.service:Note
To ensure that the
cloudblue-fulfillmentsservice runs properly, execute the following:cloudblue-fulfillments
Additionally, you can verify
cloudblue-usage,cloudblue-usage-files, andcloudblue-subscriptions-cleaner. For example:cloudblue-usage
cloudblue-usage-files
cloudblue-subscriptions-cleaner
systemctl enable cloudblue-fulfillments.service systemctl start cloudblue-fulfillments.service
systemctl enable cloudblue-usage.service systemctl start cloudblue-usage.service
systemctl enable cloudblue-usage-files.service systemctl start cloudblue-usage-files.service
systemctl enable cloudblue-subscriptions-cleaner.service systemctl start cloudblue-subscriptions-cleaner.service
Note
If you want to change a PowerPanel admin user password, use the same API key and generate a new password. Otherwise, you can delete the connector.pem file, implying the subsequent generation of a new API key and password. Encrypted passwords are stored in the passwords_db.sqlite3 database.
# cd /etc/cloudblue-connector/ ; ls -la
-rw-r--r-- 1 root root 4619 May 15 19:49 config-logging.json
-rw-r--r-- 1 root root 2471 Jun 19 17:22 config.json
-rw-r--r-- 1 root root 4567 Jun 19 17:27 connector.pem
-rw-r--r-- 1 root root 9753 Jun 19 17:27 passwords_db.sqlite3