Dok Docs
Github Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

tencentcloud

Overview

This article mainly explains the use of DOK by creating a CVM through Tencent Cloud, as long as you have a Tencent Cloud account and you can use it for a small amount of money.

Spot Instance

# create CVM 
dok createCVM -n 6

DOK provides the option createCVM, as long as the environment variables are configured with secretId and secretKey, you can create a CVM, currently DOK will only create 2c4g Singapore’s spot instance, the price is very cheap, if there are other to meet the needs of regional CVM use, you can consider modifying the source code implementation of DOK. How cheap is the instance price under the default configuration? You can refer to the figure below. According to the default configuration of DOK, create a cluster with six nodes in the production environment. Counting the bandwidth fee, the total cost is only 2 RMB/hour. It is highly recommended that you use this method to test DOK Function.

img_1.png

Operation

The following script is provided for the convenience of colleagues in the company. There are two places that need to be filled in, namely secretId and secretKey. The premise is that you already have a Tencent Cloud account and a private key for API access. For details, please check Official documentation of Tencent Cloud.

In addition, it should be noted that if you want to use the company’s Tencent Cloud resources, you need to apply to the boss (there is a high probability that it will not be approved), so the cos bucket here is only suitable for collaborators who have applied for a company account. It is said that you cannot directly obtain the resources of the DOK installation package. You can check the documentation of make-pkg-release to reproduce one then upload it to the Tencent Cloud CVM you purchased (the time will not be too long, depending on your network environment).

# download install pkg on master0
export secretId=
export secretKey=
unalias cp rm mv
cd || exit
wget -q -c https://github.com//tencentyun/coscli/releases/download/v0.11.0-beta/coscli-linux
chmod 755 coscli-linux
mv coscli-linux /usr/local/bin/coscli
cat >/root/.cos.yaml <<EOF
cos:
  base:
    secretid: ${secretId}
    secretkey: ${secretKey}
    sessiontoken: ""
    protocol: https
  buckets:
  - name: dok-1258329892
    alias: dok-1258329892
    region: ""
    endpoint: cos.ap-singapore.myqcloud.com
EOF
dir=dok-release
gz=$dir-without-app-image.gz
md5=$gz.md5sum
coscli cp cos://dok-1258329892/$gz $gz
coscli cp cos://dok-1258329892/$md5 $md5
coscli cp cos://dok-1258329892/dok dok

# create cluster
dok createCluster -m 172.22.0.68,172.22.1.53,172.22.1.10 -w 172.22.1.83,172.22.1.148,172.22.1.101 -p /root/dok-release-without-app-image.gz --password your-password

img.png

Reference

  1. 腾讯云API中心