forked from Fantom-foundation/Sonic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
a.guzev
committed
Apr 16, 2019
1 parent
442f07d
commit 6889b32
Showing
7 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# PoS-Lachesis node | ||
|
||
Package assembles functionality of [network node](../posnode/) and [consensus](../posposet/) into solid Lachesis-node. | ||
|
||
|
||
### Executables | ||
|
||
[`cmd/`](./cmd/) - contains cli (only for fakenet now): | ||
|
||
- run single node: `go run main.go`; | ||
- for args see `go run main.go --help`; | ||
- build: `go build .`; | ||
|
||
|
||
### Docker | ||
|
||
[`docker/`](./docker/) - contains docker scripts to try lachesis fakenet: | ||
|
||
- build node docker image "pos-lachesis": `make`; | ||
- run network of N nodes: `n=N ./start.sh`; | ||
- drop network: `./stop.sh`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM golang:1.12 as build | ||
|
||
WORKDIR /go/src/github.com/Fantom-foundation/go-lachesis | ||
COPY . . | ||
|
||
RUN go get github.com/Masterminds/glide | ||
|
||
RUN glide install && CGO_ENABLED=0 go build -ldflags "-s -w" -o /tmp/lachesis ./src/poslachesis/cmd | ||
|
||
|
||
|
||
FROM scratch as prod | ||
|
||
COPY --from=build /tmp/lachesis / | ||
|
||
EXPOSE 55555 55556 | ||
|
||
ENTRYPOINT ["/lachesis"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.PHONY: build start stop | ||
|
||
all: build | ||
|
||
|
||
build: | ||
cd ../../.. && docker build -f src/poslachesis/docker/Dockerfile -t "pos-lachesis" . | ||
|
||
start: | ||
./start.sh | ||
|
||
stop: | ||
./stop.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
declare -ri n="${n:-3}" | ||
|
||
docker network create lachesis | ||
|
||
limit_cpu=$(echo "scale=2; 1/$n" | bc) | ||
limit_io=$(echo "500/$n" | bc) | ||
limits="--cpus=${limit_cpu} --blkio-weight=${limit_io}" | ||
|
||
for i in $(seq $n) | ||
do | ||
j=$(($i % $n + 1)) # ring | ||
docker run -d --rm --name=pos-lachesis-node-$i ${limits} --net=lachesis "pos-lachesis" --fakegen=$i/$n --db=/tmp --peer=pos-lachesis-node-$j | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker ps -q --filter "network=lachesis" | while read id | ||
do | ||
docker stop $id | ||
done | ||
|
||
docker network rm lachesis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters