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.

85 lines
2.2 KiB

  1. # Docker Compose
  2. With Docker Compose, we can spin up local testnets in a single command:
  3. ```
  4. make localnet-start
  5. ```
  6. ## Requirements
  7. - [Install tendermint](/docs/install.md)
  8. - [Install docker](https://docs.docker.com/engine/installation/)
  9. - [Install docker-compose](https://docs.docker.com/compose/install/)
  10. ## Build
  11. Build the `tendermint` binary and the `tendermint/localnode` docker image.
  12. Note the binary will be mounted into the container so it can be updated without
  13. rebuilding the image.
  14. ```
  15. cd $GOPATH/src/github.com/tendermint/tendermint
  16. # Build the linux binary in ./build
  17. make build-linux
  18. # Build tendermint/localnode image
  19. make build-docker-localnode
  20. ```
  21. ## Run a testnet
  22. To start a 4 node testnet run:
  23. ```
  24. make localnet-start
  25. ```
  26. The nodes bind their RPC servers to ports 26657, 26660, 26662, and 26664 on the host.
  27. This file creates a 4-node network using the localnode image.
  28. 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.
  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 calling the `tendermint testnet` command.
  37. The `./build` directory is mounted to the `/tendermint` mount point to attach the binary and config files to the container.
  38. For instance, to create a single node testnet:
  39. ```
  40. cd $GOPATH/src/github.com/tendermint/tendermint
  41. # Clear the build folder
  42. rm -rf ./build
  43. # Build binary
  44. make build-linux
  45. # Create configuration
  46. docker run -e LOG="stdout" -v `pwd`/build:/tendermint tendermint/localnode testnet --o . --v 1
  47. #Run the node
  48. docker run -v `pwd`/build:/tendermint tendermint/localnode
  49. ```
  50. ## Logging
  51. 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.
  52. ## Special binaries
  53. 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.