Overview
ZStack Cloud Application Market is an IaC (Infrastructure as Code)-based development platform that offers standardized IaC orchestration and a user-friendly development framework. It features strong compatibility, scalability, and hybrid cloud deployment. This helps ISV partners, channels, and customers quickly integrate complex enterprise applications to ZStack Cloud and deploy them with one click, allowing for flexible scaling of cloud capabilities based on business needs and the easy application of best practices to production environments.
This document describes how to create, release, and install an application on ZStack Cloud.
Create Application
About this task
This topic describes how to create an application image and package. Follow these steps:- Get the application template.
- Configure application files.
- Create the application image.
Procedure
-
Get the application template.
The source directory structure of the application package is as follow:
├── applications │ ├── index.json │ ├── zstack_io_grafana │ │ └── aarch64 │ │ └── 11.2.0 │ │ ├── application.json │ │ ├── input.json │ │ ├── logo.png │ │ ├── output.json │ │ └── src │ │ ├── main.tf │ │ ├── output.tf │ │ ├── scripts │ │ │ └── check-health.sh │ │ ├── variables.tf │ │ └── version.tf │ │ └── x86_64 │ │ └── 11.2.0 │ │ ├── application.json │ │ ├── input.json │ │ ├── logo.png │ │ ├── output.json │ │ └── src │ │ ├── main.tf │ │ ├── output.tf │ │ ├── scripts │ │ │ └── check-health.sh │ │ ├── variables.tf │ │ └── version.tfDirectory Explanation:- zstack_io_grafana: Application ID. Use the real Application ID to rename this path. This name must be consistent with the appId value in the file application.json.
- aarch64/x86_64: Application architecture. If your application supports only one architecture, delete the path corresponding to another architecture.
- 11.2.0: Application version. Use the real version number to rename this path.
- application.json: A file defining the application name, application description, appId, application type, and connection type.
- input.json: A file used for the UI rendering, which defines the form parameters that users need to set when installing this application on the Application Market UI page.
- logo.png: The application Logo picture.
- output.json: A file defining the application fields displayed on the UI after it is installed.
- src: A directory contains IaC files with Terraform (OpenTofu). The files must follow the Terraform syntax. See https://developer.hashicorp.com/terraform/language
- main.tf: The entry point for the OpenTofu execution file.
- output.tf: The output after executing main.
- script: A directory contains execution scripts. These scripts can
import data using
dataand execute commands on the VM instances running this application. - variables.tf: The variables in OpenTofu format.
- version.tf: The provider information.
-
Configure application files.
-
Create the application image.
The application image must be based on an instance image of the KVM qcow2 format. You can use the Packer Qemu Plugin to create the image. If the image includes QGA, you can pass User Data. The User Data passed must be encoded based on Base64.
The following example shows the User Data for formatting a data disk. You can write your own User Data according to your specific requirements.
Original User Data:#cloud-config runcmd: - | pv_list=$(pvs --noheadings -o pv_name) pv_count=$(echo "$pv_list" | wc -l) pv_name=$(echo "$pv_list" | tr -d ' ') vg_name=$(pvs --noheadings -o vg_name $pv_name | tr -d ' ') growpart $(echo $pv_name | sed 's/[0-9]*$//') $(echo $pv_name | grep -o '[0-9]*$') pvresize $pv_name lv_name=$(lvs --noheadings -o lv_name --sort -size | tail -1 | tr -d ' ') lvextend -l +100%FREE /dev/$vg_name/$lv_name lv_path="/dev/$vg_name/$lv_name" mapper_name=$(readlink -f $lv_path | awk -F '/' '{print $3}') lv_mapper_name=$(ls -l /dev/mapper/ | grep "$mapper_name" | awk '{print $9}') blkid | grep "/dev/mapper/$lv_mapper_name" | grep -q xfs if [ $? -eq 0 ]; then xfs_growfs /dev/mapper/$lv_mapper_name else resize2fs /dev/mapper/$lv_mapper_name fi partprobeEncoded User Data:user_data = "I2Nsb3VkLWNvbmZpZwpydW5jbWQ6CiAgLSB8CiAgICBwdl9saXN0PSQocHZzIC0tbm9oZWFkaW5ncyAtbyBwdl9u \ YW1lKQogICAgcHZfY291bnQ9JChlY2hvICIkcHZfbGlzdCIgfCB3YyAtbCkKICAgIHB2X25hbWU9JChlY2hvICIkcHZfbGlzdCIgfCB0ciAtZCAnI \ CcpCgogICAgdmdfbmFtZT0kKHB2cyAtLW5vaGVhZGluZ3MgLW8gdmdfbmFtZSAkcHZfbmFtZSB8IHRyIC1kICcgJykKCiAgICBncm93cGFydCAkKG \ VjaG8gJHB2X25hbWUgfCBzZWQgJ3MvWzAtOV0qJC8vJykgJChlY2hvICRwdl9uYW1lIHwgZ3JlcCAtbyAnWzAtOV0qJCcpCiAgICBwdnJlc2l6ZSA \ kcHZfbmFtZQoKICAgIGx2X25hbWU9JChsdnMgLS1ub2hlYWRpbmdzIC1vIGx2X25hbWUgLS1zb3J0IC1zaXplIHwgdGFpbCAtMSB8IHRyIC1kICcg \ JykKCiAgICBsdmV4dGVuZCAtbCArMTAwJUZSRUUgL2Rldi8kdmdfbmFtZS8kbHZfbmFtZQoKICAgIGx2X3BhdGg9Ii9kZXYvJHZnX25hbWUvJGx2X \ 25hbWUiCiAgICBtYXBwZXJfbmFtZT0kKHJlYWRsaW5rIC1mICRsdl9wYXRoIHwgYXdrIC1GICcvJyAne3ByaW50ICQzfScpCgogICAgbHZfbWFwcG \ VyX25hbWU9JChscyAtbCAvZGV2L21hcHBlci8gfCBncmVwICIkbWFwcGVyX25hbWUiIHwgYXdrICd7cHJpbnQgJDl9JykKCiAgICBibGtpZCB8IGd \ yZXAgIi9kZXYvbWFwcGVyLyRsdl9tYXBwZXJfbmFtZSIgfCBncmVwIC1xIHhmcwoKICAgIGlmIFsgJD8gLWVxIDAgXTsgdGhlbgogICAgICAgIHhm \ c19ncm93ZnMgL2Rldi9tYXBwZXIvJGx2X21hcHBlcl9uYW1lCiAgICBlbHNlCiAgICAgICAgcmVzaXplMmZzIC9kZXYvbWFwcGVyLyRsdl9tYXBwZ \ XJfbmFtZQogICAgZmkKICAgIHBhcnRwcm9iZQ=="
Release Application
- Private Release: Upload your application package and image to your local cloud. Only you can use this application.
- Specified Shared Release: Upload your application package and image to your CDN. You and your partners can use this application.
- Shared Release: Upload your application package and image to the official CDN of ZStack Cloud. All ZStack Cloud users can use this application.
Private Release
- Execute the python package_repo.py script to generate the directory images.
- Rename your application image to image.qcow2 and upload it to the directory images.
- Run the following command to generate a .bin package:
python package_bin --${AppId} --${Version} --${Arch} --include_images - Check the .bin package in the following path: target/application_bins/${AppID}/${Arch}/${Version}/${PackageName}.bin
- Upload the .bin package to the management node of ZStack Cloud and run the following command:
[root@localhost~] bash ${PackageName}.bin
Note: If you
use dual-management node. Upload the .bin package to and run the
bashcommand on the two management nodes respectively. - On the main menu of ZStack Cloud, choose . On the Default Application page, click Sync Application. Then, you can view the application you release.
Specified Shared Release
- Execute the python package_repo.py script to generate application.tar.gz and the new index.json
- Check application.tar.gz in the following path: target/application_bins/${app_id}/${arch}/${version}/xxx.bin
- Rename your application image as image.qcow2
- Upload application.tar.gz and image.qcow2 to your CDN according to
the following directory
structure:
├── index.json ├── ${AppId} │ └── ${Arch} │ └── ${Version} │ └── application.tar.gz │ └── image.qcow2 - Log in to the management node of ZStack Cloud and run the
following command to write your CDN into
repositories:
[root@localhost~]zstack-cli # Enter CLI command line. - >>>LogInByAccount accountName=admin password=${AdminPassword} # Log the admin account. admin >>>UpdateGlobalConfig name=repositories category=marketplace value="file:///opt/zstack-marketplace-repo;${CustomCDNAddress}" # Write your CDN into repositories. admin >>>exit # Exit the CLI command line. - Run the following command to restart the management node:
[root@localhost~] zstack-ctl restart_node - Check whether the repositories in the marketplace-server/config/config.yaml is
consistent with the sample shown
below:
repositories: - file:///opt/zstack-marketplace-repo - ${CustomCDNAddress} - On the main menu of ZStack Cloud, choose . On the Default Application page, click Sync Application. Then, you can view the application you release.
Shared Release
- Execute the python package_repo.py script to generate application.tar.gz and the new index.json
- Check application.tar.gz in the following path: target/application_bins/${app_id}/${arch}/${version}/xxx.bin
- Rename your application image as image.qcow2
- Send application.tar.gz and image.qcow2 to ZStack Cloud technical support. The technical support will upload the files to the official CND.
- On the main menu of ZStack Cloud, choose . On the Default Application page, click Sync Application. Then, you can view the application you release.
Install Application
About this task
This topic describes how to install an application released on Application Market. Follow these steps:- Upload the application image. (Optional)
- Install the application.
- Access the application.
- Application debug tips.
Procedure
-
Upload the application image. (Optional)
When installing the application. The system downloads the application image from the CDN automatically, which consumes certain time. If your Cloud cannot visit the CDN or you want to accelerate the installation, you can maually upload the image to the specified path in advance.
- Download Address
- ZStack Cloud CDN: Click here
- To download applications that are not officially released on ZStack Cloud, contact the corresponding developers.
- Upload Image
- Rename the image to image.qcow2 and upload it to the following path on your management node and ImageStore (create the path if it does not exist)): /opt/zstack-marketplace-repo/{appName}/{Architecture}/{version}. For example, /opt/zstack-marketplace-repo/zstack_io_zaku/x86_64/3.1.0/image.qcow2
- To ensure the correctness of the path and file name, we recommend that you contact the official technical support to execute this step.
- Download Address
-
Install the application.
On the main menu of ZStack Cloud, choose . Locate the application you need to install and click Install. Then, the Install Application page is displayed.
On the displayed page, set the required parameters and confirm to install.
-
Access the application.
On the main menu of ZStack Cloud, choose . Locate the application and click the access address. Then, you can access the application.
-
Application debug tips.
If you need to debug, you can find the information you need with the following tips:
- View the application UUID: Click Task on the main menu of ZStack Cloud, and locate the task corresponding to the application installation. You can find the application UUID in this task details.
- View the application logs: See /var/lib/zstack/marketplace-server/server.log on the management node.
- View the application directory: Enter
/var/lib/zstack/marketplace-server/apps/${application_uuid}/instance/${instance_uuid}
on the management node. You can see the terraform.tfstate here. If you
need to debug manually, run the following command:
```bash export TF_CLI_CONFIG_FILE=/var/lib/zstack/marketplace-server/.terraformrc && /var/lib/zstack/marketplace-server/tools/tofu apply -var "host=cloud api endpoint" -var "port=8080" -var "session_id=xxxxx" ```

