This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile, environment, and PBFT client
Signed-off-by: Bridger Herman <bridger@bitwise.io>
- Loading branch information
Bridger Herman
committed
Jul 23, 2018
1 parent
078257f
commit 7005eac
Showing
7 changed files
with
358 additions
and
11 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,5 @@ | ||
|
||
/target | ||
**/*.rs.bk | ||
*.swp | ||
/src/protos |
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,5 @@ | ||
ISOLATION_ID=latest | ||
INSTALL_TYPE=local | ||
SAWTOOTH_CORE=/Users/bridger/sawtooth/sawtooth-core | ||
SAWTOOTH_PBFT=/Users/bridger/sawtooth/sawtooth-pbft | ||
SAWTOOTH_RAFT=/Users/bridger/sawtooth/sawtooth-raft-1 |
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,45 @@ | ||
# Copyright 2018 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ------------------------------------------------------------------------------ | ||
|
||
FROM ubuntu:xenial | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y -q --allow-downgrades \ | ||
build-essential \ | ||
curl \ | ||
libssl-dev \ | ||
gcc \ | ||
git \ | ||
libzmq3-dev \ | ||
openssl \ | ||
pkg-config \ | ||
unzip \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -OLsS https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip \ | ||
&& unzip protoc-3.5.1-linux-x86_64.zip -d protoc3 \ | ||
&& rm protoc-3.5.1-linux-x86_64.zip | ||
|
||
RUN curl https://sh.rustup.rs -sSf > /usr/bin/rustup-init \ | ||
&& chmod +x /usr/bin/rustup-init \ | ||
&& rustup-init -y | ||
|
||
ENV PATH=$PATH:/protoc3/bin:/project/sawtooth-core/bin:/root/.cargo/bin \ | ||
CARGO_INCREMENTAL=0 | ||
|
||
WORKDIR /project/sawtooth-pbft | ||
|
||
CMD cargo build |
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
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
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,4 @@ | ||
#!/bin/bash | ||
|
||
docker-compose -f tests/pbft_client.yaml up; | ||
docker-compose -f tests/pbft_client.yaml down |
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,291 @@ | ||
# Copyright 2018 Bitwise IO, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ------------------------------------------------------------------------------ | ||
|
||
version: "2.1" | ||
|
||
volumes: | ||
keys: | ||
|
||
services: | ||
validator-0: | ||
image: sawtooth-validator:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
- keys:/shared_keys | ||
expose: | ||
- 4004 | ||
- 8800 | ||
- 5005 | ||
working_dir: /root | ||
command: "bash -c \"\ | ||
sawadm keygen validator-1 && \ | ||
sawadm keygen validator-2 && \ | ||
sawadm keygen validator-3 && \ | ||
sawadm keygen && \ | ||
sawset genesis \ | ||
-k /etc/sawtooth/keys/validator.priv \ | ||
-o config-genesis.batch && \ | ||
sawset proposal create \ | ||
-k /etc/sawtooth/keys/validator.priv \ | ||
sawtooth.consensus.algorithm=None \ | ||
sawtooth.consensus.pbft.peers=\\{'\\\"'$$(cat /etc/sawtooth/keys/validator.pub)'\\\"':0,'\\\"'$$(cat /etc/sawtooth/keys/validator-1.pub)'\\\"':1,'\\\"'$$(cat /etc/sawtooth/keys/validator-2.pub)'\\\"':2,'\\\"'$$(cat /etc/sawtooth/keys/validator-3.pub)'\\\"':3\\} \ | ||
sawtooth.consensus.pbft.block_duration=2000 \ | ||
sawtooth.consensus.pbft.checkpoint_period=10 \ | ||
sawtooth.consensus.pbft.view_change_timeout=4000 \ | ||
sawtooth.consensus.pbft.message_timeout=10 \ | ||
sawtooth.consensus.pbft.max_log_size=1000 \ | ||
-o config.batch && \ | ||
sawadm genesis \ | ||
config-genesis.batch config.batch && \ | ||
mv /etc/sawtooth/keys/validator-* /shared_keys && \ | ||
echo $$(cat /etc/sawtooth/keys/validator.pub); \ | ||
sawtooth-validator -v \ | ||
--endpoint tcp://validator-0:8800 \ | ||
--bind component:tcp://eth0:4004 \ | ||
--bind network:tcp://eth0:8800 \ | ||
--bind consensus:tcp://eth0:5050 \ | ||
--peering static \ | ||
--peers tcp://validator-1:8800,tcp://validator-2:8800,tcp://validator-3:8800 | ||
--scheduler parallel \ | ||
\"" | ||
stop_signal: SIGKILL | ||
|
||
validator-1: | ||
image: sawtooth-validator:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
- keys:/shared_keys | ||
expose: | ||
- 4004 | ||
- 8800 | ||
command: "bash -c \"\ | ||
while true; do if [ -e /shared_keys/validator-1.pub ]; then mv /shared_keys/validator-1.priv /etc/sawtooth/keys/validator.priv && mv /shared_keys/validator-1.pub /etc/sawtooth/keys/validator.pub; break; fi; sleep 0.5; done; \ | ||
echo $$(cat /etc/sawtooth/keys/validator.pub); \ | ||
sawtooth-validator \ | ||
--endpoint tcp://validator-1:8800 \ | ||
--bind component:tcp://eth0:4004 \ | ||
--bind network:tcp://eth0:8800 \ | ||
--bind consensus:tcp://eth0:5050 \ | ||
--peering static \ | ||
--peers tcp://validator-0:8800,tcp://validator-2:8800,tcp://validator-3:8800 | ||
--scheduler parallel \ | ||
\"" | ||
stop_signal: SIGKILL | ||
|
||
validator-2: | ||
image: sawtooth-validator:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
- keys:/shared_keys | ||
expose: | ||
- 4004 | ||
- 8800 | ||
command: "bash -c \"\ | ||
while true; do if [ -e /shared_keys/validator-2.pub ]; then mv /shared_keys/validator-2.priv /etc/sawtooth/keys/validator.priv && mv /shared_keys/validator-2.pub /etc/sawtooth/keys/validator.pub; break; fi; sleep 0.5; done; \ | ||
echo $$(cat /etc/sawtooth/keys/validator.pub); \ | ||
sawtooth-validator \ | ||
--endpoint tcp://validator-2:8800 \ | ||
--bind component:tcp://eth0:4004 \ | ||
--bind network:tcp://eth0:8800 \ | ||
--bind consensus:tcp://eth0:5050 \ | ||
--peering static \ | ||
--peers tcp://validator-0:8800,tcp://validator-1:8800,tcp://validator-3:8800 | ||
--scheduler parallel \ | ||
\"" | ||
stop_signal: SIGKILL | ||
|
||
validator-3: | ||
image: sawtooth-validator:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
- keys:/shared_keys | ||
expose: | ||
- 4004 | ||
- 8800 | ||
command: "bash -c \"\ | ||
while true; do if [ -e /shared_keys/validator-3.pub ]; then mv /shared_keys/validator-3.priv /etc/sawtooth/keys/validator.priv && mv /shared_keys/validator-3.pub /etc/sawtooth/keys/validator.pub; break; fi; sleep 0.5; done; \ | ||
echo $$(cat /etc/sawtooth/keys/validator.pub); \ | ||
sawtooth-validator \ | ||
--endpoint tcp://validator-3:8800 \ | ||
--bind component:tcp://eth0:4004 \ | ||
--bind network:tcp://eth0:8800 \ | ||
--bind consensus:tcp://eth0:5050 \ | ||
--peering static \ | ||
--peers tcp://validator-0:8800,tcp://validator-1:8800,tcp://validator-2:8800 | ||
--scheduler parallel \ | ||
\"" | ||
stop_signal: SIGKILL | ||
|
||
pbft-0: | ||
image: sawtooth-dev-pbft:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_PBFT:/project/sawtooth-pbft | ||
working_dir: /project/sawtooth-pbft/ | ||
command: ./target/debug/sawtooth-pbft --connect tcp://validator-0:5050 0 -d 15 -vv | ||
stop_signal: SIGKILL | ||
|
||
pbft-1: | ||
image: sawtooth-dev-pbft:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_PBFT:/project/sawtooth-pbft | ||
working_dir: /project/sawtooth-pbft/ | ||
command: ./target/debug/sawtooth-pbft --connect tcp://validator-1:5050 1 -vv | ||
stop_signal: SIGKILL | ||
|
||
pbft-2: | ||
image: sawtooth-dev-pbft:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_PBFT:/project/sawtooth-pbft | ||
working_dir: /project/sawtooth-pbft/ | ||
command: ./target/debug/sawtooth-pbft --connect tcp://validator-2:5050 2 | ||
stop_signal: SIGKILL | ||
|
||
pbft-3: | ||
image: sawtooth-dev-pbft:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_PBFT:/project/sawtooth-pbft | ||
working_dir: /project/sawtooth-pbft/ | ||
command: ./target/debug/sawtooth-pbft --connect tcp://validator-3:5050 3 | ||
stop_signal: SIGKILL | ||
|
||
rest-api-0: | ||
image: sawtooth-rest-api:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
- 8008 | ||
command: sawtooth-rest-api --connect tcp://validator-0:4004 --bind rest-api-0:8008 | ||
stop_signal: SIGKILL | ||
|
||
rest-api-1: | ||
image: sawtooth-rest-api:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
- 8008 | ||
command: sawtooth-rest-api --connect tcp://validator-1:4004 --bind rest-api-1:8008 | ||
stop_signal: SIGKILL | ||
|
||
rest-api-2: | ||
image: sawtooth-rest-api:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
- 8008 | ||
command: sawtooth-rest-api --connect tcp://validator-2:4004 --bind rest-api-2:8008 | ||
stop_signal: SIGKILL | ||
|
||
rest-api-3: | ||
image: sawtooth-rest-api:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
- 8008 | ||
command: sawtooth-rest-api --connect tcp://validator-3:4004 --bind rest-api-3:8008 | ||
stop_signal: SIGKILL | ||
|
||
xo-tp-0: | ||
image: sawtooth-xo-tp-python:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: xo-tp-python -C tcp://validator-0:4004 | ||
stop_signal: SIGKILL | ||
|
||
xo-tp-1: | ||
image: sawtooth-xo-tp-python:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: xo-tp-python -C tcp://validator-1:4004 | ||
stop_signal: SIGKILL | ||
|
||
xo-tp-2: | ||
image: sawtooth-xo-tp-python:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: xo-tp-python -C tcp://validator-2:4004 | ||
stop_signal: SIGKILL | ||
|
||
xo-tp-3: | ||
image: sawtooth-xo-tp-python:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: xo-tp-python -C tcp://validator-3:4004 | ||
stop_signal: SIGKILL | ||
|
||
settings-tp-0: | ||
image: sawtooth-settings-tp:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: settings-tp -C tcp://validator-0:4004 | ||
stop_signal: SIGKILL | ||
|
||
settings-tp-1: | ||
image: sawtooth-settings-tp:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: settings-tp -C tcp://validator-1:4004 | ||
stop_signal: SIGKILL | ||
|
||
settings-tp-2: | ||
image: sawtooth-settings-tp:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: settings-tp -C tcp://validator-2:4004 | ||
stop_signal: SIGKILL | ||
|
||
settings-tp-3: | ||
image: sawtooth-settings-tp:$ISOLATION_ID | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
expose: | ||
- 4004 | ||
command: settings-tp -C tcp://validator-3:4004 | ||
stop_signal: SIGKILL | ||
|
||
client: | ||
image: sawtooth-dev-python:latest | ||
volumes: | ||
- $SAWTOOTH_CORE:/project/sawtooth-core | ||
- $SAWTOOTH_PBFT:/project/sawtooth-pbft | ||
working_dir: /project/sawtooth-pbft | ||
environment: | ||
PATH: "$PATH:/project/sawtooth-core/bin" | ||
depends_on: | ||
- rest-api-0 | ||
- rest-api-1 | ||
- rest-api-2 | ||
- rest-api-3 | ||
entrypoint: "bash -c \"\ | ||
sawtooth keygen && \ | ||
tail -f /dev/null \ | ||
\"" |