You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.1 KiB

  1. # Local Cluster with Docker Compose
  2. ## Requirements
  3. - [Install tendermint](/docs/install.md)
  4. - [Install docker](https://docs.docker.com/engine/installation/)
  5. - [Install docker-compose](https://docs.docker.com/compose/install/)
  6. ## Build
  7. Build the `tendermint` binary and the `tendermint/localnode` docker image.
  8. Note the binary will be mounted into the container so it can be updated without
  9. rebuilding the image.
  10. ```
  11. cd $GOPATH/src/github.com/tendermint/tendermint
  12. # Build the linux binary in ./build
  13. make build-linux
  14. # Build tendermint/localnode image
  15. make build-docker-localnode
  16. ```
  17. ## Run a testnet
  18. To start a 4 node testnet run:
  19. ```
  20. make localnet-start
  21. ```
  22. The nodes bind their RPC servers to ports 26657, 26660, 26662, and 26664 on the host.
  23. This file creates a 4-node network using the localnode image.
  24. The nodes of the network expose their P2P and RPC endpoints to the host machine on ports 26656-26657, 26659-26660, 26661-26662, and 26663-26664 respectively.
  25. To update the binary, just rebuild it and restart the nodes:
  26. ```
  27. make build-linux
  28. make localnet-stop
  29. make localnet-start
  30. ```
  31. ## Configuration
  32. The `make localnet-start` creates files for a 4-node testnet in `./build` by calling the `tendermint testnet` command.
  33. The `./build` directory is mounted to the `/tendermint` mount point to attach the binary and config files to the container.
  34. For instance, to create a single node testnet:
  35. ```
  36. cd $GOPATH/src/github.com/tendermint/tendermint
  37. # Clear the build folder
  38. rm -rf ./build
  39. # Build binary
  40. make build-linux
  41. # Create configuration
  42. docker run -e LOG="stdout" -v `pwd`/build:/tendermint tendermint/localnode testnet --o . --v 1
  43. #Run the node
  44. docker run -v `pwd`/build:/tendermint tendermint/localnode
  45. ```
  46. ## Logging
  47. Log is saved under the attached volume, in the `tendermint.log` file. If the `LOG` environment variable is set to `stdout` at start, the log is not saved, but printed on the screen.
  48. ## Special binaries
  49. 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.