Skip to content

Commit

Permalink
feat: Setting up test network (#41)
Browse files Browse the repository at this point in the history
* Setting up a test network 

closes issue #12
BREAKING CHANGE: makeup Build/Dockerize Commands
closes issue #1
closes issue #15
closes issue #33
  • Loading branch information
jeehonglee authored Sep 18, 2019
1 parent 8c4fba8 commit aef1585
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ jobs:
set -x
make get-tools
make build-linux
make build-docker-linkdnode
make localnet-start
make build-docker-testnet
make build-conf-testnet
make start-testnet
./contrib/localnet-blocks-test.sh 40 5 10 localhost
workflows:
Expand Down
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,21 @@ benchmark:
########################################
### Local validator nodes using docker and docker-compose

build-docker-linkdnode:
$(MAKE) -C networks/local
build-docker-testnet:
$(MAKE) -C $(CURDIR)/networks/local

build-conf-testnet:
rm -rf $(CURDIR)/build/gentxs
rm -rf $(CURDIR)/build/node*
docker run --rm -v $(CURDIR)/build:/linkd:Z line/linkdnode testnet --v 4 -o . --starting-ip-address 192.168.10.2


# Run a 4-node testnet locally
localnet-start: localnet-stop
@if ! [ -f build/node0/linkd/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/linkd:Z line/linkdnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 ; fi
start-testnet: stop-testnet
docker-compose up -d

# Stop testnet
localnet-stop:
stop-testnet:
docker-compose down

########################################
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ make check-build # integration test (/cli_test)
### Test Net
```
make build-linux # Cross-compile the binaries for linux/amd64
make build-docker-linkdnode # Build docker image for local test
make localnet-start # Boot up local test network with 4 validator nodes
make localnet-stop # Stop the network
make build-docker-testnet # Build docker image for testnet
make build-conf-testnet # Build configurations for testnet
make start-testnet # Boot up testnet network with 4 validator nodes
make stop-testnet # Stop the testnet
```


Expand Down
1 change: 1 addition & 0 deletions networks/local/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Makefile for the "linkdnode" docker image.

all:
docker rmi -f line/linkdnode
docker build --tag line/linkdnode linkdnode

.PHONY: all
Expand Down
14 changes: 8 additions & 6 deletions networks/local/linkdnode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
FROM alpine:3.7
MAINTAINER Greg Szabo <greg@tendermint.com>
MAINTAINER LinkChain <dl_linkchain_v2_dev@linecorp.com>

RUN apk update && \
apk upgrade && \
apk --no-cache add curl jq file
apk add --update --no-cache autoconf bash jq file curl git lsof wget iputils vim busybox-extras

VOLUME [ /linkd ]
ENV LINKCLIHOME /linkd
ENV PATH="$PATH:$LINKCLIHOME"

STOPSIGNAL SIGTERM
COPY wrapper.sh /usr/bin/wrapper.sh
WORKDIR /linkd

EXPOSE 26656 26657
ENTRYPOINT ["/usr/bin/wrapper.sh"]
CMD ["start"]
STOPSIGNAL SIGTERM

COPY wrapper.sh /usr/bin/wrapper.sh

2 changes: 1 addition & 1 deletion networks/local/linkdnode/wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
##
## Run binary with all parameters
##
export LINKDHOME="/linkd/node${ID}/linkd"
export LINKDHOME="${LINKDHOME:-/linkd/node${ID}/linkd}"

if [ -d "`dirname ${LINKDHOME}/${LOG}`" ]; then
"$BINARY" --home "$LINKDHOME" "$@" | tee "${LINKDHOME}/${LOG}"
Expand Down

0 comments on commit aef1585

Please sign in to comment.