mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Compare commits
8 commits
main
...
v1.4.1-rc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72edb7e3bb | ||
|
|
83fe6c32df | ||
|
|
026aa9ec01 | ||
|
|
4ed3933a8d | ||
|
|
e5dc89e61d | ||
|
|
463d2ecaff | ||
|
|
881ba56c8e | ||
|
|
bb39b6ed09 |
32 changed files with 456 additions and 244 deletions
10
Jenkinsfile
vendored
10
Jenkinsfile
vendored
|
|
@ -9,13 +9,11 @@ node ('hyp-x') { // trigger build on x86_64 node
|
|||
timestamps {
|
||||
try {
|
||||
def ROOTDIR = pwd() // workspace dir (/w/workspace/<job_name>
|
||||
def nodeHome = tool 'nodejs-8.11.3'
|
||||
def nodeHome = tool 'nodejs-8.11.3' // NodeJs version
|
||||
env.ARCH = "amd64"
|
||||
env.VERSION = sh(returnStdout: true, script: 'curl -O https://raw.githubusercontent.com/hyperledger/fabric/master/Makefile && cat Makefile | grep "BASE_VERSION =" | cut -d "=" -f2').trim()
|
||||
env.VERSION = "$VERSION" // BASE_VERSION from fabric Makefile
|
||||
env.BASE_IMAGE_VER = sh(returnStdout: true, script: 'cat Makefile | grep "BASEIMAGE_RELEASE =" | cut -d "=" -f2').trim() // BASEIMAGE Version from fabric Makefile
|
||||
env.IMAGE_TAG = "${ARCH}-${VERSION}-stable" // fabric latest stable version from nexus
|
||||
env.PROJECT_VERSION = "${VERSION}-stable"
|
||||
env.VERSION = sh(returnStdout: true, script: 'curl -O https://raw.githubusercontent.com/hyperledger/fabric/release-1.4/Makefile && cat Makefile | grep "PREV_VERSION =" | cut -d "=" -f2').trim()
|
||||
env.VERSION = "$VERSION" // PREV_VERSION from fabric Makefile
|
||||
env.BASE_IMAGE_VER = sh(returnStdout: true, script: 'cat Makefile | grep "BASEIMAGE_RELEASE=" | cut -d "=" -f2').trim() // BASEIMAGE Version from fabric Makefile
|
||||
env.BASE_IMAGE_TAG = "${ARCH}-${BASE_IMAGE_VER}" //fabric baseimage version
|
||||
env.PROJECT_DIR = "gopath/src/github.com/hyperledger"
|
||||
env.GOPATH = "$WORKSPACE/gopath"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ The [`scripts/bootstrap.sh`](https://github.com/hyperledger/fabric-samples/blob/
|
|||
script will preload all of the requisite docker
|
||||
images for Hyperledger Fabric and tag them with the 'latest' tag. Optionally,
|
||||
specify a version for fabric, fabric-ca and thirdparty images. Default versions
|
||||
are 1.4.0-rc2, 1.4.0-rc2 and 0.4.14 respectively.
|
||||
are 1.4.0, 1.4.0 and 0.4.14 respectively.
|
||||
|
||||
```bash
|
||||
./scripts/bootstrap.sh [version] [ca version] [thirdparty_version]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
"engine-strict": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-shim": "~1.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
"express-bearer-token": "^2.1.0",
|
||||
"express-jwt": "^5.1.0",
|
||||
"express-session": "^1.15.2",
|
||||
"fabric-ca-client": "1.4.0-rc2",
|
||||
"fabric-client": "1.4.0-rc2",
|
||||
"fabric-ca-client": "~1.4.0",
|
||||
"fabric-client": "~1.4.0",
|
||||
"fs-extra": "^2.0.0",
|
||||
"jsonwebtoken": "^7.3.0",
|
||||
"log4js": "^0.6.38"
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
"express": "^4.16.1",
|
||||
"express-jwt": "^5.3.0",
|
||||
"express-session": "^1.15.6",
|
||||
"fabric-ca-client": "1.4.0-rc2",
|
||||
"fabric-client": "1.4.0-rc2",
|
||||
"fabric-ca-client": "~1.4.0",
|
||||
"fabric-client": "~1.4.0",
|
||||
"log4js": "^0.6.38"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
"engine-strict": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-shim": "~1.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@
|
|||
"engine-strict": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-shim": "~1.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
"author": "Hyperledger",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-contract-api": "1.4.0-rc2",
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-contract-api": "~1.4.0",
|
||||
"fabric-shim": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.2",
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
"author": "Hyperledger",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-contract-api": "1.4.0-rc2",
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-contract-api": "~1.4.0",
|
||||
"fabric-shim": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.7",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
"engine-strict": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-shim": "~1.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"fabric-network": "1.4.0-rc2",
|
||||
"fabric-client": "1.4.0-rc2",
|
||||
"fabric-network": "~1.4.0",
|
||||
"fabric-client": "~1.4.0",
|
||||
"js-yaml": "^3.12.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
"author": "hyperledger",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-contract-api": "1.4.0-rc2",
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-contract-api": "~1.4.0",
|
||||
"fabric-shim": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.2",
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"fabric-network": "1.4.0-rc2",
|
||||
"fabric-client": "1.4.0-rc2",
|
||||
"fabric-network": "~1.4.0",
|
||||
"fabric-client": "~1.4.0",
|
||||
"js-yaml": "^3.12.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
"author": "hyperledger",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-contract-api": "1.4.0-rc2",
|
||||
"fabric-shim": "1.4.0-rc2"
|
||||
"fabric-contract-api": "~1.4.0",
|
||||
"fabric-shim": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.2",
|
||||
|
|
|
|||
|
|
@ -8,118 +8,158 @@
|
|||
* Chaincode Invoke
|
||||
*/
|
||||
|
||||
var Fabric_Client = require('fabric-client');
|
||||
var path = require('path');
|
||||
var util = require('util');
|
||||
var os = require('os');
|
||||
const Fabric_Client = require('fabric-client');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const os = require('os');
|
||||
|
||||
//
|
||||
var fabric_client = new Fabric_Client();
|
||||
invoke();
|
||||
|
||||
// setup the fabric network
|
||||
var channel = fabric_client.newChannel('mychannel');
|
||||
var peer = fabric_client.newPeer('grpc://localhost:7051');
|
||||
channel.addPeer(peer);
|
||||
var order = fabric_client.newOrderer('grpc://localhost:7050')
|
||||
channel.addOrderer(order);
|
||||
async function invoke() {
|
||||
console.log('\n\n --- invoke.js - start');
|
||||
try {
|
||||
console.log('Setting up client side network objects');
|
||||
// fabric client instance
|
||||
// starting point for all interactions with the fabric network
|
||||
const fabric_client = new Fabric_Client();
|
||||
|
||||
//
|
||||
var member_user = null;
|
||||
var store_path = path.join(__dirname, 'hfc-key-store');
|
||||
console.log('Store path:'+store_path);
|
||||
var tx_id = null;
|
||||
// setup the fabric network
|
||||
// -- channel instance to represent the ledger named "mychannel"
|
||||
const channel = fabric_client.newChannel('mychannel');
|
||||
console.log('Created client side object to represent the channel');
|
||||
// -- peer instance to represent a peer on the channel
|
||||
const peer = fabric_client.newPeer('grpc://localhost:7051');
|
||||
console.log('Created client side object to represent the peer');
|
||||
// -- orderer instance to reprsent the channel's orderer
|
||||
const orderer = fabric_client.newOrderer('grpc://localhost:7050')
|
||||
console.log('Created client side object to represent the orderer');
|
||||
|
||||
// create the key value store as defined in the fabric-client/config/default.json 'key-value-store' setting
|
||||
Fabric_Client.newDefaultKeyValueStore({ path: store_path
|
||||
}).then((state_store) => {
|
||||
// assign the store to the fabric client
|
||||
fabric_client.setStateStore(state_store);
|
||||
var crypto_suite = Fabric_Client.newCryptoSuite();
|
||||
// use the same location for the state store (where the users' certificate are kept)
|
||||
// and the crypto store (where the users' keys are kept)
|
||||
var crypto_store = Fabric_Client.newCryptoKeyStore({path: store_path});
|
||||
crypto_suite.setCryptoKeyStore(crypto_store);
|
||||
fabric_client.setCryptoSuite(crypto_suite);
|
||||
// This sample application uses a file based key value stores to hold
|
||||
// the user information and credentials. These are the same stores as used
|
||||
// by the 'registerUser.js' sample code
|
||||
const member_user = null;
|
||||
const store_path = path.join(__dirname, 'hfc-key-store');
|
||||
console.log('Setting up the user store at path:'+store_path);
|
||||
// create the key value store as defined in the fabric-client/config/default.json 'key-value-store' setting
|
||||
const state_store = await Fabric_Client.newDefaultKeyValueStore({ path: store_path});
|
||||
// assign the store to the fabric client
|
||||
fabric_client.setStateStore(state_store);
|
||||
const crypto_suite = Fabric_Client.newCryptoSuite();
|
||||
// use the same location for the state store (where the users' certificate are kept)
|
||||
// and the crypto store (where the users' keys are kept)
|
||||
const crypto_store = Fabric_Client.newCryptoKeyStore({path: store_path});
|
||||
crypto_suite.setCryptoKeyStore(crypto_store);
|
||||
fabric_client.setCryptoSuite(crypto_suite);
|
||||
|
||||
// get the enrolled user from persistence, this user will sign all requests
|
||||
return fabric_client.getUserContext('user1', true);
|
||||
}).then((user_from_store) => {
|
||||
if (user_from_store && user_from_store.isEnrolled()) {
|
||||
console.log('Successfully loaded user1 from persistence');
|
||||
member_user = user_from_store;
|
||||
} else {
|
||||
throw new Error('Failed to get user1.... run registerUser.js');
|
||||
}
|
||||
|
||||
// get a transaction id object based on the current user assigned to fabric client
|
||||
tx_id = fabric_client.newTransactionID();
|
||||
console.log("Assigning transaction_id: ", tx_id._transaction_id);
|
||||
|
||||
// createCar chaincode function - requires 5 args, ex: args: ['CAR12', 'Honda', 'Accord', 'Black', 'Tom'],
|
||||
// changeCarOwner chaincode function - requires 2 args , ex: args: ['CAR10', 'Dave'],
|
||||
// must send the proposal to endorsing peers
|
||||
var request = {
|
||||
//targets: let default to the peer assigned to the client
|
||||
chaincodeId: 'fabcar',
|
||||
fcn: '',
|
||||
args: [''],
|
||||
chainId: 'mychannel',
|
||||
txId: tx_id
|
||||
};
|
||||
|
||||
// send the transaction proposal to the peers
|
||||
return channel.sendTransactionProposal(request);
|
||||
}).then((results) => {
|
||||
var proposalResponses = results[0];
|
||||
var proposal = results[1];
|
||||
let isProposalGood = false;
|
||||
if (proposalResponses && proposalResponses[0].response &&
|
||||
proposalResponses[0].response.status === 200) {
|
||||
isProposalGood = true;
|
||||
console.log('Transaction proposal was good');
|
||||
// get the enrolled user from persistence and assign to the client instance
|
||||
// this user will sign all requests for the fabric network
|
||||
const user = await fabric_client.getUserContext('user1', true);
|
||||
if (user && user.isEnrolled()) {
|
||||
console.log('Successfully loaded "user1" from user store');
|
||||
} else {
|
||||
console.error('Transaction proposal was bad');
|
||||
throw new Error('\n\nFailed to get user1.... run registerUser.js');
|
||||
}
|
||||
if (isProposalGood) {
|
||||
console.log(util.format(
|
||||
'Successfully sent Proposal and received ProposalResponse: Status - %s, message - "%s"',
|
||||
proposalResponses[0].response.status, proposalResponses[0].response.message));
|
||||
|
||||
// build up the request for the orderer to have the transaction committed
|
||||
var request = {
|
||||
console.log('Successfully setup client side');
|
||||
console.log('\n\nStart invoke processing');
|
||||
|
||||
// get a transaction id object based on the current user assigned to fabric client
|
||||
// Transaction ID objects contain more then just a transaction ID, also includes
|
||||
// a nonce value and if built from the client's admin user.
|
||||
const tx_id = fabric_client.newTransactionID();
|
||||
console.log(util.format("\nCreated a transaction ID: %s", tx_id.getTransactionID()));
|
||||
|
||||
// The fabcar chaincode is able to perform a few functions
|
||||
// 'createCar' - requires 5 args, ex: args: ['CAR12', 'Honda', 'Accord', 'Black', 'Tom']
|
||||
// 'changeCarOwner' - requires 2 args , ex: args: ['CAR10', 'Dave']
|
||||
const proposal_request = {
|
||||
targets: [peer],
|
||||
chaincodeId: 'fabcar',
|
||||
fcn: 'createCar',
|
||||
args: ['CAR12', 'Honda', 'Accord', 'Black', 'Tom'],
|
||||
chainId: 'mychannel',
|
||||
txId: tx_id
|
||||
};
|
||||
|
||||
// notice the proposal_request has the peer defined in the 'targets' attribute
|
||||
|
||||
// Send the transaction proposal to the endorsing peers.
|
||||
// The peers will run the function requested with the arguments supplied
|
||||
// based on the current state of the ledger. If the chaincode successfully
|
||||
// runs this simulation it will return a postive result in the endorsement.
|
||||
const endorsement_results = await channel.sendTransactionProposal(proposal_request);
|
||||
|
||||
// The results will contain a few different items
|
||||
// first is the actual endorsements by the peers, these will be the responses
|
||||
// from the peers. In our sammple there will only be one results since
|
||||
// only sent the proposal to one peer.
|
||||
// second is the proposal that was sent to the peers to be endorsed. This will
|
||||
// be needed later when the endorsements are sent to the orderer.
|
||||
const proposalResponses = endorsement_results[0];
|
||||
const proposal = endorsement_results[1];
|
||||
|
||||
// check the results to decide if we should send the endorsment to be orderered
|
||||
if (proposalResponses[0] instanceof Error) {
|
||||
console.error('Failed to send Proposal. Received an error :: ' + proposalResponses[0].toString());
|
||||
throw proposalResponses[0];
|
||||
} else if (proposalResponses[0].response && proposalResponses[0].response.status === 200) {
|
||||
console.log(util.format(
|
||||
'Successfully sent Proposal and received response: Status - %s',
|
||||
proposalResponses[0].response.status));
|
||||
} else {
|
||||
const error_message = util.format('Invoke chaincode proposal:: %j', proposalResponses[i]);
|
||||
console.error(error_message);
|
||||
throw new Error(error_message);
|
||||
}
|
||||
|
||||
// The proposal was good, now send to the orderer to have the transaction
|
||||
// committed.
|
||||
|
||||
const commit_request = {
|
||||
orderer: orderer,
|
||||
proposalResponses: proposalResponses,
|
||||
proposal: proposal
|
||||
};
|
||||
|
||||
// set the transaction listener and set a timeout of 30 sec
|
||||
// if the transaction did not get committed within the timeout period,
|
||||
// report a TIMEOUT status
|
||||
var transaction_id_string = tx_id.getTransactionID(); //Get the transaction ID string to be used by the event processing
|
||||
var promises = [];
|
||||
//Get the transaction ID string to be used by the event processing
|
||||
const transaction_id_string = tx_id.getTransactionID();
|
||||
|
||||
var sendPromise = channel.sendTransaction(request);
|
||||
promises.push(sendPromise); //we want the send transaction first, so that we know where to check status
|
||||
// create an array to hold on the asynchronous calls to be executed at the
|
||||
// same time
|
||||
const promises = [];
|
||||
|
||||
// get an eventhub once the fabric client has a user assigned. The user
|
||||
// is required bacause the event registration must be signed
|
||||
// this will send the proposal to the orderer during the execuction of
|
||||
// the promise 'all' call.
|
||||
const sendPromise = channel.sendTransaction(commit_request);
|
||||
//we want the send transaction first, so that we know where to check status
|
||||
promises.push(sendPromise);
|
||||
|
||||
// get an event hub that is associated with our peer
|
||||
let event_hub = channel.newChannelEventHub(peer);
|
||||
|
||||
// using resolve the promise so that result status may be processed
|
||||
// under the then clause rather than having the catch clause process
|
||||
// the status
|
||||
// create the asynchronous work item
|
||||
let txPromise = new Promise((resolve, reject) => {
|
||||
// setup a timeout of 30 seconds
|
||||
// if the transaction does not get committed within the timeout period,
|
||||
// report TIMEOUT as the status. This is an application timeout and is a
|
||||
// good idea to not let the listener run forever.
|
||||
let handle = setTimeout(() => {
|
||||
event_hub.unregisterTxEvent(transaction_id_string);
|
||||
event_hub.disconnect();
|
||||
resolve({event_status : 'TIMEOUT'}); //we could use reject(new Error('Trnasaction did not complete within 30 seconds'));
|
||||
}, 3000);
|
||||
resolve({event_status : 'TIMEOUT'});
|
||||
}, 30000);
|
||||
|
||||
// this will register a listener with the event hub. THe included callbacks
|
||||
// will be called once transaction status is received by the event hub or
|
||||
// an error connection arises on the connection.
|
||||
event_hub.registerTxEvent(transaction_id_string, (tx, code) => {
|
||||
// this is the callback for transaction event status
|
||||
// first some clean up of event listener
|
||||
// this first callback is for transaction event status
|
||||
|
||||
// callback has been called, so we can stop the timer defined above
|
||||
clearTimeout(handle);
|
||||
|
||||
// now let the application know what happened
|
||||
var return_status = {event_status : code, tx_id : transaction_id_string};
|
||||
const return_status = {event_status : code, tx_id : transaction_id_string};
|
||||
if (code !== 'VALID') {
|
||||
console.error('The transaction was invalid, code = ' + code);
|
||||
resolve(return_status); // we could use reject(new Error('Problem with the tranaction, event status ::'+code));
|
||||
|
|
@ -133,30 +173,46 @@ Fabric_Client.newDefaultKeyValueStore({ path: store_path
|
|||
},
|
||||
{disconnect: true} //disconnect when complete
|
||||
);
|
||||
event_hub.connect();
|
||||
|
||||
// now that we have a protective timer running and the listener registered,
|
||||
// have the event hub instance connect with the peer's event service
|
||||
event_hub.connect();
|
||||
console.log('Registered transaction listener with the peer event service for transaction ID:'+ transaction_id_string);
|
||||
});
|
||||
|
||||
// set the event work with the orderer work so they may be run at the same time
|
||||
promises.push(txPromise);
|
||||
|
||||
return Promise.all(promises);
|
||||
} else {
|
||||
console.error('Failed to send Proposal or receive valid response. Response null or status is not 200. exiting...');
|
||||
throw new Error('Failed to send Proposal or receive valid response. Response null or status is not 200. exiting...');
|
||||
}
|
||||
}).then((results) => {
|
||||
console.log('Send transaction promise and event listener promise have completed');
|
||||
// check the results in the order the promises were added to the promise all list
|
||||
if (results && results[0] && results[0].status === 'SUCCESS') {
|
||||
console.log('Successfully sent transaction to the orderer.');
|
||||
} else {
|
||||
console.error('Failed to order the transaction. Error code: ' + results[0].status);
|
||||
}
|
||||
// now execute both pieces of work and wait for both to complete
|
||||
console.log('Sending endorsed transaction to the orderer');
|
||||
const results = await Promise.all(promises);
|
||||
|
||||
if(results && results[1] && results[1].event_status === 'VALID') {
|
||||
console.log('Successfully committed the change to the ledger by the peer');
|
||||
} else {
|
||||
console.log('Transaction failed to be committed to the ledger due to ::'+results[1].event_status);
|
||||
// since we added the orderer work first, that will be the first result on
|
||||
// the list of results
|
||||
// success from the orderer only means that it has accepted the transaction
|
||||
// you must check the event status or the ledger to if the transaction was
|
||||
// committed
|
||||
if (results[0].status === 'SUCCESS') {
|
||||
console.log('Successfully sent transaction to the orderer');
|
||||
} else {
|
||||
const message = util.format('Failed to order the transaction. Error code: %s', results[0].status);
|
||||
console.error(message);
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
if (results[1] instanceof Error) {
|
||||
console.error(message);
|
||||
throw new Error(message);
|
||||
} else if (results[1].event_status === 'VALID') {
|
||||
console.log('Successfully committed the change to the ledger by the peer');
|
||||
console.log('\n\n - try running "node query.js" to see the results');
|
||||
} else {
|
||||
const message = util.format('Transaction failed to be committed to the ledger due to : %s', results[1].event_status)
|
||||
console.error(message);
|
||||
throw new Error(message);
|
||||
}
|
||||
} catch(error) {
|
||||
console.log('Unable to invoke ::'+ error.toString());
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.error('Failed to invoke successfully :: ' + err);
|
||||
});
|
||||
console.log('\n\n --- invoke.js - end');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"fabric-ca-client": "1.4.0-rc2",
|
||||
"fabric-client": "1.4.0-rc2",
|
||||
"fabric-ca-client": "~1.4.0",
|
||||
"fabric-client": "~1.4.0",
|
||||
"grpc": "^1.6.0"
|
||||
},
|
||||
"author": "Anthony O'Dowd",
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
"author": "Hyperledger",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-ca-client": "1.4.0-rc2",
|
||||
"fabric-network": "1.4.0-rc2"
|
||||
"fabric-ca-client": "~1.4.0",
|
||||
"fabric-network": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
"author": "Hyperledger",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"fabric-ca-client": "1.4.0-rc2",
|
||||
"fabric-network": "1.4.0-rc2"
|
||||
"fabric-ca-client": "~1.4.0",
|
||||
"fabric-network": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.7",
|
||||
|
|
|
|||
2
first-network/.gitignore
vendored
2
first-network/.gitignore
vendored
|
|
@ -4,3 +4,5 @@
|
|||
/docker-compose-e2e.yaml
|
||||
/ledgers
|
||||
/ledgers-backup
|
||||
/channel-artifacts/*.json
|
||||
/org3-artifacts/crypto-config/*
|
||||
|
|
@ -9,28 +9,14 @@ services:
|
|||
|
||||
orderer.example.com:
|
||||
container_name: orderer.example.com
|
||||
image: hyperledger/fabric-orderer:$IMAGE_TAG
|
||||
environment:
|
||||
- FABRIC_LOGGING_SPEC=INFO
|
||||
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
|
||||
- ORDERER_GENERAL_GENESISMETHOD=file
|
||||
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
|
||||
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
|
||||
# enabled TLS
|
||||
- ORDERER_GENERAL_TLS_ENABLED=true
|
||||
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||
- ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
|
||||
- ORDERER_KAFKA_VERBOSE=true
|
||||
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
|
||||
command: orderer
|
||||
extends:
|
||||
file: peer-base.yaml
|
||||
service: orderer-base
|
||||
volumes:
|
||||
- ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
|
||||
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
|
||||
- orderer.example.com:/var/hyperledger/production/orderer
|
||||
- ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
|
||||
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
|
||||
- orderer.example.com:/var/hyperledger/production/orderer
|
||||
ports:
|
||||
- 7050:7050
|
||||
|
||||
|
|
@ -42,7 +28,10 @@ services:
|
|||
environment:
|
||||
- CORE_PEER_ID=peer0.org1.example.com
|
||||
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:7051
|
||||
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
|
||||
- CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
|
||||
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:8051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
|
||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
||||
volumes:
|
||||
|
|
@ -52,7 +41,6 @@ services:
|
|||
- peer0.org1.example.com:/var/hyperledger/production
|
||||
ports:
|
||||
- 7051:7051
|
||||
- 7053:7053
|
||||
|
||||
peer1.org1.example.com:
|
||||
container_name: peer1.org1.example.com
|
||||
|
|
@ -61,8 +49,11 @@ services:
|
|||
service: peer-base
|
||||
environment:
|
||||
- CORE_PEER_ID=peer1.org1.example.com
|
||||
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
|
||||
- CORE_PEER_ADDRESS=peer1.org1.example.com:8051
|
||||
- CORE_PEER_LISTENADDRESS=0.0.0.0:8051
|
||||
- CORE_PEER_CHAINCODEADDRESS=peer1.org1.example.com:8052
|
||||
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:8051
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
|
||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
||||
volumes:
|
||||
|
|
@ -72,8 +63,7 @@ services:
|
|||
- peer1.org1.example.com:/var/hyperledger/production
|
||||
|
||||
ports:
|
||||
- 8051:7051
|
||||
- 8053:7053
|
||||
- 8051:8051
|
||||
|
||||
peer0.org2.example.com:
|
||||
container_name: peer0.org2.example.com
|
||||
|
|
@ -82,9 +72,12 @@ services:
|
|||
service: peer-base
|
||||
environment:
|
||||
- CORE_PEER_ID=peer0.org2.example.com
|
||||
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051
|
||||
- CORE_PEER_ADDRESS=peer0.org2.example.com:9051
|
||||
- CORE_PEER_LISTENADDRESS=0.0.0.0:9051
|
||||
- CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:9052
|
||||
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:10051
|
||||
- CORE_PEER_LOCALMSPID=Org2MSP
|
||||
volumes:
|
||||
- /var/run/:/host/var/run/
|
||||
|
|
@ -92,8 +85,7 @@ services:
|
|||
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
|
||||
- peer0.org2.example.com:/var/hyperledger/production
|
||||
ports:
|
||||
- 9051:7051
|
||||
- 9053:7053
|
||||
- 9051:9051
|
||||
|
||||
peer1.org2.example.com:
|
||||
container_name: peer1.org2.example.com
|
||||
|
|
@ -102,9 +94,12 @@ services:
|
|||
service: peer-base
|
||||
environment:
|
||||
- CORE_PEER_ID=peer1.org2.example.com
|
||||
- CORE_PEER_ADDRESS=peer1.org2.example.com:7051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
|
||||
- CORE_PEER_ADDRESS=peer1.org2.example.com:10051
|
||||
- CORE_PEER_LISTENADDRESS=0.0.0.0:10051
|
||||
- CORE_PEER_CHAINCODEADDRESS=peer1.org2.example.com:10052
|
||||
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10052
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:10051
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:9051
|
||||
- CORE_PEER_LOCALMSPID=Org2MSP
|
||||
volumes:
|
||||
- /var/run/:/host/var/run/
|
||||
|
|
@ -112,5 +107,4 @@ services:
|
|||
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
|
||||
- peer1.org2.example.com:/var/hyperledger/production
|
||||
ports:
|
||||
- 10051:7051
|
||||
- 10053:7053
|
||||
- 10051:10051
|
||||
|
|
|
|||
|
|
@ -25,3 +25,26 @@ services:
|
|||
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
|
||||
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
|
||||
command: peer node start
|
||||
|
||||
orderer-base:
|
||||
image: hyperledger/fabric-orderer:$IMAGE_TAG
|
||||
environment:
|
||||
- FABRIC_LOGGING_SPEC=INFO
|
||||
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
|
||||
- ORDERER_GENERAL_GENESISMETHOD=file
|
||||
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
|
||||
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
|
||||
# enabled TLS
|
||||
- ORDERER_GENERAL_TLS_ENABLED=true
|
||||
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||
- ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
|
||||
- ORDERER_KAFKA_VERBOSE=true
|
||||
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
|
||||
command: orderer
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function printHelp() {
|
|||
echo " -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)"
|
||||
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
||||
echo " -l <language> - the chaincode language: golang (default) or node"
|
||||
echo " -o <consensus-type> - the consensus-type of the ordering service: solo (default) or kafka"
|
||||
echo " -o <consensus-type> - the consensus-type of the ordering service: solo (default), kafka, or etcdraft"
|
||||
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
||||
echo " -v - verbose mode"
|
||||
echo " byfn.sh -h (print this message)"
|
||||
|
|
@ -159,12 +159,16 @@ function networkUp() {
|
|||
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
||||
if [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
||||
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_COUCH up -d 2>&1
|
||||
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_COUCH up -d 2>&1
|
||||
else
|
||||
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
|
||||
fi
|
||||
else
|
||||
if [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
||||
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA up -d 2>&1
|
||||
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 up -d 2>&1
|
||||
else
|
||||
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE up -d 2>&1
|
||||
fi
|
||||
|
|
@ -176,10 +180,16 @@ function networkUp() {
|
|||
|
||||
if [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
||||
sleep 1
|
||||
echo "Sleeping 10s to allow kafka cluster to complete booting"
|
||||
echo "Sleeping 10s to allow $CONSENSUS_TYPE cluster to complete booting"
|
||||
sleep 9
|
||||
fi
|
||||
|
||||
if [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||
sleep 1
|
||||
echo "Sleeping 15s to allow $CONSENSUS_TYPE cluster to complete booting"
|
||||
sleep 14
|
||||
fi
|
||||
|
||||
# now run the end to end script
|
||||
docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE
|
||||
if [ $? -ne 0 ]; then
|
||||
|
|
@ -208,12 +218,16 @@ function upgradeNetwork() {
|
|||
if [ "${IF_COUCHDB}" == "couchdb" ]; then
|
||||
if [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
||||
COMPOSE_FILES="-f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_COUCH"
|
||||
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||
COMPOSE_FILES="-f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_COUCH"
|
||||
else
|
||||
COMPOSE_FILES="-f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH"
|
||||
fi
|
||||
else
|
||||
if [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
||||
COMPOSE_FILES="-f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA"
|
||||
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||
COMPOSE_FILES="-f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2"
|
||||
else
|
||||
COMPOSE_FILES="-f $COMPOSE_FILE"
|
||||
fi
|
||||
|
|
@ -263,7 +277,7 @@ function upgradeNetwork() {
|
|||
function networkDown() {
|
||||
# stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3
|
||||
# stop kafka and zookeeper containers in case we're running with kafka consensus-type
|
||||
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans
|
||||
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans
|
||||
|
||||
# Don't remove the generated artifacts -- note, the ledgers are always removed
|
||||
if [ "$MODE" != "restart" ]; then
|
||||
|
|
@ -413,6 +427,8 @@ function generateChannelArtifacts() {
|
|||
configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
||||
elif [ "$CONSENSUS_TYPE" == "kafka" ]; then
|
||||
configtxgen -profile SampleDevModeKafka -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
||||
elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then
|
||||
configtxgen -profile SampleMultiNodeEtcdRaft -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
|
||||
else
|
||||
set +x
|
||||
echo "unrecognized CONSESUS_TYPE='$CONSENSUS_TYPE'. exiting"
|
||||
|
|
@ -484,6 +500,8 @@ COMPOSE_FILE_COUCH=docker-compose-couch.yaml
|
|||
COMPOSE_FILE_ORG3=docker-compose-org3.yaml
|
||||
# kafka and zookeeper compose file
|
||||
COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml
|
||||
# two additional etcd/raft orderers
|
||||
COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml
|
||||
#
|
||||
# use golang as the default language for chaincode
|
||||
LANGUAGE=golang
|
||||
|
|
@ -540,7 +558,7 @@ while getopts "h?c:t:d:f:s:l:i:o:v" opt; do
|
|||
i)
|
||||
IMAGETAG=$(go env GOARCH)"-"$OPTARG
|
||||
;;
|
||||
o)
|
||||
o)
|
||||
CONSENSUS_TYPE=$OPTARG
|
||||
;;
|
||||
v)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ Organizations:
|
|||
# for cross org gossip communication. Note, this value is only
|
||||
# encoded in the genesis block in the Application section context
|
||||
- Host: peer0.org2.example.com
|
||||
Port: 7051
|
||||
Port: 9051
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
|
@ -314,6 +314,7 @@ Profiles:
|
|||
- *Org2
|
||||
TwoOrgsChannel:
|
||||
Consortium: SampleConsortium
|
||||
<<: *ChannelDefaults
|
||||
Application:
|
||||
<<: *ApplicationDefaults
|
||||
Organizations:
|
||||
|
|
@ -345,4 +346,54 @@ Profiles:
|
|||
SampleConsortium:
|
||||
Organizations:
|
||||
- *Org1
|
||||
- *Org2
|
||||
- *Org2
|
||||
|
||||
SampleMultiNodeEtcdRaft:
|
||||
<<: *ChannelDefaults
|
||||
Capabilities:
|
||||
<<: *ChannelCapabilities
|
||||
Orderer:
|
||||
<<: *OrdererDefaults
|
||||
OrdererType: etcdraft
|
||||
EtcdRaft:
|
||||
Consenters:
|
||||
- Host: orderer.example.com
|
||||
Port: 7050
|
||||
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
|
||||
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
|
||||
- Host: orderer2.example.com
|
||||
Port: 7050
|
||||
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
|
||||
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
|
||||
- Host: orderer3.example.com
|
||||
Port: 7050
|
||||
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
|
||||
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
|
||||
- Host: orderer4.example.com
|
||||
Port: 7050
|
||||
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
|
||||
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
|
||||
- Host: orderer5.example.com
|
||||
Port: 7050
|
||||
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
|
||||
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
|
||||
Addresses:
|
||||
- orderer.example.com:7050
|
||||
- orderer2.example.com:7050
|
||||
- orderer3.example.com:7050
|
||||
- orderer4.example.com:7050
|
||||
- orderer5.example.com:7050
|
||||
|
||||
Organizations:
|
||||
- *OrdererOrg
|
||||
Capabilities:
|
||||
<<: *OrdererCapabilities
|
||||
Application:
|
||||
<<: *ApplicationDefaults
|
||||
Organizations:
|
||||
- <<: *OrdererOrg
|
||||
Consortiums:
|
||||
SampleConsortium:
|
||||
Organizations:
|
||||
- *Org1
|
||||
- *Org2
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@ OrdererOrgs:
|
|||
# ---------------------------------------------------------------------------
|
||||
Specs:
|
||||
- Hostname: orderer
|
||||
- Hostname: orderer2
|
||||
- Hostname: orderer3
|
||||
- Hostname: orderer4
|
||||
- Hostname: orderer5
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# "PeerOrgs" - Definition of organizations managing peer nodes
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
77
first-network/docker-compose-etcdraft2.yaml
Normal file
77
first-network/docker-compose-etcdraft2.yaml
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# Copyright IBM Corp. All Rights Reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
version: '2'
|
||||
|
||||
volumes:
|
||||
orderer2.example.com:
|
||||
orderer3.example.com:
|
||||
orderer4.example.com:
|
||||
orderer5.example.com:
|
||||
|
||||
networks:
|
||||
byfn:
|
||||
|
||||
services:
|
||||
|
||||
orderer2.example.com:
|
||||
extends:
|
||||
file: base/peer-base.yaml
|
||||
service: orderer-base
|
||||
container_name: orderer2.example.com
|
||||
networks:
|
||||
- byfn
|
||||
volumes:
|
||||
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp:/var/hyperledger/orderer/msp
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/:/var/hyperledger/orderer/tls
|
||||
- orderer2.example.com:/var/hyperledger/production/orderer
|
||||
ports:
|
||||
- 8050:7050
|
||||
|
||||
orderer3.example.com:
|
||||
extends:
|
||||
file: base/peer-base.yaml
|
||||
service: orderer-base
|
||||
container_name: orderer3.example.com
|
||||
networks:
|
||||
- byfn
|
||||
volumes:
|
||||
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/msp:/var/hyperledger/orderer/msp
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/:/var/hyperledger/orderer/tls
|
||||
- orderer3.example.com:/var/hyperledger/production/orderer
|
||||
ports:
|
||||
- 9050:7050
|
||||
|
||||
orderer4.example.com:
|
||||
extends:
|
||||
file: base/peer-base.yaml
|
||||
service: orderer-base
|
||||
container_name: orderer4.example.com
|
||||
networks:
|
||||
- byfn
|
||||
volumes:
|
||||
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/msp:/var/hyperledger/orderer/msp
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/:/var/hyperledger/orderer/tls
|
||||
- orderer4.example.com:/var/hyperledger/production/orderer
|
||||
ports:
|
||||
- 10050:7050
|
||||
|
||||
orderer5.example.com:
|
||||
extends:
|
||||
file: base/peer-base.yaml
|
||||
service: orderer-base
|
||||
container_name: orderer5.example.com
|
||||
networks:
|
||||
- byfn
|
||||
volumes:
|
||||
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/msp:/var/hyperledger/orderer/msp
|
||||
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/:/var/hyperledger/orderer/tls
|
||||
- orderer5.example.com:/var/hyperledger/production/orderer
|
||||
ports:
|
||||
- 11050:7050
|
||||
|
|
@ -21,8 +21,12 @@ services:
|
|||
service: peer-base
|
||||
environment:
|
||||
- CORE_PEER_ID=peer0.org3.example.com
|
||||
- CORE_PEER_ADDRESS=peer0.org3.example.com:7051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:7051
|
||||
- CORE_PEER_ADDRESS=peer0.org3.example.com:11051
|
||||
- CORE_PEER_LISTENADDRESS=0.0.0.0:11051
|
||||
- CORE_PEER_CHAINCODEADDRESS=peer0.org3.example.com:11052
|
||||
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11052
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org3.example.com:12051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:11051
|
||||
- CORE_PEER_LOCALMSPID=Org3MSP
|
||||
volumes:
|
||||
- /var/run/:/host/var/run/
|
||||
|
|
@ -30,8 +34,7 @@ services:
|
|||
- ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls:/etc/hyperledger/fabric/tls
|
||||
- peer0.org3.example.com:/var/hyperledger/production
|
||||
ports:
|
||||
- 11051:7051
|
||||
- 11053:7053
|
||||
- 11051:11051
|
||||
networks:
|
||||
- byfn
|
||||
|
||||
|
|
@ -42,9 +45,12 @@ services:
|
|||
service: peer-base
|
||||
environment:
|
||||
- CORE_PEER_ID=peer1.org3.example.com
|
||||
- CORE_PEER_ADDRESS=peer1.org3.example.com:7051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org3.example.com:7051
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:7051
|
||||
- CORE_PEER_ADDRESS=peer1.org3.example.com:12051
|
||||
- CORE_PEER_LISTENADDRESS=0.0.0.0:12051
|
||||
- CORE_PEER_CHAINCODEADDRESS=peer1.org3.example.com:12052
|
||||
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:12052
|
||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:11051
|
||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org3.example.com:12051
|
||||
- CORE_PEER_LOCALMSPID=Org3MSP
|
||||
volumes:
|
||||
- /var/run/:/host/var/run/
|
||||
|
|
@ -52,8 +58,7 @@ services:
|
|||
- ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer1.org3.example.com/tls:/etc/hyperledger/fabric/tls
|
||||
- peer1.org3.example.com:/var/hyperledger/production
|
||||
ports:
|
||||
- 12051:7051
|
||||
- 12053:7053
|
||||
- 12051:12051
|
||||
networks:
|
||||
- byfn
|
||||
|
||||
|
|
@ -69,7 +74,7 @@ services:
|
|||
- FABRIC_LOGGING_SPEC=INFO
|
||||
#- FABRIC_LOGGING_SPEC=DEBUG
|
||||
- CORE_PEER_ID=Org3cli
|
||||
- CORE_PEER_ADDRESS=peer0.org3.example.com:7051
|
||||
- CORE_PEER_ADDRESS=peer0.org3.example.com:11051
|
||||
- CORE_PEER_LOCALMSPID=Org3MSP
|
||||
- CORE_PEER_TLS_ENABLED=true
|
||||
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ function networkUp () {
|
|||
|
||||
# Tear down running network
|
||||
function networkDown () {
|
||||
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans
|
||||
docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans
|
||||
# Don't remove containers, images, etc if restarting
|
||||
if [ "$MODE" != "restart" ]; then
|
||||
#Cleanup the chaincode containers
|
||||
|
|
@ -247,6 +247,8 @@ COMPOSE_FILE_ORG3=docker-compose-org3.yaml
|
|||
COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml
|
||||
# kafka and zookeeper compose file
|
||||
COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml
|
||||
# two additional etcd/raft orderers
|
||||
COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml
|
||||
# use golang as the default language for chaincode
|
||||
LANGUAGE=golang
|
||||
# default image tag
|
||||
|
|
|
|||
|
|
@ -28,4 +28,4 @@ Organizations:
|
|||
# for cross org gossip communication. Note, this value is only
|
||||
# encoded in the genesis block in the Application section context
|
||||
- Host: peer0.org3.example.com
|
||||
Port: 7051
|
||||
Port: 11051
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ setGlobals() {
|
|||
if [ $PEER -eq 0 ]; then
|
||||
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
|
||||
else
|
||||
CORE_PEER_ADDRESS=peer1.org1.example.com:7051
|
||||
CORE_PEER_ADDRESS=peer1.org1.example.com:8051
|
||||
fi
|
||||
elif [ $ORG -eq 2 ]; then
|
||||
CORE_PEER_LOCALMSPID="Org2MSP"
|
||||
CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA
|
||||
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
|
||||
if [ $PEER -eq 0 ]; then
|
||||
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
|
||||
CORE_PEER_ADDRESS=peer0.org2.example.com:9051
|
||||
else
|
||||
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
|
||||
CORE_PEER_ADDRESS=peer1.org2.example.com:10051
|
||||
fi
|
||||
|
||||
elif [ $ORG -eq 3 ]; then
|
||||
|
|
@ -55,9 +55,9 @@ setGlobals() {
|
|||
CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG3_CA
|
||||
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp
|
||||
if [ $PEER -eq 0 ]; then
|
||||
CORE_PEER_ADDRESS=peer0.org3.example.com:7051
|
||||
CORE_PEER_ADDRESS=peer0.org3.example.com:11051
|
||||
else
|
||||
CORE_PEER_ADDRESS=peer1.org3.example.com:7051
|
||||
CORE_PEER_ADDRESS=peer1.org3.example.com:12051
|
||||
fi
|
||||
else
|
||||
echo "================== ERROR !!! ORG Unknown =================="
|
||||
|
|
@ -277,9 +277,10 @@ parsePeerConnectionParameters() {
|
|||
PEER_CONN_PARMS=""
|
||||
PEERS=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
setGlobals $1 $2
|
||||
PEER="peer$1.org$2"
|
||||
PEERS="$PEERS $PEER"
|
||||
PEER_CONN_PARMS="$PEER_CONN_PARMS --peerAddresses $PEER.example.com:7051"
|
||||
PEER_CONN_PARMS="$PEER_CONN_PARMS --peerAddresses $CORE_PEER_ADDRESS"
|
||||
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "true" ]; then
|
||||
TLSINFO=$(eval echo "--tlsRootCertFiles \$PEER$1_ORG$2_CA")
|
||||
PEER_CONN_PARMS="$PEER_CONN_PARMS $TLSINFO"
|
||||
|
|
|
|||
|
|
@ -4,11 +4,9 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# exit on first error
|
||||
|
||||
export BASE_FOLDER=$WORKSPACE/gopath/src/github.com/hyperledger
|
||||
export NEXUS_URL=nexus3.hyperledger.org:10001
|
||||
export ORG_NAME="hyperledger/fabric"
|
||||
|
||||
Parse_Arguments() {
|
||||
|
|
@ -54,14 +52,13 @@ function clearContainers () {
|
|||
}
|
||||
|
||||
function removeUnwantedImages() {
|
||||
for i in $(docker images | grep none | awk '{print $3}'); do
|
||||
docker rmi ${i} || true
|
||||
done
|
||||
|
||||
for i in $(docker images | grep none | awk '{print $3}'); do
|
||||
docker rmi ${i} || true
|
||||
done
|
||||
|
||||
for i in $(docker images | grep -vE ".*baseimage.*(0.4.13|0.4.14)" | grep -vE ".*baseos.*(0.4.13|0.4.14)" | grep -vE ".*couchdb.*(0.4.13|0.4.14)" | grep -vE ".*zoo.*(0.4.13|0.4.14)" | grep -vE ".*kafka.*(0.4.13|0.4.14)" | grep -v "REPOSITORY" | awk '{print $1":" $2}'); do
|
||||
docker rmi ${i} || true
|
||||
done
|
||||
for i in $(docker images | grep -vE ".*baseimage.*(0.4.13|0.4.14)" | grep -vE ".*baseos.*(0.4.13|0.4.14)" | grep -vE ".*couchdb.*(0.4.13|0.4.14)" | grep -vE ".*zoo.*(0.4.13|0.4.14)" | grep -vE ".*kafka.*(0.4.13|0.4.14)" | grep -v "REPOSITORY" | awk '{print $1":" $2}'); do
|
||||
docker rmi ${i} || true
|
||||
done
|
||||
}
|
||||
|
||||
# Remove /tmp/fabric-shim
|
||||
|
|
@ -115,22 +112,20 @@ pull_Thirdparty_Images() {
|
|||
}
|
||||
# pull Docker images from nexus
|
||||
pull_Docker_Images() {
|
||||
for IMAGES in ca peer orderer tools ccenv nodeenv; do
|
||||
for IMAGES in ca peer orderer tools ccenv; do
|
||||
echo "-----------> pull $IMAGES image"
|
||||
echo
|
||||
docker pull $NEXUS_URL/$ORG_NAME-$IMAGES:$IMAGE_TAG > /dev/null 2>&1
|
||||
docker pull $ORG_NAME-$IMAGES:$VERSION > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "\033[31m FAILED to pull docker images" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
docker tag $NEXUS_URL/$ORG_NAME-$IMAGES:$IMAGE_TAG $ORG_NAME-$IMAGES
|
||||
docker tag $NEXUS_URL/$ORG_NAME-$IMAGES:$IMAGE_TAG $ORG_NAME-$IMAGES:$ARCH-$VERSION
|
||||
docker tag $NEXUS_URL/$ORG_NAME-$IMAGES:$IMAGE_TAG $ORG_NAME-$IMAGES:$VERSION
|
||||
docker rmi -f $NEXUS_URL/$ORG_NAME-$IMAGES:$IMAGE_TAG
|
||||
docker tag $ORG_NAME-$IMAGES:$VERSION $ORG_NAME-$IMAGES
|
||||
done
|
||||
echo
|
||||
docker images | grep hyperledger/fabric
|
||||
}
|
||||
|
||||
# run byfn,eyfn tests
|
||||
byfn_eyfn_Tests() {
|
||||
echo
|
||||
|
|
|
|||
|
|
@ -12,28 +12,12 @@ MARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/
|
|||
echo "MARCH: $MARCH"
|
||||
echo "======== PULL fabric BINARIES ========"
|
||||
echo
|
||||
# Set Nexus Snapshot URL
|
||||
NEXUS_URL=https://nexus.hyperledger.org/content/repositories/snapshots/org/hyperledger/fabric/hyperledger-fabric-latest/$MARCH.latest-SNAPSHOT
|
||||
|
||||
# Download the maven-metadata.xml file
|
||||
curl $NEXUS_URL/maven-metadata.xml > maven-metadata.xml
|
||||
if grep -q "not found in local storage of repository" "maven-metadata.xml"; then
|
||||
echo "FAILED: Unable to download from $NEXUS_URL"
|
||||
else
|
||||
# Set latest tar file to the VERSION
|
||||
VERSION=$(grep value maven-metadata.xml | sort -u | cut -d "<" -f2|cut -d ">" -f2)
|
||||
# Download tar.gz file and extract it
|
||||
cd $BASE_FOLDER/fabric-samples || exit
|
||||
mkdir -p $BASE_FOLDER/fabric-samples/bin
|
||||
curl $NEXUS_URL/hyperledger-fabric-latest-$VERSION.tar.gz | tar xz
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "\033[31m FAILED to download binaries" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
rm hyperledger-fabric-*.tar.gz
|
||||
rm -f maven-metadata.xml
|
||||
echo "Finished pulling fabric binaries..."
|
||||
echo
|
||||
cd $BASE_FOLDER/fabric-samples || exit
|
||||
# Download fabric binaries from nexus
|
||||
curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/$MARCH-$VERSION/hyperledger-fabric-$MARCH-$VERSION.tar.gz | tar xz
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "\033[31m FAILED to download binaries" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $BASE_FOLDER/fabric-samples/first-network || exit
|
||||
|
|
@ -41,9 +25,10 @@ export PATH=$BASE_FOLDER/fabric-samples/bin:$PATH
|
|||
|
||||
logs() {
|
||||
|
||||
# Create Logs directory
|
||||
# Create Docker_Container_Logs directory
|
||||
mkdir -p $WORKSPACE/Docker_Container_Logs
|
||||
|
||||
# Save logs in Logs directory
|
||||
for CONTAINER in ${CONTAINER_LIST[*]}; do
|
||||
docker logs $CONTAINER.example.com >& $WORKSPACE/Docker_Container_Logs/$CONTAINER-$1.log
|
||||
echo
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
# if version not passed in, default to latest released version
|
||||
export VERSION=1.4.0-rc2
|
||||
export VERSION=1.4.0
|
||||
# if ca version not passed in, default to latest released version
|
||||
export CA_VERSION=$VERSION
|
||||
# current version of thirdparty images (couchdb, kafka and zookeeper) released
|
||||
|
|
@ -32,8 +32,8 @@ printHelp() {
|
|||
echo "-d - bypass docker image download"
|
||||
echo "-b - bypass download of platform-specific binaries"
|
||||
echo
|
||||
echo "e.g. bootstrap.sh 1.4.0-rc2 1.4.0-rc2 0.4.14"
|
||||
echo "would download docker images and binaries for version 1.4.0-rc2 (fabric) 1.4.0-rc2 (fabric-ca) 0.4.14 (thirdparty)"
|
||||
echo "e.g. bootstrap.sh 1.4.0 1.4.0 0.4.14"
|
||||
echo "would download docker images and binaries for version 1.4.0 (fabric) 1.4.0 (fabric-ca) 0.4.14 (thirdparty)"
|
||||
}
|
||||
|
||||
dockerFabricPull() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue