要求
构建
构建cometbft 二进制文件,并可选构建 cometbft/localnode Docker 镜像。
注意,二进制文件会挂载到容器中,因此无需重新构建镜像即可更新它。
运行测试网
要启动一个 4 节点测试网,请运行:配置
make localnet-start 命令会通过调用 cometbft testnet 命令,在 ./build 中为一个 4 节点测试网创建文件。
./build 目录会挂载到 /cometbft 挂载点,以便将二进制文件和配置文件附加到容器中。
要更改验证者 / 非验证者的数量,请修改 这里 的 localnet-start Makefile 目标:
配置 ABCI 容器
要在 4 节点配置中使用你自己的 ABCI 应用,请编辑 docker-compose.yaml 文件,并为你的 ABCI 应用添加镜像。日志
日志会保存在挂载的卷中,即cometbft.log 文件内。如果启动时将 LOG 环境变量设为 stdout,日志就不会保存,而是直接输出到屏幕。
特殊二进制文件
如果你有多个名称不同的二进制文件,可以通过BINARY 环境变量指定要运行的那个。二进制文件的路径相对于挂载的卷。
With Docker Compose, you can spin up local testnets with a single command.
Requirements
Build
Build thecometbft binary and, optionally, the cometbft/localnode
docker image.
Note the binary will be mounted into the container so it can be updated without
rebuilding the image.
Run a testnet
To start a 4-node testnet, run:Configuration
Themake localnet-start command creates files for a 4-node testnet in ./build by
calling the cometbft testnet command.
The ./build directory is mounted to the /cometbft mount point to attach
the binary and config files to the container.
To change the number of validators / non-validators, change the localnet-start Makefile target here:
Configuring ABCI containers
To use your own ABCI applications with the 4-node setup, edit the docker-compose.yaml file and add images for your ABCI application.Logging
The log is saved under the attached volume, in thecometbft.log file. If the
LOG environment variable is set to stdout at start, the log is not saved,
but printed to the screen.
Special binaries
If you have multiple binaries with different names, you can specify which one to run with theBINARY environment variable. The path of the binary is relative
to the attached volume.