Adds basic docker-compose support for standing up a cluster (#74)

* Adds docker-compose support

* Remove old config

* Bump port numbers so doesnt conflict with running dev version

* Update privnet node  list
This commit is contained in:
Steven Jack 2018-04-28 19:20:27 +01:00 committed by Anthony De Meulemeester
parent 648563c3e2
commit 68ca254dd2
9 changed files with 155 additions and 3 deletions

View file

@ -10,6 +10,7 @@ ADD bin/neo-go /usr/bin/neo-go
ADD config /config ADD config /config
RUN chmod u+x /usr/bin/neo-go RUN chmod u+x /usr/bin/neo-go
RUN mkdir -p /chains
ENTRYPOINT ["neo-go"] ENTRYPOINT ["neo-go"]
CMD ["node", "--config-path", "./config", "--testnet"] CMD ["node", "--config-path", "./config", "--testnet"]

View file

@ -5,14 +5,25 @@ REPONAME = "neo-go"
NETMODE ?= "privnet" NETMODE ?= "privnet"
build: build:
@go build -ldflags "-X github.com/CityOfZion/neo-go/config.Version=${VERSION}-dev -X github.com/CityOfZion/neo-go/config.BuildTime=${BUILD_TIME}" -o ./bin/neo-go ./cli/main.go @echo "=> Building darwin binary"
@go build -i -ldflags "-X github.com/CityOfZion/neo-go/config.Version=${VERSION}-dev -X github.com/CityOfZion/neo-go/config.BuildTime=${BUILD_TIME}" -o ./bin/neo-go ./cli/main.go
build-image: build-image:
docker build -t cityofzion/neo-go --build-arg VERSION=${VERSION} . docker build -t cityofzion/neo-go --build-arg VERSION=${VERSION} .
build-linux:
@echo "=> Building linux binary"
@GOOS=linux go build -i -ldflags "-X github.com/CityOfZion/neo-go/config.Version=${VERSION}-dev -X github.com/CityOfZion/neo-go/config.BuildTime=${BUILD_TIME}" -o ./bin/neo-go ./cli/main.go
check-version: check-version:
git fetch && (! git rev-list ${VERSION}) git fetch && (! git rev-list ${VERSION})
clean-cluster:
@echo "=> Removing all containers and chain storage"
@rm -rf chains/privnet-docker-one chains/privnet-docker-two chains/privnet-docker-three chains/privnet-docker-four
@docker-compose stop
@docker-compose rm -f
deps: deps:
@dep ensure @dep ensure
@ -31,6 +42,14 @@ push-to-registry:
run: build run: build
./bin/neo-go node -config-path ./config -${NETMODE} ./bin/neo-go node -config-path ./config -${NETMODE}
run-cluster: build-linux
@echo "=> Starting docker-compose cluster"
@echo "=> Building container image"
@docker-compose build
@docker-compose up -d
@echo "=> Tailing logs, exiting this prompt will not stop the cluster"
@docker-compose logs -f
test: test:
@go test ./... -cover @go test ./... -cover

View file

@ -1 +1 @@
0.42.0 0.43.0

View file

@ -0,0 +1,26 @@
ProtocolConfiguration:
Magic: 56753
AddressVersion: 23
StandbyValidators:
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
- 03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699
- 02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62
SeedList:
- node_one:20334
- node_two:20335
- node_three:20336
SystemFee:
EnrollmentTransaction: 1000
IssueTransaction: 500
PublishTransaction: 500
RegisterTransaction: 10000
ApplicationConfiguration:
DataDirectoryPath: "/chains/privnet"
RPCPort: 20336
NodePort: 20337
Relay: true
DialTimeout: 3
ProtoTickInterval: 2
MaxPeers: 50

View file

@ -0,0 +1,23 @@
ProtocolConfiguration:
Magic: 56753
AddressVersion: 23
StandbyValidators:
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
- 03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699
- 02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62
SeedList: []
SystemFee:
EnrollmentTransaction: 1000
IssueTransaction: 500
PublishTransaction: 500
RegisterTransaction: 10000
ApplicationConfiguration:
DataDirectoryPath: "/chains/privnet"
RPCPort: 20333
NodePort: 20334
Relay: true
DialTimeout: 3
ProtoTickInterval: 2
MaxPeers: 50

View file

@ -0,0 +1,23 @@
ProtocolConfiguration:
Magic: 56753
AddressVersion: 23
StandbyValidators:
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
- 03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699
- 02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62
SeedList: []
SystemFee:
EnrollmentTransaction: 1000
IssueTransaction: 500
PublishTransaction: 500
RegisterTransaction: 10000
ApplicationConfiguration:
DataDirectoryPath: "/chains/privnet"
RPCPort: 20335
NodePort: 20336
Relay: true
DialTimeout: 3
ProtoTickInterval: 2
MaxPeers: 50

View file

@ -0,0 +1,23 @@
ProtocolConfiguration:
Magic: 56753
AddressVersion: 23
StandbyValidators:
- 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2
- 02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e
- 03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699
- 02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62
SeedList: []
SystemFee:
EnrollmentTransaction: 1000
IssueTransaction: 500
PublishTransaction: 500
RegisterTransaction: 10000
ApplicationConfiguration:
DataDirectoryPath: "/chains/privnet"
RPCPort: 20334
NodePort: 20335
Relay: true
DialTimeout: 3
ProtoTickInterval: 2
MaxPeers: 50

View file

@ -7,7 +7,6 @@ ProtocolConfiguration:
- 03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699 - 03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699
- 02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62 - 02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62
SeedList: SeedList:
- 127.0.0.1:20333
- 127.0.0.1:20334 - 127.0.0.1:20334
- 127.0.0.1:20335 - 127.0.0.1:20335
- 127.0.0.1:20336 - 127.0.0.1:20336

38
docker-compose.yml Normal file
View file

@ -0,0 +1,38 @@
version: '3'
services:
node_one:
build: .
volumes:
- ./config/protocol.privnet.docker.one.yml:/config/protocol.privnet.yml
- ./chains/privnet-docker-one:/chains/privnet
ports:
- 20334:20334
command: "node --config-path /config --privnet"
node_two:
build: .
volumes:
- ./config/protocol.privnet.docker.two.yml:/config/protocol.privnet.yml
- ./chains/privnet-docker-two:/chains/privnet
ports:
- 20335:20335
command: "node --config-path /config --privnet"
node_three:
build: .
volumes:
- ./config/protocol.privnet.docker.three.yml:/config/protocol.privnet.yml
- ./chains/privnet-docker-three:/chains/privnet
ports:
- 20336:20336
command: "node --config-path /config --privnet"
node_four:
build: .
volumes:
- ./config/protocol.privnet.docker.four.yml:/config/protocol.privnet.yml
- ./chains/privnet-docker-four:/chains/privnet
ports:
- 20337:20337
command: "node --config-path /config --privnet"
depends_on:
- node_one
- node_two
- node_three