update networks/local readme

This commit is contained in:
Ethan Buchman 2018-05-19 23:21:19 -04:00
parent 6c4a26f248
commit d7d12c8030
3 changed files with 69 additions and 16 deletions

View File

@ -193,6 +193,10 @@ build-docker:
build-linux:
GOOS=linux GOARCH=amd64 $(MAKE) build
build-docker-localnode:
cd networks/local
make
# Run a 4-node testnet locally
localnet-start: localnet-stop
@if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2 ; fi

View File

@ -28,8 +28,11 @@ genesis file (``genesis.json``) containing the associated public key,
in ``$TMHOME/config``.
This is all that's necessary to run a local testnet with one validator.
For more elaborate initialization, see our `testnet deployment
tool <https://github.com/tendermint/tools/tree/master/mintnet-kubernetes>`__.
For more elaborate initialization, see the `tesnet` command:
::
tendermint testnet --help
Run
---

View File

@ -1,29 +1,79 @@
localnode
=========
It is assumed that you have already `setup docker <https://docs.docker.com/engine/installation/>`__.
Requirements
------------
Description
-----------
Image for local testnets.
- `Install docker <https://docs.docker.com/engine/installation/>`__.
- `Install docker-compose <https://docs.docker.com/compose/install/>`__.
Add the tendermint binary to the image by attaching it in a folder to the `/tendermint` mount point.
Build
-----
It assumes that the configuration was created by the `tendermint testnet` command and it is also attached to the `/tendermint` mount point.
Build the `tendermint` binary and the `tendermint/localnode` docker image:
Example:
This example builds a linux tendermint binary under the `build/` folder, creates tendermint configuration for a single-node validator and runs the node:
```
cd $GOPATH/src/github.com/tendermint/tendermint
#Build binary
# Install dependencies (skip if already done)
make get_tools
make get_vendor_deps
# Build binary in ./build
make build-linux
#Create configuration
# Build tendermint/localnode image
make build-docker-localnode
```
Run a testnet
-------------
To start a 4 node testnet run:
```
make localnet-start
``
The nodes bind their RPC servers to ports 46657, 46660, 46662, and 46664 on the host.
This file creates a 4-node network using the localnode image.
The nodes of the network expose their P2P and RPC endpoints to the host machine on ports 46656-46657, 46659-46660, 46661-46662, and 46663-46664 respectively.
To update the binary, just rebuild it and restart the nodes:
```
make build-linux
make localnet-stop
make localnet-start
```
Configuration
-----------
The `make localnet-start` creates files for a 4-node testnet in `./build` by calling the `tendermint testnet` command.
The `./build` directory is mounted to the `/tendermint` mount point to attach the binary and config files to the container.
For instance, to create a single node testnet:
```
cd $GOPATH/src/github.com/tendermint/tendermint
# Clear the build folder
rm -rf ./build
# Build binary
make build-linux
# Create configuration
docker run -e LOG="stdout" -v `pwd`/build:/tendermint tendermint/localnode testnet --o . --v 1
#Run the node
docker run -v `pwd`/build:/tendermint tendermint/localnode
```
Logging
@ -34,7 +84,3 @@ Special binaries
----------------
If you have multiple binaries with different names, you can specify which one to run with the BINARY environment variable. The path of the binary is relative to the attached volume.
docker-compose.yml
==================
This file creates a 4-node network using the localnode image. The nodes of the network are exposed to the host machine on ports 46656-46657, 46659-46660, 46661-46662, 46663-46664 respectively.