diff --git a/DOCKER/README.md b/DOCKER/README.md index e60303c68..40d39f5b9 100644 --- a/DOCKER/README.md +++ b/DOCKER/README.md @@ -30,7 +30,7 @@ To get started developing applications, see the [application developers guide](h A quick example of a built-in app and Tendermint core in one container. -``` +```sh docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app=kvstore ``` @@ -39,9 +39,7 @@ docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app To run a 4-node network, see the `Makefile` in the root of [the repo](https://github.com/tendermint/tendermint/blob/master/Makefile) and run: -``` -make build-linux -make build-docker-localnode +```sh make localnet-start ``` diff --git a/Makefile b/Makefile index fe43c9c53..43a98cc22 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,7 @@ sync-docs: ### Docker image ### ############################################################################### -build-docker: +build-docker: build-linux cp $(OUTPUT) DOCKER/tendermint docker build --label=tendermint --tag="tendermint/tendermint" DOCKER rm -rf DOCKER/tendermint @@ -216,8 +216,8 @@ build_c-amazonlinux: .PHONY: build_c-amazonlinux # Run a 4-node testnet locally -localnet-start: localnet-stop build-docker-localnode - @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2; fi +localnet-start: localnet-stop build-linux + @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --o . --starting-ip-address 192.167.10.2; fi docker-compose up .PHONY: localnet-start diff --git a/docs/networks/docker-compose.md b/docs/networks/docker-compose.md index 1adb1c753..aacc90d3e 100644 --- a/docs/networks/docker-compose.md +++ b/docs/networks/docker-compose.md @@ -20,9 +20,7 @@ docker image. Note the binary will be mounted into the container so it can be updated without rebuilding the image. -``` -cd $GOPATH/src/github.com/tendermint/tendermint - +```sh # Build the linux binary in ./build make build-linux @@ -34,7 +32,7 @@ make build-docker-localnode To start a 4 node testnet run: -``` +```sh make localnet-start ``` @@ -48,9 +46,8 @@ on ports 26656-26657, 26659-26660, 26661-26662, and 26663-26664 respectively. To update the binary, just rebuild it and restart the nodes: -``` +```sh make build-linux -make localnet-stop make localnet-start ``` @@ -62,31 +59,46 @@ 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. -To change the number of validators / non-validators change the `localnet-start` Makefile target: +To change the number of validators / non-validators change the `localnet-start` Makefile target [here](../../makefile): -``` +```sh localnet-start: localnet-stop - @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 - docker-compose up + @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 + docker-compose up ``` The command now will generate config files for 5 validators and 3 -non-validators network. - -Before running it, don't forget to cleanup the old files: +non-validators. Along with generating new config files the docker-compose file needs to be edited. +Adding 4 more nodes is required in order to fully utilize the config files that were generated. +```yml + node3: # bump by 1 for every node + container_name: node3 # bump by 1 for every node + image: "tendermint/localnode" + environment: + - ID=3 + - LOG=${LOG:-tendermint.log} + ports: + - "26663-26664:26656-26657" # Bump 26663-26664 by one for every node + volumes: + - ./build:/tendermint:Z + networks: + localnet: + ipv4_address: 192.167.10.5 # bump the final digit by 1 for every node ``` -cd $GOPATH/src/github.com/tendermint/tendermint +Before running it, don't forget to cleanup the old files: + +```sh # Clear the build folder rm -rf ./build/node* ``` -## Configuring abci containers +## Configuring ABCI containers -To use your own abci applications with 4-node setup edit the [docker-compose.yaml](https://github.com/tendermint/tendermint/blob/master/docker-compose.yml) file and add image to your abci application. +To use your own ABCI applications with 4-node setup edit the [docker-compose.yaml](https://github.com/tendermint/tendermint/blob/master/docker-compose.yml) file and add image to your ABCI application. -``` +```yml abci0: container_name: abci0 image: "abci-image" @@ -133,9 +145,9 @@ To use your own abci applications with 4-node setup edit the [docker-compose.yam ``` -Override the [command](https://github.com/tendermint/tendermint/blob/master/networks/local/localnode/Dockerfile#L12) in each node to connect to it's abci. +Override the [command](https://github.com/tendermint/tendermint/blob/master/networks/local/localnode/Dockerfile#L12) in each node to connect to it's ABCI. -``` +```yml node0: container_name: node0 image: "tendermint/localnode" diff --git a/networks/local/localnode/Dockerfile b/networks/local/localnode/Dockerfile index 03af5aa3c..ac4bc6071 100644 --- a/networks/local/localnode/Dockerfile +++ b/networks/local/localnode/Dockerfile @@ -1,5 +1,4 @@ FROM alpine:3.7 -MAINTAINER Greg Szabo RUN apk update && \ apk upgrade && \