Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Latest commit

 

History

History
187 lines (145 loc) · 5.05 KB

README.md

File metadata and controls

187 lines (145 loc) · 5.05 KB

axon 部署

目录结构

deploy
|
|___ templates
|    |___ config.toml
|    |___ genesis.json
|    |___ default.db-options
|    |___ axon-node.service
|___ ansible.cfg
|___ build.yml
|___ config.yml
|___ deploy.yml
|___ axon_node.yml
|___ Makefile

templates 目录

该目录放置axon 启动的配置文件,与 axonweb3/axon 下的同名文件保持一致


config.toml

配置文件,基本与 axon 保持一致

私钥替换 修改私钥为 node_privkey 后续部署脚本会根据配置替换

p2p boot 节点替换 替换 boot ip 为 bootstraps_ip, 后续部署脚本会根据配置替换


genesis.json

创世块配置,与 axon genesis_multi_nodes.json 配置保持一致


default.db-options

RocksDB 默认配置文件, 这个文件需要和 config.toml 在一个目录。
默认在 config 目录搜,如果不存在就 default。
该配置文件保持与axonweb3/axon 下同名文件保持一致

ansible.cfg

ansible 配置文件

# ansible inventory 文件路径,指定为同目录下的 hosts 文件
inventory = hosts

# false,关闭第一次使用 ansible 连接客户端是输入命令提示
host_key_checking:False

hosts 是 axon 节点IP,node_privkey 来自 devtools/chain/nodes 的 node_*.toml 中的 privkey

ansible 部署 axon 节点的host list 和 node_privkey

axon:
  hosts:
    xxx.xxx.xxx.xxx:
      node_privkey: "0x37aa0f893d05914a4def0460c0a984d3611546cfb26924d7a7ca6e0db9950a2d"
    xxx.xxx.xxx.xxx:
      node_privkey: "0x383fcff8683b8115e31613949be24254b4204ffbe43c227408a76334a2e3fb32"
    xxx.xxx.xxx.xxx:
      node_privkey: "0x51ce21643b911347c5d5c85c323d9d5421810dc89f46b688720b2715f5e8e936"
    xxx.xxx.xxx.xxx:
      node_privkey: "0x69ff51f4c22f30615f68b88efa740f8f1b9169e88842b83d189748d06f1a948e"


config.yml

ansible 部署axon时所需的axon的配置文件

# 部署axon 时目标机器存放axon的位置
deploy_path: "/home/ckb/axon"

# axon code repo
axon_repo: "https://github.com/axonweb3/axon.git"

# build axon 指定的 branch、tag 等
axon_branch: "main"

# 任意一个节点的ip
bootstraps: "xxx.xxx.xxx.xxx"

# mercury 的节点 ip, 当前版本不用
mercury_uri: "http://127.0.0.1"

# 开启跨链的开关, 当前版本不用
enable_cross_client: "false"

enable_profile: "false"
enable_profile_debug: "false"

# jemalloc 用来分析内存,生成jemalloc 分析文件
enable_jemalloc: "false"

# 目标节点用户
remote_server_user: "ckb"

build.yml

ansible tasks,用于 build axon 的所有任务,包括pull code,build axon


deploy.yml

ansible tasks,用于deploy axon 的所有任务,包括copy axon 相关文件到目标机器,配置,启动和停止axon服务


部署步骤

axon-deploy

copy axon-devops 目录到指定机器上

$ git clone https://github.com/axonweb3/axon-devops
$ cd axon-devops/deploy

按照上述 deploy 详解文档描述修改以下文件

  • config.yml
  • axon_node.yml

之后使用 make 命令 启动/停止服务

$ cd axon-devops/deploy
$ make clean  # 停止axon 服务并清理数据
$ make deploy # build axon 并启动axon服务

检查 axon 在各个节点的进程是否运行

$ make check

其余命令

$ make start  # 启动 axon
$ make stop   # 停止 axon
$ make build  # 构建 axon
$ make block  # 查看节点区块高度