Hyperledger Fabric without Docker on Local Machine

2019-06-06 08:58发布

问题:

I am new to Hyperledger Fabric. I need to set up the Hypeledger Fabric development environment on my local machine (Ubuntu 16). As Fabric is dockerized, I want to know how can I set it up on my local machine. I have tried searching for a tutorial but there isn't one.

I am making a production level project so I cannot rely on Docker, please guide me on local machine setup (docker independent).

Hyperledger Fabric documentation is very user-friendly however it does not provide information on setting environments locally. Previous questions on Stack Overflow are not serving my purpose.

回答1:

Based on this Fabric tutorial, you can extract these commands from shell script and docker-compose file, then run them on your local machine.

First, you must have two config files: crypto-config.yaml and configtx.yaml. You can find them on the directory: fabric-samples/first-network/

Using crypto-config.yaml to generate the public key, private key, certificate and etc.

Consuming configtx.yaml file to generate genesis block and so on.

You can manually generate the certificates/keys and the various configuration artifacts using the configtxgen and cryptogen commands.

1)

# cryptogen generate --config=./crypto-config.yaml

2)

# export FABRIC_CFG_PATH=$PWD
# mkdir channel-artifacts
# configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
# export CHANNEL_NAME=mychannel
# configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
# configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
# configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP

3) configure orderer.yaml and core.yaml, you can get it from this

4) update these two file with real keys and certs.

5)

# orderer start

6)

# export set FABRIC_CFG_PATH = ${PWD}
# peer node start >> peerlog.log 2>&1 &

Up to now, the fabric network is on. Then you can create & join channel, or do other operations.

If you have any confision about this, let me know. Good luck.



回答2:

Not sure if you're still looking but I put together a project https://github.com/chainforce/native-fabric that uses Fabric natively (on OSX) without even Chaincode container. A sample chaincode is written in Go and deployed with Go Plugin as a System Chaincode. You may find more info on System Chaincode from Fabric document, but basically it can do what Docker-based chaincode can do and more.



回答3:

You must use Fabric with Docker if you deploy to production. For testing purposes, you can follow this for a docker-free local version and can use this for a docker-free browser version.



回答4:

You can setup Fabric network on your local machine without Docker if fabric modules peer and orderer are compiled on your Ubuntu. In fact, local compilation is recommended in production.