Browse Source

update networks/local readme

pull/1598/head
Ethan Buchman 6 years ago
parent
commit
d7d12c8030
3 changed files with 68 additions and 15 deletions
  1. +4
    -0
      Makefile
  2. +5
    -2
      docs/using-tendermint.rst
  3. +59
    -13
      networks/local/README.rst

+ 4
- 0
Makefile 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


+ 5
- 2
docs/using-tendermint.rst 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
---


+ 59
- 13
networks/local/README.rst View File

@ -1,29 +1,79 @@
localnode
=========
It is assumed that you have already `setup docker <https://docs.docker.com/engine/installation/>`__.
Requirements
------------
Description
- `Install docker <https://docs.docker.com/engine/installation/>`__.
- `Install docker-compose <https://docs.docker.com/compose/install/>`__.
Build
-----
Build the `tendermint` binary and the `tendermint/localnode` docker image:
```
cd $GOPATH/src/github.com/tendermint/tendermint
# Install dependencies (skip if already done)
make get_tools
make get_vendor_deps
# Build binary in ./build
make build-linux
# 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
-----------
Image for local testnets.
Add the tendermint binary to the image by attaching it in a folder to the `/tendermint` mount point.
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.
It assumes that the configuration was created by the `tendermint testnet` command and it is also attached to the `/tendermint` mount point.
For instance, to create a single node testnet:
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
# Clear the build folder
rm -rf ./build
# Build binary
make build-linux
#Create configuration
# 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.

Loading…
Cancel
Save