Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

problem with docker-compose #2430

Open
neginkheirmand opened this issue Jun 26, 2022 · 5 comments
Open

problem with docker-compose #2430

neginkheirmand opened this issue Jun 26, 2022 · 5 comments

Comments

@neginkheirmand
Copy link

I have been following the documentation to deploy a sawtooth test network (using docker) but failed with both poet and pbft versions.

The nightly tag of docker is outdated and does not work with the docker-compose anymore, however I have been able to deploy the poet version by just changing the tag part of the images in docker-compose from nightly to latest. After this change the "sawtooth peer list" and the "curl http://sawtooth-rest-api-default-0:8008/peers" commands work properly.
Yet when trying to set a key named MyKey to the value 999 according to this command, I run into other problems:
intkey set --url http://sawtooth-rest-api-default-0:8008 MyKey 999
I get the response:
{
"link": "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=8a9cde13ada7bc4f06e6736acf54689515946d8865538544b6e71744a50f861d6621a9e5e94d073b495858116c7c7d5685c6341e65389af30d12bdea78d6b90c"
}

which may seem rational according to the documentation but when I try to run this command:
intkey show --url http://sawtooth-rest-api-default-1:8008 MyKey
I get the following response:
Error: No such key: MyKey

now if I curl the specified link from the response of the intkey set command I get that the status is pending
curl "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=8a9cde13ada7bc4f06e6736acf54689515946d8865538544b6e71744a50f861d6621a9e5e94d073b495858116c7c7d5685c6341e65389af30d12bdea78d6b90c"
the response:
{
"data": [
{
"id": "8a9cde13ada7bc4f06e6736acf54689515946d8865538544b6e71744a50f861d6621a9e5e94d073b495858116c7c7d5685c6341e65389af30d12bdea78d6b90c",
"invalid_transactions": [],
"status": "PENDING"
}
],
"link": "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=8a9cde13ada7bc4f06e6736acf54689515946d8865538544b6e71744a50f861d6621a9e5e94d073b495858116c7c7d5685c6341e65389af30d12bdea78d6b90c"
}

@jallphin
Copy link

Can confirm this is a problem. We really want to use this for an important research project but we cannot seem to get the docker-compose project to function properly and are having exact same issues described by @neginkheirmand

Can the developers here give us some indication of what we are doing wrong or perhaps some direction to move forward with?

Thanks!

@finavatar
Copy link

@neginkheirmand Would you be able to show me exactly how you changed from nightly to latest ( I assumed from yaml) so as to be able to check that peer nodes work (Quote from you: After this change the "sawtooth peer list" and the "curl http://sawtooth-rest-api-default-0:8008/peers" commands work properly.)

I haven't been able to get this to work even when changing all from nightly to latest. The error that I keep getting is:

curl: (7) Failed to connect to sawtooth-rest-api-default-0 port 8008: Connection refused

It is my first time venturing into blockchain/sawtooth and docker and I must say that it's very daunting.
By the way, how did you know that it's docker-compose that's the problem and not sawtooth development itself? (must be dummy question and shows how ignorant I am)
thanks

@TanjinAlam
Copy link

TanjinAlam commented Dec 8, 2022

I was facing following transaction error problem just after successfully running following docker file.

@jallphin you can re-produce the error after successfully starting following docker file.

version: "3.6"

volumes:
contracts-shared:
grid-shared:
pbft-shared:
gridd-alpha:
templates-shared:
cache-shared:

services:

---== shared services ==---

sabre-cli:
image: hyperledger/sawtooth-sabre-cli:latest
volumes:
- contracts-shared:/usr/share/scar
- pbft-shared:/pbft-shared
container_name: sabre-cli
stop_signal: SIGKILL

tnt-contract-builder:
image: piashtanjin/tnt-contract-builder:latest
container_name: tnt-contract-builder
volumes:
- pbft-shared:/pbft-shared
entrypoint: |
bash -c "
while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
sabre cr --create grid_track_and_trace --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre upload --filename /tmp/track_and_trace.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create a43b46 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm a43b46 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee01 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee05 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
echo '---------========= track and trace contract is loaded =========---------'
"

schema-contract-builder:
image: piashtanjin/schema-contract-builder:latest
container_name: schema-contract-builder
volumes:
- pbft-shared:/pbft-shared
entrypoint: |
bash -c "
while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
sabre cr --create grid_schema --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre upload --filename /tmp/schema.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create 621dee01 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee01 grid_schema --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee05 grid_schema --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
echo '---------========= grid schema contract is loaded =========---------'
"

pike-contract-builder:
image: piashtanjin/pike-contract-builder:latest
container_name: pike-contract-builder
volumes:
- pbft-shared:/pbft-shared
entrypoint: |
bash -c "
while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
sabre cr --create grid_pike --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre upload --filename /tmp/pike.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create 621dee05 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee05 grid_pike --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
echo '---------========= pike contract is loaded =========---------'
"

product-contract-builder:
image: piashtanjin/product-contract-builder:latest
container_name: product-contract-builder
volumes:
- pbft-shared:/pbft-shared
entrypoint: |
bash -c "
while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
sabre cr --create grid_product --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre upload --filename /tmp/product.yaml --key /pbft-shared/validators/-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create 621dee05 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create 621dee01 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create 621dee02 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee05 grid_product --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee01 grid_product --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee02 grid_product --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
echo '---------========= grid_product contract is loaded =========---------'
"

location-contract-builder:
image: piashtanjin/location-contract-builder:latest
container_name: location-contract-builder
volumes:
- pbft-shared:/pbft-shared
entrypoint: |
bash -c "
while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
sabre cr --create grid_location --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre upload --filename /tmp/location.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create 621dee04 --key /pbft-shared/validators/validator --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee05 grid_location --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee01 grid_location --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee04 grid_location --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
echo '---------========= grid_location contract is loaded =========---------'
"
purchase-order-contract-builder:
image: piashtanjin/purchase-order-contract-builder:latest
container_name: purchase-order-contract-builder
volumes:
- pbft-shared:/pbft-shared
entrypoint: |
bash -c "
while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
sabre cr --create grid_purchase_order --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre upload --filename /tmp/purchase_order.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre ns --create 621dee06 --key /pbft-shared/validators/validator --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee05 grid_purchase_order --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
sabre perm 621dee06 grid_purchase_order --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
echo '---------========= grid_purchase_order contract is loaded =========---------'
"

validator-0:
image: hyperledger/sawtooth-validator:nightly
container_name: sawtooth-validator-default-0
expose:
- 4004
- 5050
- 8800
volumes:
- pbft-shared:/pbft-shared
command: |
bash -c "
if [ -e /pbft-shared/validators/validator-0.priv ]; then
cp /pbft-shared/validators/validator-0.pub /etc/sawtooth/keys/validator.pub
cp /pbft-shared/validators/validator-0.priv /etc/sawtooth/keys/validator.priv
fi &&
if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
sawadm keygen
mkdir -p /pbft-shared/validators || true
cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-0.pub
cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-0.priv
fi &&
if [ ! -e config-genesis.batch ]; then
sawset genesis -k /etc/sawtooth/keys/validator.priv -o config-genesis.batch
fi &&
while [[ ! -f /pbft-shared/validators/validator-1.pub ||
! -f /pbft-shared/validators/validator-2.pub ||
! -f /pbft-shared/validators/validator-3.pub ||
! -f /pbft-shared/validators/validator-4.pub ]];
do sleep 1; done
echo sawtooth.consensus.pbft.members=\['"'$$(cat /pbft-shared/validators/validator-0.pub)'"','"'$$(cat /pbft-shared/validators/validator-1.pub)'"','"'$$(cat /pbft-shared/validators/validator-2.pub)'"','"'$$(cat /pbft-shared/validators/validator-3.pub)'"','"'$$(cat /pbft-shared/validators/validator-4.pub)'"'\] &&
if [ ! -e config.batch ]; then
sawset proposal create
-k /etc/sawtooth/keys/validator.priv
sawtooth.consensus.algorithm.name=pbft
sawtooth.consensus.algorithm.version=1.0
sawtooth.consensus.pbft.members=\['"'$$(cat /pbft-shared/validators/validator-0.pub)'"','"'$$(cat /pbft-shared/validators/validator-1.pub)'"','"'$$(cat /pbft-shared/validators/validator-2.pub)'"','"'$$(cat /pbft-shared/validators/validator-3.pub)'"','"'$$(cat /pbft-shared/validators/validator-4.pub)'"'\]
sawtooth.publisher.max_batches_per_block=1200
-o config.batch
fi &&
if [ ! -e /var/lib/sawtooth/genesis.batch ]; then
sawadm genesis config-genesis.batch config.batch
fi &&
if [ ! -e /root/.sawtooth/keys/my_key.priv ]; then
sawtooth keygen my_key
fi &&
sawtooth-validator -vv
--endpoint tcp://validator-0:8800
--bind component:tcp://eth0:4004
--bind consensus:tcp://eth0:5050
--bind network:tcp://eth0:8800
--scheduler parallel
--peering static
--maximum-peer-connectivity 10000
"
validator-1:
image: hyperledger/sawtooth-validator:nightly
container_name: sawtooth-validator-default-1
expose:
- 4004
- 5050
- 8800
volumes:
- pbft-shared:/pbft-shared
command: |
bash -c "
if [ -e /pbft-shared/validators/validator-1.priv ]; then
cp /pbft-shared/validators/validator-1.pub /etc/sawtooth/keys/validator.pub
cp /pbft-shared/validators/validator-1.priv /etc/sawtooth/keys/validator.priv
fi &&
if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
sawadm keygen
mkdir -p /pbft-shared/validators || true
cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-1.pub
cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-1.priv
fi &&
sawtooth keygen my_key &&
sawtooth-validator -vv
--endpoint tcp://validator-1:8800
--bind component:tcp://eth0:4004
--bind consensus:tcp://eth0:5050
--bind network:tcp://eth0:8800
--scheduler parallel
--peering static
--maximum-peer-connectivity 10000
--peers tcp://validator-0:8800
"
validator-2:
image: hyperledger/sawtooth-validator:nightly
container_name: sawtooth-validator-default-2
expose:
- 4004
- 5050
- 8800
volumes:
- pbft-shared:/pbft-shared
command: |
bash -c "
if [ -e /pbft-shared/validators/validator-2.priv ]; then
cp /pbft-shared/validators/validator-2.pub /etc/sawtooth/keys/validator.pub
cp /pbft-shared/validators/validator-2.priv /etc/sawtooth/keys/validator.priv
fi &&
if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
sawadm keygen
mkdir -p /pbft-shared/validators || true
cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-2.pub
cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-2.priv
fi &&
sawtooth keygen my_key &&
sawtooth-validator -vv
--endpoint tcp://validator-2:8800
--bind component:tcp://eth0:4004
--bind consensus:tcp://eth0:5050
--bind network:tcp://eth0:8800
--scheduler parallel
--peering static
--maximum-peer-connectivity 10000
--peers tcp://validator-0:8800
--peers tcp://validator-1:8800
"
validator-3:
image: hyperledger/sawtooth-validator:nightly
container_name: sawtooth-validator-default-3
expose:
- 4004
- 5050
- 8800
volumes:
- pbft-shared:/pbft-shared
command: |
bash -c "
if [ -e /pbft-shared/validators/validator-3.priv ]; then
cp /pbft-shared/validators/validator-3.pub /etc/sawtooth/keys/validator.pub
cp /pbft-shared/validators/validator-3.priv /etc/sawtooth/keys/validator.priv
fi &&
if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
sawadm keygen
mkdir -p /pbft-shared/validators || true
cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-3.pub
cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-3.priv
fi &&
sawtooth keygen my_key &&
sawtooth-validator -vv
--endpoint tcp://validator-3:8800
--bind component:tcp://eth0:4004
--bind consensus:tcp://eth0:5050
--bind network:tcp://eth0:8800
--scheduler parallel
--peering static
--maximum-peer-connectivity 10000
--peers tcp://validator-0:8800
--peers tcp://validator-1:8800
--peers tcp://validator-2:8800
"
validator-4:
image: hyperledger/sawtooth-validator:nightly
container_name: sawtooth-validator-default-4
expose:
- 4004
- 5050
- 8800
volumes:
- pbft-shared:/pbft-shared
command: |
bash -c "
if [ -e /pbft-shared/validators/validator-4.priv ]; then
cp /pbft-shared/validators/validator-4.pub /etc/sawtooth/keys/validator.pub
cp /pbft-shared/validators/validator-4.priv /etc/sawtooth/keys/validator.priv
fi &&
if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
sawadm keygen
mkdir -p /pbft-shared/validators || true
cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-4.pub
cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-4.priv
fi &&
sawtooth keygen my_key &&
sawtooth-validator -vv
--endpoint tcp://validator-4:8800
--bind component:tcp://eth0:4004
--bind consensus:tcp://eth0:5050
--bind network:tcp://eth0:8800
--scheduler parallel
--peering static
--maximum-peer-connectivity 10000
--peers tcp://validator-0:8800
--peers tcp://validator-1:8800
--peers tcp://validator-2:8800
--peers tcp://validator-3:8800
"
sawtooth-rest-api:
image: hyperledger/sawtooth-rest-api:latest
container_name: sawtooth-rest-api-default-0
expose:
- 8008
depends_on:
- validator-0
command: |
bash -c "
sawtooth-rest-api
--connect tcp://validator-0:4004
--bind sawtooth-rest-api:8008
"
stop_signal: SIGKILL

sawtooth-rest-api1:
image: hyperledger/sawtooth-rest-api:nightly
container_name: sawtooth-rest-api-1
expose:
- 8008
depends_on:
- validator-0
command: |
bash -c "
sawtooth-rest-api -v --connect tcp://validator-1:4004 --bind sawtooth-rest-api1:8008
"
stop_signal: SIGKILL

sawtooth-rest-api2:
image: hyperledger/sawtooth-rest-api:nightly
container_name: sawtooth-rest-api-2
expose:
- 8008
depends_on:
- validator-0
command: |
bash -c "
sawtooth-rest-api -v --connect tcp://validator-2:4004 --bind sawtooth-rest-api2:8008
"
stop_signal: SIGKILL
sawtooth-rest-api3:
image: hyperledger/sawtooth-rest-api:nightly
container_name: sawtooth-rest-api-3
expose:
- 8008
depends_on:
- validator-0
command: |
bash -c "
sawtooth-rest-api -v --connect tcp://validator-3:4004 --bind sawtooth-rest-api3:8008
"
stop_signal: SIGKILL

sawtooth-rest-api4:
image: hyperledger/sawtooth-rest-api:nightly
container_name: sawtooth-rest-api-4
expose:
- 8008
depends_on:
- validator-0
command: |
bash -c "
sawtooth-rest-api -v --connect tcp://validator-4:4004 --bind sawtooth-rest-api4:8008
"
stop_signal: SIGKILL

sawtooth-settings-tp:
image: hyperledger/sawtooth-settings-tp:latest
container_name: sawtooth-settings-tp
expose:
- 4004
command: settings-tp -v -C tcp://validator-0:4004
stop_signal: SIGKILL

sabre-tp:
image: hyperledger/sawtooth-sabre-tp:0.8
container_name: sawtooth-sabre-tp
depends_on:
- validator-0
entrypoint: sawtooth-sabre -vv --connect tcp://validator-0:4004

sawtooth-client:
image: hyperledger/sawtooth-shell:nightly
container_name: sawtooth-shell
volumes:
- pbft-shared:/pbft-shared
depends_on:
- validator-0
command: |
bash -c "
sawtooth keygen &&
tail -f /dev/null
"
stop_signal: SIGKILL
pbft-0:
image: hyperledger/sawtooth-pbft-engine:nightly
container_name: sawtooth-pbft-engine-default-0
command: pbft-engine -vv --connect tcp://validator-0:5050
stop_signal: SIGKILL

pbft-1:
image: hyperledger/sawtooth-pbft-engine:nightly
container_name: sawtooth-pbft-engine-default-1
command: pbft-engine -vv --connect tcp://validator-1:5050
stop_signal: SIGKILL

pbft-2:
image: hyperledger/sawtooth-pbft-engine:nightly
container_name: sawtooth-pbft-engine-default-2
command: pbft-engine -vv --connect tcp://validator-2:5050
stop_signal: SIGKILL

pbft-3:
image: hyperledger/sawtooth-pbft-engine:nightly
container_name: sawtooth-pbft-engine-default-3
command: pbft-engine -vv --connect tcp://validator-3:5050
stop_signal: SIGKILL

pbft-4:
image: hyperledger/sawtooth-pbft-engine:nightly
container_name: sawtooth-pbft-engine-default-4
command: pbft-engine -vv --connect tcp://validator-4:5050
stop_signal: SIGKILL
`

image

@saki021989
Copy link

image
I am getting the same error of peot and pbft engine and then connection refused when I used curl command.

@mtbc
Copy link

mtbc commented Jul 6, 2023

I usually see exactly the same problem, with the exception that, just sometimes, I get COMMITTED from the link then the get test passes. Perhaps there's a timing issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

6 participants