From 5babaf9a882a1040d71de4582d66c69257a96c7d Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 12 Apr 2018 13:42:34 +0200 Subject: [PATCH 1/4] [localnet] fix folder permissions errors --- Makefile | 2 +- docker-compose.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 333553e53..c2b6ac7b7 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,7 @@ build-linux: # Run a 4-node testnet locally docker-start: @echo "Wait until 'Attaching to node0, node1, node2, node3' message appears" - @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v `pwd`/build:/tendermint tendermint/localnode testnet --v 4 --o build --populate-persistent-peers --starting-ip-address 10.100.0.2 ; fi + @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v `pwd`/build:/tendermint:Z tendermint/localnode testnet --v 4 --o . --populate-persistent-peers --starting-ip-address 10.100.0.2 ; fi docker-compose up # Stop testnet diff --git a/docker-compose.yml b/docker-compose.yml index cc76d8dbf..f474be961 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: - ID=0 - LOG=${LOG:-tendermint.log} volumes: - - ${FOLDER:-./build}:/tendermint + - ${FOLDER:-./build}:/tendermint:Z networks: localnet: ipv4_address: 10.100.0.2 @@ -24,7 +24,7 @@ services: - ID=1 - LOG=${LOG:-tendermint.log} volumes: - - ${FOLDER:-./build}:/tendermint + - ${FOLDER:-./build}:/tendermint:Z networks: localnet: ipv4_address: 10.100.0.3 @@ -38,7 +38,7 @@ services: ports: - "46661-46662:46656-46657" volumes: - - ${FOLDER:-./build}:/tendermint + - ${FOLDER:-./build}:/tendermint:Z networks: localnet: ipv4_address: 10.100.0.4 @@ -52,7 +52,7 @@ services: ports: - "46663-46664:46656-46657" volumes: - - ${FOLDER:-./build}:/tendermint + - ${FOLDER:-./build}:/tendermint:Z networks: localnet: ipv4_address: 10.100.0.5 From f8ed5783254ef98b2622e45495ce2784c288964a Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 12 Apr 2018 13:44:13 +0200 Subject: [PATCH 2/4] [localnet] execute cmd from root not secure, but we don't care because it's local tooling --- docker-compose/localnode/Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docker-compose/localnode/Dockerfile b/docker-compose/localnode/Dockerfile index 9e5c4f8e2..7eeba963d 100644 --- a/docker-compose/localnode/Dockerfile +++ b/docker-compose/localnode/Dockerfile @@ -3,11 +3,8 @@ MAINTAINER Greg Szabo RUN apk update && \ apk upgrade && \ - apk --no-cache add curl jq file && \ - addgroup tmuser && \ - adduser -S -G tmuser tmuser -h /tendermint + apk --no-cache add curl jq file -USER tmuser VOLUME [ /tendermint ] WORKDIR /tendermint EXPOSE 46656 46657 @@ -15,5 +12,5 @@ ENTRYPOINT ["/usr/bin/wrapper.sh"] CMD ["node", "--proxy_app dummy"] STOPSIGNAL SIGTERM -COPY --chown=tmuser:tmuser wrapper.sh /usr/bin/wrapper.sh +COPY wrapper.sh /usr/bin/wrapper.sh From 3a0edc561d8a2144a10e3da37af48b831933d128 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 12 Apr 2018 15:20:28 +0200 Subject: [PATCH 3/4] log error from AddrBook#AddAddress in DialPeersAsync Refs #1434 --- p2p/switch.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/p2p/switch.go b/p2p/switch.go index be7c0ec7a..6afc30fe4 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -359,7 +359,9 @@ func (sw *Switch) DialPeersAsync(addrBook AddrBook, peers []string, persistent b for _, netAddr := range netAddrs { // do not add our address or ID if !netAddr.Same(ourAddr) { - addrBook.AddAddress(netAddr, ourAddr) + if err := addrBook.AddAddress(netAddr, ourAddr); err != nil { + sw.Logger.Error("Can't add peer's address to addrbook", "err", err) + } } } // Persist some peers to disk right away. From d06390638db7efc870dbf8c7d3bd57bae12dabb5 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 12 Apr 2018 15:33:32 +0200 Subject: [PATCH 4/4] [localnet] use routable IPs --- Makefile | 2 +- docker-compose.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c2b6ac7b7..da94627d3 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,7 @@ build-linux: # Run a 4-node testnet locally docker-start: @echo "Wait until 'Attaching to node0, node1, node2, node3' message appears" - @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v `pwd`/build:/tendermint:Z tendermint/localnode testnet --v 4 --o . --populate-persistent-peers --starting-ip-address 10.100.0.2 ; fi + @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v `pwd`/build:/tendermint:Z tendermint/localnode testnet --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2 ; fi docker-compose up # Stop testnet diff --git a/docker-compose.yml b/docker-compose.yml index f474be961..b9a3fc684 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - ${FOLDER:-./build}:/tendermint:Z networks: localnet: - ipv4_address: 10.100.0.2 + ipv4_address: 192.167.10.2 node1: container_name: node1 @@ -27,7 +27,7 @@ services: - ${FOLDER:-./build}:/tendermint:Z networks: localnet: - ipv4_address: 10.100.0.3 + ipv4_address: 192.167.10.3 node2: container_name: node2 @@ -41,7 +41,7 @@ services: - ${FOLDER:-./build}:/tendermint:Z networks: localnet: - ipv4_address: 10.100.0.4 + ipv4_address: 192.167.10.4 node3: container_name: node3 @@ -55,7 +55,7 @@ services: - ${FOLDER:-./build}:/tendermint:Z networks: localnet: - ipv4_address: 10.100.0.5 + ipv4_address: 192.167.10.5 networks: localnet: @@ -64,5 +64,5 @@ networks: driver: default config: - - subnet: 10.100.0.0/16 + subnet: 192.167.10.0/16