All Products
Search
Document Center

Environment setup

Last Updated: Jan 21, 2019

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.

  1. 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.

  2. 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

  1. 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.

    download bizview

  2. 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

  1. MySql database configuration. Modify the MySql database configuration in application.properties. The specific parameters are as follows:
    1. # MySql database connection configuration, please replace {your_db_address}, {your_db_port}, {your_db_name} with actual database information
    2. spring.datasource.hikari.jdbcUrl=jdbc:mysql://{your_db_address}:{your_db_port}/{your_db_name}?useunicode=yes&characterencoding=utf-8
    3. # MySql database connection user name, please replace {your_db_username}} with the actual database connection user
    4. spring.datasource.hikari.username={your_db_username}
    5. # MySql database connection password, please replace {your_db_password} with the actual database connection password
    6. spring.datasource.hikari.password={your_db_password}
  2. 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.

    1. # OSS endpoit, each region is different, please replace it according to your actual situation, such as http://oss-cn-hangzhou.aliyuncs.com
    2. spring.oss.endpoint={your_oss_endpoint}
    3. # OSS bucket name, please replace it with your own bucket
    4. spring.oss.bucketname={your_oss_bucket}
    5. # OSS accessKeyId, please replace it with a key that has read and write permissions to the bucket you have configured.
    6. spring.oss.accesskeyid={your_oss_accessKeyId}
    7. # OSS accessKeySecret, please replace it with a secret that has read and write permissions to the bucket you have configured.
    8. spring.oss.accesskeysecret={your_oss_accessKeySecret}
  3. Blockchain configuration file location. If it is running in Jar mode, please configure it as your local file path.

    1. sdk.properties=/{your_path_to_sdk_properties}/sdk.properties

    If it is running in a Docker environment, set the address to /data/sdk.properties

    1. sdk.properties=/data/sdk.properties
  4. 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:

    1. # client connection master node address, the master node must be configured with only one
    2. biz.sdk.primary=### IP configuration without modification ###
    3. # Backup node API address, backup node can be configured with 0 or more
    4. # 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.
    5. biz.sdk.backups=### IP configuration without modification ###
    6. # 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
    7. biz.sdk.ssl_key=/{your_path_to_private_key}/{your_private_pkcs8_key}
    8. # 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
    9. biz.sdk.ssl_cert=/{your_path_to_ssl_cert}/{your_ssl_cert}
    10. # ssl private key password you set when creating the private key, please replace {your_ssl_password} with your own password
    11. biz.sdk.ssl_key_password={your_ssl_password}
    12. #trust store file absolute path
    13. biz.sdk.trust_store=/{your_path_to_trust_store}/trust.keystore
    14. # trust store password, please consult the BaaS platform personnel to obtain the password, please replace {trust_store_password} with the actual password
    15. biz.sdk.trust_store_password={trust_store_password}

    If you run the service in a Docker environment, set all file directories to /data.

    1. # client connection master node address, the master node must be configured with only one
    2. biz.sdk.primary=### IP configuration without modification ###
    3. # Backup node API address, backup node can be configured with 0 or more
    4. # 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.
    5. biz.sdk.backups=### IP configuration without modification ###
    6. # 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
    7. biz.sdk.ssl_key=/data/{your_private_pkcs8_key}
    8. # 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
    9. biz.sdk.ssl_cert=/data/{your_ssl_cert}
    10. # ssl private key password you set when creating the private key, please replace {your_ssl_password} with your own password
    11. biz.sdk.ssl_key_password={your_ssl_password}
    12. #trust store file absolute path
    13. biz.sdk.trust_store=/data/trust.keystore
    14. # trust store password, please consult the BaaS platform personnel to obtain the password, please replace {trust_store_password} with the actual password
    15. biz.sdk.trust_store_password={trust_store_password}

Starting the service

  1. Start the Business View service using the Jar package.
    1. java -Dspring.config.location=/{path_to_application_properties}/application.properties -jar /{path_to_bizView_jar}/bizView.jar
  2. 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:
    1. 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.
    1. docker run -v /{path_to_configs}/:/data -v /path_to_temp_files/:/tmp -p 8080:8080 bizView
  3. 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.