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.

91 lines
2.4 KiB

  1. # Docker Compose
  2. With Docker Compose, you can spin up local testnets with a single command.
  3. ## Requirements
  4. 1. [Install tendermint](/docs/introduction/install.md)
  5. 2. [Install docker](https://docs.docker.com/engine/installation/)
  6. 3. [Install docker-compose](https://docs.docker.com/compose/install/)
  7. ## Build
  8. Build the `tendermint` binary and, optionally, the `tendermint/localnode`
  9. docker image.
  10. Note the binary will be mounted into the container so it can be updated without
  11. rebuilding the image.
  12. ```
  13. cd $GOPATH/src/github.com/tendermint/tendermint
  14. # Build the linux binary in ./build
  15. make build-linux
  16. # (optionally) Build tendermint/localnode image
  17. make build-docker-localnode
  18. ```
  19. ## Run a testnet
  20. To start a 4 node testnet run:
  21. ```
  22. make localnet-start
  23. ```
  24. The nodes bind their RPC servers to ports 26657, 26660, 26662, and 26664 on the
  25. host.
  26. This file creates a 4-node network using the localnode image.
  27. The nodes of the network expose their P2P and RPC endpoints to the host machine
  28. on ports 26656-26657, 26659-26660, 26661-26662, and 26663-26664 respectively.
  29. To update the binary, just rebuild it and restart the nodes:
  30. ```
  31. make build-linux
  32. make localnet-stop
  33. make localnet-start
  34. ```
  35. ## Configuration
  36. The `make localnet-start` creates files for a 4-node testnet in `./build` by
  37. calling the `tendermint testnet` command.
  38. The `./build` directory is mounted to the `/tendermint` mount point to attach
  39. the binary and config files to the container.
  40. To change the number of validators / non-validators change the `localnet-start` Makefile target:
  41. ```
  42. localnet-start: localnet-stop
  43. @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --v 5 --n 3 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2 ; fi
  44. docker-compose up
  45. ```
  46. The command now will generate config files for 5 validators and 3
  47. non-validators network.
  48. Before running it, don't forget to cleanup the old files:
  49. ```
  50. cd $GOPATH/src/github.com/tendermint/tendermint
  51. # Clear the build folder
  52. rm -rf ./build/node*
  53. ```
  54. ## Logging
  55. Log is saved under the attached volume, in the `tendermint.log` file. If the
  56. `LOG` environment variable is set to `stdout` at start, the log is not saved,
  57. but printed on the screen.
  58. ## Special binaries
  59. If you have multiple binaries with different names, you can specify which one
  60. to run with the `BINARY` environment variable. The path of the binary is relative
  61. to the attached volume.