Closed koakh closed 3 years ago
Use -e true flag. You did not expose network node ports. Try that.
thanks @litong01 :)
about -e true
seems a stupid error combined with
lack of attention eheheh
UPDATE: seems that I can override that issue, but leave here my debug session maybe it can be useful for others
I add it to minifab up and now I have other kind of problems like, error spin up network
$ minifab cleanup
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ minifab up -s couchdb -e true
Using spec file: /home/mario/Development/HyperLedger/miniFabric/spec.yaml
Minifab Execution Context:
FABRIC_RELEASE=2.3.0
CHANNEL_NAME=mychannel
PEER_DATABASE_TYPE=couchdb
CHAINCODE_LANGUAGE=go
CHAINCODE_NAME=simple
CHAINCODE_VERSION=1.0
CHAINCODE_INIT_REQUIRED=true
CHAINCODE_PARAMETERS="init","a","200","b","300"
CHAINCODE_PRIVATE=false
CHAINCODE_POLICY=
TRANSIENT_DATA=
BLOCK_NUMBER=newest
EXPOSE_ENDPOINTS=true
CURRENT_ORG=org0.example.com
HOST_ADDRESSES=192.168.1.100,10.1.56.0,10.10.1.100,192.168.1.32
WORKING_DIRECTORY: /home/mario/Development/HyperLedger/miniFabric
# Start couchdb nodes if db type is set to couchdb ************
All items completed
non-zero return code
non-zero return code
non-zero return code
non-zero return code
# another try, now with system prune
$ docker system prune
$ minifab cleanup
$ minifab up -s couchdb -e true
...
# Start all ca nodes ******************************************
All items completed
non-zero return code
# Error! ******************************************************
# STATS *******************************************************
minifab: ok=226 failed=0
strange now I can't lift minifab network, even if I remove -e true
, like I do in the past
seems that I try many times and always have one or other error, in couchdb or in ca phases
maybe its related with HOST_ADDRESSES=192.168.1.100,10.1.56.0,10.10.1.100,192.168.1.32
I try to export HOST_ADDRESSES=192.168.1.100
, and pass it before minifab ex HOST_ADDRESSES=192.168.1.100 minifab up
and it won't change in context
I try in despair, and to debug launch the simple way is possible with
$ minifab cleanup
$ minifab up
Using default spec file
Minifab Execution Context:
FABRIC_RELEASE=2.3.0
CHANNEL_NAME=mychannel
PEER_DATABASE_TYPE=golevel
CHAINCODE_LANGUAGE=go
CHAINCODE_NAME=simple
CHAINCODE_VERSION=1.0
CHAINCODE_INIT_REQUIRED=true
CHAINCODE_PARAMETERS="init","a","200","b","300"
CHAINCODE_PRIVATE=false
CHAINCODE_POLICY=
TRANSIENT_DATA=
BLOCK_NUMBER=newest
EXPOSE_ENDPOINTS=false
CURRENT_ORG=org0.example.com
HOST_ADDRESSES=192.168.1.100,10.1.56.0,10.10.1.100,192.168.1.32
WORKING_DIRECTORY: /home/mario/Development/HyperLedger/miniFabric
....
# Preparing for the following operations: *********************
verify options, download images, generate certificates, start network, network status, channel create, channel join, anchor update, profile generation, cc install, cc approve, cc commit, cc initialize, discover
.................
# Running operation: ******************************************
verify options
.
# Running operation: ******************************************
download images
............
# Running operation: ******************************************
generate certificates
............................................................................................................................................
# Running operation: ******************************************
start network
.......................
# Running operation: ******************************************
network status
...
# Current Minifabric image ID and created at date time ********
998211d22979 2020-12-18 05:34:27 +0000 UTC
.....
# Docker node status ******************************************
411cd530b0_cli : Up 8 seconds
ca1.org1.example.com : Up 9 seconds
ca1.org0.example.com : Up 10 seconds
orderer3.example.com : Up 11 seconds
orderer2.example.com : Up 12 seconds
orderer1.example.com : Up 13 seconds
peer2.org1.example.com : Up 14 seconds
peer1.org1.example.com : Up 15 seconds
peer2.org0.example.com : Up 16 seconds
peer1.org0.example.com : Up 17 seconds
# Fabric network peer and orderer node health status **********
peer1.org0.example.com "OK"
peer2.org0.example.com "OK"
peer1.org1.example.com "OK"
peer2.org1.example.com "OK"
orderer1.example.com "OK"
orderer2.example.com "OK"
orderer3.example.com "OK"
Network Status: 100%
# Running operation: ******************************************
channel create
......
# Running operation: ******************************************
channel join
...........................
# Running operation: ******************************************
anchor update
............
# Running operation: ******************************************
profile generation
.................................
# Running operation: ******************************************
cc install
...........................
# Running operation: ******************************************
cc approve
......
# Running operation: ******************************************
cc commit
.............
# Running operation: ******************************************
cc initialize
......
# Running operation: ******************************************
discover
........................
# Discover endorsers results **********************************
Chaincode endorsers file: ./vars/discover/mychannel/simple_endorsers.json
# Discover orderers results ***********************************
Channel orderers file: ./vars/discover/mychannel/ordererendpoints.json
# STATS *******************************************************
minifab: ok=416 failed=0
real 3m3.080s
user 1m31.954s
sys 0m15.350s
# everythin ok
docker ps --format "table {{.Names}}\t{{.Ports}}"
NAMES PORTS
dev-peer1.org0.example.com-simple_1.0-c18bd5c8cd186be47d3b1f7350622b788e3827951f51e7470326155eca1161aa
dev-peer1.org1.example.com-simple_1.0-c18bd5c8cd186be47d3b1f7350622b788e3827951f51e7470326155eca1161aa
dev-peer2.org1.example.com-simple_1.0-c18bd5c8cd186be47d3b1f7350622b788e3827951f51e7470326155eca1161aa
dev-peer2.org0.example.com-simple_1.0-c18bd5c8cd186be47d3b1f7350622b788e3827951f51e7470326155eca1161aa
411cd530b0_cli
ca1.org1.example.com 7054/tcp
ca1.org0.example.com 7054/tcp
orderer3.example.com 7050/tcp
orderer2.example.com 7050/tcp
orderer1.example.com 7050/tcp
peer2.org1.example.com 7051/tcp
peer1.org1.example.com 7051/tcp
peer2.org0.example.com 7051/tcp
peer1.org0.example.com 7051/tcp
and it works, I dont' have any kind of problems using only minifab up
but if I pass -e true
or -s couchdb
it fails with, always
# Start all ca nodes ******************************************
All items completed
non-zero return code
seems that something is wrong, maybe related to some kind of network port issues
I try some stuff in other linux box and it works
linux box #2 with one lan HOST_ADDRESSES=192.168.1.105
$ minifab up -s couchdb -e true
Using default spec file
Minifab Execution Context:
FABRIC_RELEASE=2.3.0
CHANNEL_NAME=mychannel
PEER_DATABASE_TYPE=couchdb
CHAINCODE_LANGUAGE=go
CHAINCODE_NAME=simple
CHAINCODE_VERSION=1.0
CHAINCODE_INIT_REQUIRED=true
CHAINCODE_PARAMETERS="init","a","200","b","300"
CHAINCODE_PRIVATE=false
CHAINCODE_POLICY=
TRANSIENT_DATA=
BLOCK_NUMBER=newest
EXPOSE_ENDPOINTS=true
CURRENT_ORG=org0.example.com
HOST_ADDRESSES=192.168.1.105
WORKING_DIRECTORY: /home/mario/Development/HyperLedger/miniFabric
....
# Preparing for the following operations: *********************
verify options, download images, generate certificates, start network, network status, channel create, channel join, anchor update, profile generation, cc install, cc approve, cc commit, cc initialize, discover
..................
# Running operation: ******************************************
verify options
.
# Running operation: ******************************************
download images
............
# Running operation: ******************************************
generate certificates
............................................................................................................................................
# Running operation: ******************************************
start network
..............
# Start all peer nodes ****************************************
All items completed
non-zero return code
# Error! ******************************************************
# STATS *******************************************************
minifab: ok=222 failed=0
real 2m23.024s
user 1m22.893s
sys 0m17.848s
$ docker ps --format "table {{.Names}}\t{{.Ports}}"
NAMES PORTS
peer2.org1.example.com 0.0.0.0:7005->7051/tcp, 0.0.0.0:8005->7061/tcp
peer2.org0.example.com 0.0.0.0:7003->7051/tcp, 0.0.0.0:8003->7061/tcp
peer1.org0.example.com 0.0.0.0:7002->7051/tcp, 0.0.0.0:8002->7061/tcp
peer2.org1.example.com.couchdb 4369/tcp, 9100/tcp, 0.0.0.0:7009->5984/tcp
peer1.org1.example.com.couchdb 4369/tcp, 9100/tcp, 0.0.0.0:7008->5984/tcp
peer2.org0.example.com.couchdb 4369/tcp, 9100/tcp, 0.0.0.0:7007->5984/tcp
peer1.org0.example.com.couchdb 4369/tcp, 9100/tcp, 0.0.0.0:7006->5984/tcp
e9aa3af4d7_cli
peer2.org3.coco.com 0.0.0.0:7001->7051/tcp, 0.0.0.0:8001->7061/tcp
peer1.org3.coco.com 0.0.0.0:7000->7051/tcp, 0.0.0.0:8000->7061/tcp
# this time I have other kind of errors in peer nodes
# trying to install a cc (despair mode)
$ minifab install -n simple -l node
Using default spec file
Minifab Execution Context:
FABRIC_RELEASE=2.3.0
CHANNEL_NAME=mychannel
PEER_DATABASE_TYPE=couchdb
CHAINCODE_LANGUAGE=node
CHAINCODE_NAME=simple
CHAINCODE_VERSION=1.0
CHAINCODE_INIT_REQUIRED=true
CHAINCODE_PARAMETERS="init","a","200","b","300"
CHAINCODE_PRIVATE=false
CHAINCODE_POLICY=
TRANSIENT_DATA=
BLOCK_NUMBER=newest
EXPOSE_ENDPOINTS=true
CURRENT_ORG=org0.example.com
HOST_ADDRESSES=192.168.1.105
WORKING_DIRECTORY: /home/mario/Development/HyperLedger/miniFabric
....
# Preparing for the following operations: *********************
verify options, cc install
..................
# Running operation: ******************************************
verify options
.
# Running operation: ******************************************
cc install
.......
# Run the chaincode install script on cli container ***********
non-zero return code
Error: No such container: 411cd530b0_cli
# STATS *******************************************************
minifab: ok=37 failed=1
real 0m6.110s
user 0m5.061s
sys 0m1.311s
I try change the spec.yaml
to the minimum possible and it gives other error
fabric:
cas:
- "ca1.org0.example.com"
peers:
- "peer1.org0.example.com"
orderers:
- "orderer1.example.com"
settings:
ca:
FABRIC_LOGGING_SPEC: DEBUG
peer:
FABRIC_LOGGING_SPEC: DEBUG
orderer:
FABRIC_LOGGING_SPEC: DEBUG
# Start all orderer nodes *************************************
All items completed
non-zero return code
# Error! ******************************************************
docker: Error response from daemon: driver failed programming external connectivity on endpoint orderer1.example.com (961bc9e383cdd4d41af62c72cb2f507a2ca31d8880230ba9e4510a2e6bbc6bd1): Error starting userland proxy: listen tcp 0.0.0.0:7003: bind: address already in use.
this time I have a clue is something with ports from 7000-7004
:)
and I found that I have a service nxserver (nomachine) running with process nxnode.bin that uses this range :), and even if I kill it I uses it again
the solution the service with sudo service nxserver stop
, and it starts to work with above minimal spec.yaml
and with the
default spec.yaml
$ minifab up -s couchdb -e true -i 2.3
...ommited...
# Running operation: ******************************************
channel create
......
# Running operation: ******************************************
channel join
...........................
# Running operation: ******************************************
anchor update
............
# Running operation: ******************************************
profile generation
.................................
# Running operation: ******************************************
cc install
...........................
# Running operation: ******************************************
cc approve
......
# Running operation: ******************************************
cc commit
.............
# Running operation: ******************************************
cc initialize
......
# Running operation: ******************************************
discover
........................
# Discover endorsers results **********************************
Chaincode endorsers file: ./vars/discover/mychannel/simple_endorsers.json
# Discover orderers results ***********************************
Channel orderers file: ./vars/discover/mychannel/ordererendpoints.json
# STATS *******************************************************
minifab: ok=418 failed=0
real 3m16.174s
user 1m36.176s
sys 0m16.306s
sure the problem is not realted with minifab, even if my other other linux machine fails same way, and dont have nomachine running,
I leave here my debug session, maybe it can be useful for other users in the process
I tested it with vscode extension and connection to minifab and everything works has expected :)
thanks @litong01
UPDATE: below issue is not realated with minifab, it just some try and fail to try to use minifab to setup a vscode debug development environment
about vscode debug session
even I was conected to environment and invoke some functions on smartChain
I can deploy project smartChain to environment, and invoke its functions withou problem
[1/24/2021 6:21:50 PM] [SUCCESS] Successfully committed smart contract definition
[1/24/2021 6:21:50 PM] [SUCCESS] Successfully deployed smart contract
[1/24/2021 6:21:52 PM] [WARNING] Could not get metadata for smart contract simple. The smart contract may not have been developed with the programming model delivered in Hyperledger Fabric v1.4+ for Java, JavaScript and TypeScript. Error: Transaction function "org.hyperledger.fabric:GetMetadata" returned an error: Invalid invoke function name. Expecting "invoke" "delete" "query"
[1/24/2021 6:22:01 PM] [INFO] Open Transaction View
[1/24/2021 6:22:10 PM] [INFO] submitTransaction
[1/24/2021 6:22:11 PM] [INFO] submitting transaction createMyAsset with args 001,volvo on channel mychannel to peers 192.168.1.100:7002,192.168.1.100:7003,192.168.1.100:7005,192.168.1.100:7004
[1/24/2021 6:22:13 PM] [SUCCESS] No value returned from createMyAsset
[1/24/2021 6:22:16 PM] [INFO] Open Transaction View
[1/24/2021 6:22:18 PM] [INFO] submitTransaction
[1/24/2021 6:22:18 PM] [INFO] submitting transaction myAssetExists with args 001 on channel mychannel to peers 192.168.1.100:7002,192.168.1.100:7003,192.168.1.100:7005,192.168.1.100:7004
[1/24/2021 6:22:20 PM] [SUCCESS] Returned value from myAssetExists: true
[1/24/2021 6:22:22 PM] [ERROR] No local environments found for debugging.
any ideas?
...sorry to be boring, but I would really like to use the minifab, with dev-mode and vscode debug, do you think is a waste of time try to use it to debug chaincode in vscode or do you think it's possible?
UPDATE: I hack the file ~/.fabric-vscode/v2/environments/1 Org/.config.json
and now I have environment configurated,
~/.fabric-vscode/v2/environments/minifabric/.config.json
{
"name": "minifabric",
"managedRuntime": true,
"environmentType": 76,
"environmentDirectory": "/home/mario/.fabric-vscode/v2/environments/minifabric",
"numberOfOrgs": 2,
"url": "http://console.127-0-0-1.nip.io:8081",
"fabricCapabilities": "V2_0"
}
but the problem is the same the same I have with ibm blockchain plataform extension
[ERROR] The current debug session is not debugging a smart contract, this command can only be run when debugging a smart contract
seems that I'm trying to make the impossible, without knowledge, and a lot of despair in the middle,maybe the pros come to help
I try hack peer and launch.json
with some info from devmode, I even try to launch peer with peer node start --peer-chaincodedev=true
, but I don't know how I can I pass --peer-chaincodedev=true
flag to boot minifab peer.....
yaml file change start peer to command: peer node start --peer-chaincodedev=true
and change to port 7052, I inspect vars/core.yaml but I dont know how to add --peer-chaincodedev=true
to peer node start
UPDATE: it seems the magic happens here
netup/apply.yaml
in hyperledger/fabric-peer:{{ fabric.release }} peer node start
....I builded the docker image with patched peer node start --peer-chaincodedev=true
, and change minifab script to use my image, the fight continues....maybe I can have some progress with peer in dev-mode
thanks @litong01
You can use spec.yaml to specify any peer, orderer or ca env variables. Please see the spec.yaml file with the debug setting. Any other variable should be added in the file same way. Please also close this issue as this is not minifabric issue.
I already pass the debug settings in spec.yaml,
but I can't pass --peer-chaincodedev=true
, only if I build docker image, or other clever way
I know it isn't related directly with minifab sorry :( but can kindly answear me a simple question, if you know it is possible to debug hlf 2.0 chaincode? thanks
thanks for the help @litong01 and sorry If I spam minifab repo
Hello
first thanks for this awesome tool minifab :)
second my versions
Im followind the tutorials Developing with Minifabric: Artifacts and VSCode
and when I import the
vars/profiles/vscode/vscodenodefile.json
I always have the same errorI try many times with diferent combinations, but no luck
my full command list
import all three wallets
import nodes
associate the admin wallets to those organizations
and error appears, and everytime I click minifabric organization
any help will be appreciated
another question is if possible to debug chaincodes with vscode and minifabric and dev-mode?
I use a node typescript package for hyperledger 1.4.x called convector, and I can debugs in vscode and typescript and this is a must feature for big chaincodes with some models and logic,
I try 2 nights to put vscode blockchain extension v2.0.0 to work with vscode debug and hlf 2.3.2 without sucess, seems that debug only works for 1.4 versions we can see the issue here [v2 merge] Debug smart contract - update or remove
thanks, I hope we can fix this connection problem and can debug chaincode with vscode with minifab :)