This article describes how to set up a run-time environment for Business view.
Installation and configuration steps
Prepare the environment
Download the installation package and certificate file
Initialize the database
Modify the configuration file
Start the service
Prepare the environment
The following software environment is required to run the Business View (Bizview) service.
Install the MySql database in advance before starting the service. The Business View service needs to have a connectable MySql database as the data storage unit.
Business View can be run in two ways, using the Jar package or running under the Docker image environment. We recommend that you run the Jar package. If you need a Docker environment to run Business View, you need to pre-install Docker Engine. For specific installation procedures, please refer to Docker Installation. If you run Business View as a Jar package, you can skip this step.
Download the installation package and certificate file
Log on to the BaaS platform, select blockchain list in the left-side navigation pane, find the blockchain you want to access in the list, select the right more button, and click Download Signature Certificates and Download Business View.
After obtaining the installation package of the Business View service, unzip the installation package to the local directory and copy the downloaded certificate file to the directory where the installation package is extracted. The extracted package contains the following files:
bizview.jar: Business View Jar Pack
ddl.sql: DDL required to initialize the MySql database table
application.properties: Business View service configuration file
sdk.properties: Client configuration file to connect to the Ant Blockchain service
trust.keystore: TrustStore used by client authentication
schema.txt: Data classification definition, including all kinds of data types (Category)
Dockerfile: If you choose to run Business View in the Docker environment, you need to use Dockerfile to build the docker image file.
Initializing the database
Connect to the MySql database, create the database required by the Business View service. Create a database named “bizview”, select UTF8 for the newly created database character set, and initialize the database table using the script provided in ddl.sql.
Modify the configuration file
MySql database configuration. Modify the MySql database configuration in application.properties. The specific parameters are as follows:
# MySql database connection configuration, please replace {your_db_address}, {your_db_port}, {your_db_name} with actual database information spring.datasource.hikari.jdbcUrl=jdbc:mysql://{your_db_address}:{your_db_port}/{your_db_name}?useunicode=yes&characterencoding=utf-8 # MySql database connection user name, please replace {your_db_username}} with the actual database connection user spring.datasource.hikari.username={your_db_username} # MySql database connection password, please replace {your_db_password} with the actual database connection password spring.datasource.hikari.password={your_db_password}
Large file storage OSS configuration
For large file transaction in blockchain, the Business View service provides an OSS storage solution. You can use the default storage provided by the service without modifying any OSS configuration. If you use your own OSS storage, modify the OSS configuration in application.properties. The specific parameters are described below. If you have not configured the data format, or if the data format does not contain large file fields, please keep the following configuration items and leave the configuration values blank.
# OSS endpoint, each region is different, please replace it according to your actual situation, such as http://oss-cn-hangzhou.aliyuncs.com spring.oss.endpoint={your_oss_endpoint} # OSS bucket name, please replace it with your own bucket spring.oss.bucketname={your_oss_bucket} # OSS accessKeyId, please replace it with a key that has read and write permissions to the bucket you have configured. spring.oss.accesskeyid={your_oss_accessKeyId} # OSS accessKeySecret, please replace it with a secret that has read and write permissions to the bucket you have configured. spring.oss.accesskeysecret={your_oss_accessKeySecret}
Blockchain configuration file location. If it is running in Jar mode, please configure it as your local file path.
sdk.properties=/{your_path_to_sdk_properties}/sdk.properties
If it is running in a Docker environment, set the address to /data/sdk.properties
sdk.properties=/data/sdk.properties
Ant blockchain client configuration file.
The client is connected to the node using TLS mutual authentication. You need to configure the x509 certificate. ssl_key is your private key file in pkcs8 format. The ssl_cert certificate is the signature certificate downloaded from the BaaS platform and ssl_key_password is the password you set when you created the private key. Copy your own ssl private key file in pkcs8 format to the directory where the installation package is extracted.
Modify sdk.properties to determine the primary node to which the client will connect and the alternate node address when the primary node is unavailable.
When running in the Jar package mode, the specific parameters are as follows:
# client connection master node address, the master node must be configured with only one biz.sdk.primary=### IP configuration without modification ### # Backup node API address, backup node can be configured with 0 or more # When the primary node cannot connect, or switch to connect to the backup node, when the primary node recovers, it automatically switches back to the primary node. biz.sdk.backups=### IP configuration without modification ### # pkcs8 format ssl private key file absolute path, please replace {your_private_pkcs8_key} with the actual private key file name, such as pkcs8_private.pem biz.sdk.ssl_key=/{your_path_to_private_key}/{your_private_pkcs8_key} # x509 format ssl certificate file absolute path, please replace {your_ssl_cert}} with the actual certificate file name, such as ssl_cert.pem, note that the /tmp home directory cannot be modified biz.sdk.ssl_cert=/{your_path_to_ssl_cert}/{your_ssl_cert} # ssl private key password you set when creating the private key, please replace {your_ssl_password} with your own password biz.sdk.ssl_key_password={your_ssl_password} #trust store file absolute path biz.sdk.trust_store=/{your_path_to_trust_store}/trust.keystore # trust store password, please consult the BaaS platform personnel to obtain the password, please replace {trust_store_password} with the actual password biz.sdk.trust_store_password={trust_store_password}
If you run the service in a Docker environment, set all file directories to /data.
# client connection master node address, the master node must be configured with only one biz.sdk.primary=### IP configuration without modification ### # Backup node API address, backup node can be configured with 0 or more # When the primary node cannot connect, or switch to connect to the backup node, when the primary node recovers, it automatically switches back to the primary node. biz.sdk.backups=### IP configuration without modification ### # pkcs8 format ssl private key file absolute path, please replace {your_private_pkcs8_key} with the actual private key file name, such as pkcs8_private.pem biz.sdk.ssl_key=/data/{your_private_pkcs8_key} # x509 format ssl certificate file absolute path, please replace {your_ssl_cert}} with the actual certificate file name, such as ssl_cert.pem, note that the /tmp home directory cannot be modified biz.sdk.ssl_cert=/data/{your_ssl_cert} # ssl private key password you set when creating the private key, please replace {your_ssl_password} with your own password biz.sdk.ssl_key_password={your_ssl_password} #trust store file absolute path biz.sdk.trust_store=/data/trust.keystore # trust store password, please consult the BaaS platform personnel to obtain the password, please replace {trust_store_password} with the actual password biz.sdk.trust_store_password={trust_store_password}
Starting the service
Start the Business View service using the Jar package.
java -Dspring.config.location=/{path_to_application_properties}/application.properties -jar /{path_to_bizView_jar}/bizView.jar
Launch the Business View service in the Docker environment. First build your Docker image. Make sure the Dockerfile and bizView.jar are in the same directory, execute the following command:
cd /{path_to_dockerfile}; docker build -t bizView .
Ensure that your private key file, certificate file, trustStore, sdk.properties, and application.properties are all placed in a directory, mounted to the /data volume in the image, and the service is started.
docker run -v /{path_to_configs}/:/data -v /path_to_temp_files/:/tmp -p 8080:8080 bizView
After the Business View service starts successfully, it will listen to port 8080 and can access the RESTful API through http://{your_server_ip}:8080.