Browse Source

Merge pull request #1453 from tendermint/fix-localnet

Fix permissions and folder structure for localnet
pull/1461/head
Anton Kaliaev 7 years ago
committed by GitHub
parent
commit
c28784de5e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 16 deletions
  1. +1
    -1
      Makefile
  2. +9
    -9
      docker-compose.yml
  3. +2
    -5
      docker-compose/localnode/Dockerfile
  4. +3
    -1
      p2p/switch.go

+ 1
- 1
Makefile View File

@ -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 192.167.10.2 ; fi
docker-compose up
# Stop testnet


+ 9
- 9
docker-compose.yml View File

@ -10,10 +10,10 @@ services:
- ID=0
- LOG=${LOG:-tendermint.log}
volumes:
- ${FOLDER:-./build}:/tendermint
- ${FOLDER:-./build}:/tendermint:Z
networks:
localnet:
ipv4_address: 10.100.0.2
ipv4_address: 192.167.10.2
node1:
container_name: node1
@ -24,10 +24,10 @@ services:
- ID=1
- LOG=${LOG:-tendermint.log}
volumes:
- ${FOLDER:-./build}:/tendermint
- ${FOLDER:-./build}:/tendermint:Z
networks:
localnet:
ipv4_address: 10.100.0.3
ipv4_address: 192.167.10.3
node2:
container_name: node2
@ -38,10 +38,10 @@ services:
ports:
- "46661-46662:46656-46657"
volumes:
- ${FOLDER:-./build}:/tendermint
- ${FOLDER:-./build}:/tendermint:Z
networks:
localnet:
ipv4_address: 10.100.0.4
ipv4_address: 192.167.10.4
node3:
container_name: node3
@ -52,10 +52,10 @@ services:
ports:
- "46663-46664:46656-46657"
volumes:
- ${FOLDER:-./build}:/tendermint
- ${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

+ 2
- 5
docker-compose/localnode/Dockerfile View File

@ -3,11 +3,8 @@ MAINTAINER Greg Szabo <greg@tendermint.com>
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

+ 3
- 1
p2p/switch.go View File

@ -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.


Loading…
Cancel
Save