mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-26 03:25:09 +00:00
Merge branch 'main' into erc20java-chaincode
This commit is contained in:
commit
c20d6d5f64
13 changed files with 486 additions and 590 deletions
|
|
@ -20,7 +20,7 @@ export const ORG2 = 'Org2';
|
|||
|
||||
export const JOB_QUEUE_NAME = 'submit';
|
||||
|
||||
/*
|
||||
/**
|
||||
* Log level for the REST server
|
||||
*/
|
||||
export const logLevel = env
|
||||
|
|
@ -28,7 +28,7 @@ export const logLevel = env
|
|||
.default('info')
|
||||
.asEnum(['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent']);
|
||||
|
||||
/*
|
||||
/**
|
||||
* The port to start the REST server on
|
||||
*/
|
||||
export const port = env
|
||||
|
|
@ -37,7 +37,7 @@ export const port = env
|
|||
.example('3000')
|
||||
.asPortNumber();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The type of backoff to use for retrying failed submit jobs
|
||||
*/
|
||||
export const submitJobBackoffType = env
|
||||
|
|
@ -45,7 +45,7 @@ export const submitJobBackoffType = env
|
|||
.default('fixed')
|
||||
.asEnum(['fixed', 'exponential']);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Backoff delay for retrying failed submit jobs in milliseconds
|
||||
*/
|
||||
export const submitJobBackoffDelay = env
|
||||
|
|
@ -54,7 +54,7 @@ export const submitJobBackoffDelay = env
|
|||
.example('3000')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The total number of attempts to try a submit job until it completes
|
||||
*/
|
||||
export const submitJobAttempts = env
|
||||
|
|
@ -63,7 +63,7 @@ export const submitJobAttempts = env
|
|||
.example('5')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The maximum number of submit jobs that can be processed in parallel
|
||||
*/
|
||||
export const submitJobConcurrency = env
|
||||
|
|
@ -72,7 +72,7 @@ export const submitJobConcurrency = env
|
|||
.example('5')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The number of completed submit jobs to keep
|
||||
*/
|
||||
export const maxCompletedSubmitJobs = env
|
||||
|
|
@ -81,7 +81,7 @@ export const maxCompletedSubmitJobs = env
|
|||
.example('1000')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The number of failed submit jobs to keep
|
||||
*/
|
||||
export const maxFailedSubmitJobs = env
|
||||
|
|
@ -90,7 +90,7 @@ export const maxFailedSubmitJobs = env
|
|||
.example('1000')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Whether to initialise a scheduler for the submit job queue
|
||||
* There must be at least on queue scheduler to handle retries and you may want
|
||||
* more than one for redundancy
|
||||
|
|
@ -101,7 +101,7 @@ export const submitJobQueueScheduler = env
|
|||
.example('true')
|
||||
.asBoolStrict();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Whether to convert discovered host addresses to be 'localhost'
|
||||
* This should be set to 'true' when running a docker composed fabric network on the
|
||||
* local system, e.g. using the test network; otherwise should it should be 'false'
|
||||
|
|
@ -112,7 +112,7 @@ export const asLocalhost = env
|
|||
.example('true')
|
||||
.asBoolStrict();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The Org1 MSP ID
|
||||
*/
|
||||
export const mspIdOrg1 = env
|
||||
|
|
@ -121,7 +121,7 @@ export const mspIdOrg1 = env
|
|||
.example(`${ORG1}MSP`)
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The Org2 MSP ID
|
||||
*/
|
||||
export const mspIdOrg2 = env
|
||||
|
|
@ -130,7 +130,7 @@ export const mspIdOrg2 = env
|
|||
.example(`${ORG2}MSP`)
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Name of the channel which the basic asset sample chaincode has been installed on
|
||||
*/
|
||||
export const channelName = env
|
||||
|
|
@ -139,7 +139,7 @@ export const channelName = env
|
|||
.example('mychannel')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Name used to install the basic asset sample
|
||||
*/
|
||||
export const chaincodeName = env
|
||||
|
|
@ -148,7 +148,7 @@ export const chaincodeName = env
|
|||
.example('basic')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The transaction submit timeout in seconds for commit notification to complete
|
||||
*/
|
||||
export const commitTimeout = env
|
||||
|
|
@ -157,7 +157,7 @@ export const commitTimeout = env
|
|||
.example('300')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The transaction submit timeout in seconds for the endorsement to complete
|
||||
*/
|
||||
export const endorseTimeout = env
|
||||
|
|
@ -166,7 +166,7 @@ export const endorseTimeout = env
|
|||
.example('30')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The transaction query timeout in seconds
|
||||
*/
|
||||
export const queryTimeout = env
|
||||
|
|
@ -175,7 +175,7 @@ export const queryTimeout = env
|
|||
.example('3')
|
||||
.asIntPositive();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The Org1 connection profile JSON
|
||||
*/
|
||||
export const connectionProfileOrg1 = env
|
||||
|
|
@ -186,7 +186,7 @@ export const connectionProfileOrg1 = env
|
|||
)
|
||||
.asJsonObject() as Record<string, unknown>;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Certificate for an Org1 identity to evaluate and submit transactions
|
||||
*/
|
||||
export const certificateOrg1 = env
|
||||
|
|
@ -195,7 +195,7 @@ export const certificateOrg1 = env
|
|||
.example('"-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n"')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Private key for an Org1 identity to evaluate and submit transactions
|
||||
*/
|
||||
export const privateKeyOrg1 = env
|
||||
|
|
@ -204,7 +204,7 @@ export const privateKeyOrg1 = env
|
|||
.example('"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n"')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The Org2 connection profile JSON
|
||||
*/
|
||||
export const connectionProfileOrg2 = env
|
||||
|
|
@ -215,7 +215,7 @@ export const connectionProfileOrg2 = env
|
|||
)
|
||||
.asJsonObject() as Record<string, unknown>;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Certificate for an Org2 identity to evaluate and submit transactions
|
||||
*/
|
||||
export const certificateOrg2 = env
|
||||
|
|
@ -224,7 +224,7 @@ export const certificateOrg2 = env
|
|||
.example('"-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----\\n"')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Private key for an Org2 identity to evaluate and submit transactions
|
||||
*/
|
||||
export const privateKeyOrg2 = env
|
||||
|
|
@ -233,7 +233,7 @@ export const privateKeyOrg2 = env
|
|||
.example('"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n"')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The host the Redis server is running on
|
||||
*/
|
||||
export const redisHost = env
|
||||
|
|
@ -242,7 +242,7 @@ export const redisHost = env
|
|||
.example('localhost')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* The port the Redis server is running on
|
||||
*/
|
||||
export const redisPort = env
|
||||
|
|
@ -251,7 +251,7 @@ export const redisPort = env
|
|||
.example('6379')
|
||||
.asPortNumber();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Username for the Redis server
|
||||
*/
|
||||
export const redisUsername = env
|
||||
|
|
@ -259,12 +259,12 @@ export const redisUsername = env
|
|||
.example('fabric')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Password for the Redis server
|
||||
*/
|
||||
export const redisPassword = env.get('REDIS_PASSWORD').asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* API key for Org1
|
||||
* Specify this API key with the X-Api-Key header to use the Org1 connection profile and credentials
|
||||
*/
|
||||
|
|
@ -274,7 +274,7 @@ export const org1ApiKey = env
|
|||
.example('123')
|
||||
.asString();
|
||||
|
||||
/*
|
||||
/**
|
||||
* API key for Org2
|
||||
* Specify this API key with the X-Api-Key header to use the Org2 connection profile and credentials
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
import { TimeoutError, TransactionError } from 'fabric-network';
|
||||
import { logger } from './logger';
|
||||
|
||||
/*
|
||||
/**
|
||||
* Base type for errors from the smart contract.
|
||||
*
|
||||
* These errors will not be retried.
|
||||
|
|
@ -25,7 +25,7 @@ export class ContractError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Represents the error which occurs when the transaction being submitted or
|
||||
* evaluated is not implemented in a smart contract.
|
||||
*/
|
||||
|
|
@ -38,7 +38,7 @@ export class TransactionNotFoundError extends ContractError {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Represents the error which occurs in the basic asset transfer smart contract
|
||||
* implementation when an asset already exists.
|
||||
*/
|
||||
|
|
@ -51,7 +51,7 @@ export class AssetExistsError extends ContractError {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Represents the error which occurs in the basic asset transfer smart contract
|
||||
* implementation when an asset does not exist.
|
||||
*/
|
||||
|
|
@ -64,26 +64,30 @@ export class AssetNotFoundError extends ContractError {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Enumeration of possible retry actions.
|
||||
*
|
||||
* WithExistingTransactionId - transactions should be retried using the same
|
||||
* transaction ID to protect against duplicate transactions being committed if
|
||||
* a timeout error occurs
|
||||
*
|
||||
* WithNewTransactionId - transactions which could not be committed due to
|
||||
* other errors require a new transaction ID when retrying
|
||||
*
|
||||
* None - transactions that failed due to a duplicate transaction error, or
|
||||
* errors from the smart contract, should not be retried
|
||||
*/
|
||||
export enum RetryAction {
|
||||
/**
|
||||
* Transactions should be retried using the same transaction ID to protect
|
||||
* against duplicate transactions being committed if a timeout error occurs
|
||||
*/
|
||||
WithExistingTransactionId,
|
||||
|
||||
/**
|
||||
* Transactions which could not be committed due to other errors require a
|
||||
* new transaction ID when retrying
|
||||
*/
|
||||
WithNewTransactionId,
|
||||
|
||||
/**
|
||||
* Transactions that failed due to a duplicate transaction error, or errors
|
||||
* from the smart contract, should not be retried
|
||||
*/
|
||||
None,
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the required transaction retry action for an error.
|
||||
*
|
||||
* For this sample transactions are considered retriable if they fail with any
|
||||
|
|
@ -92,11 +96,11 @@ export enum RetryAction {
|
|||
*
|
||||
* You might decide to retry transactions which fail with specific errors
|
||||
* instead, for example:
|
||||
* MVCC_READ_CONFLICT
|
||||
* PHANTOM_READ_CONFLICT
|
||||
* ENDORSEMENT_POLICY_FAILURE
|
||||
* CHAINCODE_VERSION_CONFLICT
|
||||
* EXPIRED_CHAINCODE
|
||||
* - MVCC_READ_CONFLICT
|
||||
* - PHANTOM_READ_CONFLICT
|
||||
* - ENDORSEMENT_POLICY_FAILURE
|
||||
* - CHAINCODE_VERSION_CONFLICT
|
||||
* - EXPIRED_CHAINCODE
|
||||
*/
|
||||
export const getRetryAction = (err: unknown): RetryAction => {
|
||||
if (isDuplicateTransactionError(err) || err instanceof ContractError) {
|
||||
|
|
@ -108,7 +112,7 @@ export const getRetryAction = (err: unknown): RetryAction => {
|
|||
return RetryAction.WithNewTransactionId;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Type guard to make catching unknown errors easier
|
||||
*/
|
||||
export const isErrorLike = (err: unknown): err is Error => {
|
||||
|
|
@ -122,7 +126,7 @@ export const isErrorLike = (err: unknown): err is Error => {
|
|||
);
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks whether an error was caused by a duplicate transaction.
|
||||
*
|
||||
* This is ...painful.
|
||||
|
|
@ -155,13 +159,13 @@ export const isDuplicateTransactionError = (err: unknown): boolean => {
|
|||
return isDuplicate === true;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Matches asset already exists error strings from the asset contract
|
||||
*
|
||||
* The regex needs to match the following error messages:
|
||||
* "the asset %s already exists"
|
||||
* "The asset ${id} already exists"
|
||||
* "Asset %s already exists"
|
||||
* - "the asset %s already exists"
|
||||
* - "The asset ${id} already exists"
|
||||
* - "Asset %s already exists"
|
||||
*/
|
||||
const matchAssetAlreadyExistsMessage = (message: string): string | null => {
|
||||
const assetAlreadyExistsRegex = /([tT]he )?[aA]sset \w* already exists/g;
|
||||
|
|
@ -178,13 +182,13 @@ const matchAssetAlreadyExistsMessage = (message: string): string | null => {
|
|||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Matches asset does not exist error strings from the asset contract
|
||||
*
|
||||
* The regex needs to match the following error messages:
|
||||
* "the asset %s does not exist"
|
||||
* "The asset ${id} does not exist"
|
||||
* "Asset %s does not exist"
|
||||
* - "the asset %s does not exist"
|
||||
* - "The asset ${id} does not exist"
|
||||
* - "Asset %s does not exist"
|
||||
*/
|
||||
const matchAssetDoesNotExistMessage = (message: string): string | null => {
|
||||
const assetDoesNotExistRegex = /([tT]he )?[aA]sset \w* does not exist/g;
|
||||
|
|
@ -201,12 +205,12 @@ const matchAssetDoesNotExistMessage = (message: string): string | null => {
|
|||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Matches transaction does not exist error strings from the contract API
|
||||
*
|
||||
* The regex needs to match the following error messages:
|
||||
* "Failed to get transaction with id %s, error Entry not found in index"
|
||||
* "Failed to get transaction with id %s, error no such transaction ID [%s] in index"
|
||||
* - "Failed to get transaction with id %s, error Entry not found in index"
|
||||
* - "Failed to get transaction with id %s, error no such transaction ID [%s] in index"
|
||||
*/
|
||||
const matchTransactionDoesNotExistMessage = (
|
||||
message: string
|
||||
|
|
@ -228,11 +232,12 @@ const matchTransactionDoesNotExistMessage = (
|
|||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Handles errors from evaluating and submitting transactions.
|
||||
*
|
||||
* Smart contract errors from the the basic asset transfer samples do not use
|
||||
* Smart contract errors from the basic asset transfer samples do not use
|
||||
* error codes so matching strings is the only option, which is not ideal.
|
||||
*
|
||||
* Note: the error message text is not the same for the Go, Java, and
|
||||
* Javascript implementations of the chaincode!
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import { logger } from './logger';
|
|||
import { handleError } from './errors';
|
||||
import * as protos from 'fabric-protos';
|
||||
|
||||
/*
|
||||
/**
|
||||
* Creates an in memory wallet to hold credentials for an Org1 and Org2 user
|
||||
*
|
||||
* In this sample there is a single user for each MSP ID to demonstrate how
|
||||
|
|
@ -55,7 +55,7 @@ export const createWallet = async (): Promise<Wallet> => {
|
|||
return wallet;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Create a Gateway connection
|
||||
*
|
||||
* Gateway instances can and should be reused rather than connecting to submit every transaction
|
||||
|
|
@ -89,7 +89,7 @@ export const createGateway = async (
|
|||
return gateway;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the network which the asset transfer sample chaincode is running on
|
||||
*
|
||||
* In addion to getting the contract, the network will also be used to
|
||||
|
|
@ -100,7 +100,7 @@ export const getNetwork = async (gateway: Gateway): Promise<Network> => {
|
|||
return network;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the asset transfer sample contract and the qscc system contract
|
||||
*
|
||||
* The system contract is used for the liveness REST endpoint
|
||||
|
|
@ -113,7 +113,7 @@ export const getContracts = async (
|
|||
return { assetContract, qsccContract };
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Evaluate a transaction and handle any errors
|
||||
*/
|
||||
export const evatuateTransaction = async (
|
||||
|
|
@ -137,7 +137,7 @@ export const evatuateTransaction = async (
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Submit a transaction and handle any errors
|
||||
*/
|
||||
export const submitTransaction = async (
|
||||
|
|
@ -159,7 +159,7 @@ export const submitTransaction = async (
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the validation code of the specified transaction
|
||||
*/
|
||||
export const getTransactionValidationCode = async (
|
||||
|
|
@ -181,7 +181,7 @@ export const getTransactionValidationCode = async (
|
|||
return validationCode;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the current block height
|
||||
*
|
||||
* This example of using a system contract is used for the liveness REST
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ const connection: ConnectionOptions = {
|
|||
password: config.redisPassword,
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set up the queue for submit jobs
|
||||
*/
|
||||
export const initJobQueue = (): Queue => {
|
||||
|
|
@ -72,7 +72,7 @@ export const initJobQueue = (): Queue => {
|
|||
return submitQueue;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set up a worker to process submit jobs on the queue, using the
|
||||
* processSubmitTransactionJob function below
|
||||
*/
|
||||
|
|
@ -104,7 +104,7 @@ export const initJobQueueWorker = (app: Application): Worker => {
|
|||
return worker;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Process a submit transaction request from the job queue
|
||||
*
|
||||
* The job will be retried if this function throws an error
|
||||
|
|
@ -209,7 +209,7 @@ export const processSubmitTransactionJob = async (
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set up a scheduler for the submit job queue
|
||||
*
|
||||
* This manages stalled and delayed jobs and is required for retries with backoff
|
||||
|
|
@ -226,7 +226,7 @@ export const initJobQueueScheduler = (): QueueScheduler => {
|
|||
return queueScheduler;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Helper to add a new submit transaction job to the queue
|
||||
*/
|
||||
export const addSubmitTransactionJob = async (
|
||||
|
|
@ -250,7 +250,7 @@ export const addSubmitTransactionJob = async (
|
|||
return job.id;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Helper to update the data for an existing job
|
||||
*/
|
||||
export const updateJobData = async (
|
||||
|
|
@ -274,7 +274,7 @@ export const updateJobData = async (
|
|||
await job.update(newData);
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Gets a job summary
|
||||
*
|
||||
* This function is used for the jobs REST endpoint
|
||||
|
|
@ -325,7 +325,7 @@ export const getJobSummary = async (
|
|||
return jobSummary;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the current job counts
|
||||
*
|
||||
* This function is used for the liveness REST endpoint
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import IORedis, { Redis, RedisOptions } from 'ioredis';
|
|||
import * as config from './config';
|
||||
import { logger } from './logger';
|
||||
|
||||
/*
|
||||
/**
|
||||
* Check whether the maxmemory-policy config is set to noeviction
|
||||
*
|
||||
* BullMQ requires this setting in redis
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ We need to use the latest 2.4.1 release as this contains some improvements to ma
|
|||
|
||||
## End-to-end with the the test-network
|
||||
|
||||
The `test-network` and some of the chaincodes have been updated to support running chaincode-as-a-service. The commands below assume that you've got the latest fabric-samples cloned, along with the latest Fabric docker images.
|
||||
The `test-network` and some of the chaincodes have been updated to support running chaincode-as-a-service. The commands below assume that you've got the latest fabric-samples cloned, along with the latest Fabric docker images.
|
||||
|
||||
It's useful to have two terminal windows open, one for starting the Fabric Network, and a second for monitoring all the docker containers.
|
||||
|
||||
|
|
@ -27,7 +27,6 @@ In your 'monitoring' window, run this to watch all activity from the all the doc
|
|||
./test-network/monitordocker.sh
|
||||
```
|
||||
|
||||
|
||||
In the 'Fabric Network' window, start the test network
|
||||
|
||||
```bash
|
||||
|
|
@ -44,8 +43,9 @@ You can run other variants of this command, eg to use CouchDB or CAs, without af
|
|||
Note that the order listed isn't mandatory. The key thing is that the containers are running before the first transaction is set by the peer. Remember that this could be on the `commit` if the `initRequired` flag is set.
|
||||
|
||||
This sequence can be run as follows
|
||||
|
||||
```bash
|
||||
./network.sh deployCCAAS -ccn basicts -ccp ../asset-transfer-basic/chaincode-typescript
|
||||
./network.sh deployCCAAS -ccn basicts -ccp ../asset-transfer-basic/chaincode-typescript
|
||||
```
|
||||
|
||||
This is very similar to the `deployCC` command, it needs the name, and path. But also needs to have the port the chaincode container is going use. As each container is on the `fabric-test` network, you might wish to alter this so there are no collisions with other chaincode containers.
|
||||
|
|
@ -59,7 +59,7 @@ To test things are working you can invoke the 'Contract Metadata' function. For
|
|||
|
||||
export CORE_PEER_TLS_ENABLED=true
|
||||
export CORE_PEER_LOCALMSPID="Org1MSP"
|
||||
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
|
||||
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||
export CORE_PEER_ADDRESS=localhost:7051
|
||||
export FABRIC_CFG_PATH=${PWD}/../config
|
||||
|
|
@ -68,15 +68,14 @@ export FABRIC_CFG_PATH=${PWD}/../config
|
|||
peer chaincode query -C mychannel -n basicts -c '{"Args":["org.hyperledger.fabric:GetMetadata"]}' | jq
|
||||
```
|
||||
|
||||
If you don't have `jq` installed omit ` | jq`. The metadata shows the details of the deployed contract and is JSON, so jq makes it easier to read. You can repeat the above commands for org2 to confirm that is working.
|
||||
If you don't have `jq` installed omit `| jq`. The metadata shows the details of the deployed contract and is JSON, so jq makes it easier to read. You can repeat the above commands for org2 to confirm that is working.
|
||||
|
||||
To run the Java example, change the `deployCCAAS` command as follows, This will create a two new containers.
|
||||
To run the Java example, change the `deployCCAAS` command as follows, This will create two new containers.
|
||||
|
||||
```bash
|
||||
./network.sh deployCCAAS -ccn basicj -ccp ../asset-transfer-basic/chaincode-typescript
|
||||
./network.sh deployCCAAS -ccn basicj -ccp ../asset-transfer-basic/chaincode-java
|
||||
```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If the JSON structure passed in is badly formatted JSON this error will be in the peer log:
|
||||
|
|
@ -85,7 +84,7 @@ If the JSON structure passed in is badly formatted JSON this error will be in th
|
|||
::Error: Failed to unmarshal json: cannot unmarshal string into Go value of type map[string]interface {} command=build
|
||||
```
|
||||
|
||||
## How to configure each langauge
|
||||
## How to configure each language
|
||||
|
||||
Each language can work in the '-as-a-service' mode. Note that the approaches here are based on the very latest libraries.
|
||||
When starting the image you can also specify any of the TLS options or additional logging options for the respective chaincode libraries.
|
||||
|
|
@ -96,7 +95,7 @@ With the v2.4.1 Java Chaincode libraries, there are no code changes to make or b
|
|||
|
||||
A sample docker run command could be as follows. The two key variables that are needed are the `CHAINCODE_SERVER_ADDRESS` and `CORE_CHAICODE_ID_NAME`
|
||||
|
||||
```
|
||||
```bash
|
||||
docker run --rm -d --name peer0org1_assettx_ccaas \
|
||||
--network fabric_test \
|
||||
-e CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 \
|
||||
|
|
@ -108,18 +107,15 @@ A sample docker run command could be as follows. The two key variables that are
|
|||
|
||||
For Node.js (JavaScript or TypeScript) chaincode, typically the `package.json` has `fabric-chaincode-node start` as the main start command. To run in the '-as-a-service' mode change this to `fabric-chaincode-node server --chaincode-address=$CHAINCODE_SERVER_ADDRESS --chaincode-id=$CHAINCODE_ID`
|
||||
|
||||
### Golang
|
||||
|
||||
TBC
|
||||
|
||||
## Debugging the Chaincode
|
||||
|
||||
Running in the '-as-a-service' mode offers options, similar to how the Fabric 'dev' mode works on debugging code. The restrictions of the 'dev' mode don't apply.
|
||||
|
||||
There is an option `-ccaasdr false` that can be provided on the `deployCCAAS` command. This will _not_ build the docker image or start a docker container. It does output the commands it would have run.
|
||||
There is an option `-ccaasdr false` that can be provided on the `deployCCAAS` command. This will _not_ build the docker image or start a docker container. It does output the commands it would have run.
|
||||
|
||||
Run this command, and you'll see similar output
|
||||
```
|
||||
|
||||
```bash
|
||||
./network.sh deployCCAAS -ccn basicj -ccp ../asset-transfer-basic/chaincode-java -ccaasdr false
|
||||
#....
|
||||
Not building docker image; this the command we would have run
|
||||
|
|
@ -129,14 +125,15 @@ Not starting docker containers; these are the commands we would have run
|
|||
docker run --rm -d --name peer0org1_basicj_ccaas --network fabric_test -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 -e CHAINCODE_ID=basicj_1.0:59dcd73a14e2db8eab7f7683343ce27ac242b93b4e8075605a460d63a0438405 -e CORE_CHAINCODE_ID_NAME=basicj_1.0:59dcd73a14e2db8eab7f7683343ce27ac242b93b4e8075605a460d63a0438405 basicj_ccaas_image:latest
|
||||
```
|
||||
|
||||
Depending on your directory, and what you need to debug you might need to adjust these commands.
|
||||
Depending on your directory, and what you need to debug you might need to adjust these commands.
|
||||
|
||||
### Building the docker image
|
||||
The first thing needed is to build the docker image. Remember that so long as the peer can connect to the hostname:port given in the `connection.json` the actual packaging of the chaincode is not important to the peer. You are at liberty to adjust the dockerfiles given here.
|
||||
|
||||
The first thing needed is to build the docker image. Remember that so long as the peer can connect to the hostname:port given in the `connection.json` the actual packaging of the chaincode is not important to the peer. You are at liberty to adjust the dockerfiles given hgere.
|
||||
|
||||
To manually build the docker image for the `asset-transfer-basic/chaincode-java`
|
||||
|
||||
```
|
||||
```bash
|
||||
docker build -f ../asset-transfer-basic/chaincode-java/Dockerfile -t basicj_ccaas_image:latest --build-arg CC_SERVER_PORT=9999 ../asset-transfer-basic/chaincode-java
|
||||
```
|
||||
|
||||
|
|
@ -145,13 +142,14 @@ docker build -f ../asset-transfer-basic/chaincode-java/Dockerfile -t basicj_ccaa
|
|||
You need to start the docker container.
|
||||
|
||||
NodeJs for example, could be started like this
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run --rm -it -p 9229:9229 --name peer0org2_basic_ccaas --network fabric_test -e DEBUG=true -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 -e CHAINCODE_ID=basic_1.0:7c7dff5cdc43c77ccea028c422b3348c3c1fb5a26ace0077cf3cc627bd355ef0 -e CORE_CHAINCODE_ID_NAME=basic_1.0:7c7dff5cdc43c77ccea028c422b3348c3c1fb5a26ace0077cf3cc627bd355ef0 basic_ccaas_image:latest
|
||||
```
|
||||
|
||||
Java for example, could be started like this
|
||||
|
||||
```
|
||||
```bash
|
||||
docker run --rm -it --name peer0org1_basicj_ccaas -p 8000:8000 --network fabric_test -e DEBUG=true -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 -e CHAINCODE_ID=basicj_1.0:b014a03d8eb1898535e25b4dfeeb3f8244c9f07d91a06aec03e2d19174c45e4f -e CORE_CHAINCODE_ID_NAME=basicj_1.0:b014a03d8e
|
||||
b1898535e25b4dfeeb3f8244c9f07d91a06aec03e2d19174c45e4f basicj_ccaas_image:latest
|
||||
```
|
||||
|
|
@ -159,9 +157,9 @@ b1898535e25b4dfeeb3f8244c9f07d91a06aec03e2d19174c45e4f basicj_ccaas_image:lates
|
|||
For all languages please note:
|
||||
|
||||
- the name of the container needs to match what the peer has in the `connection.json`
|
||||
- the peer is connecting to the chaincode container via the docker network. Therefore port 9999 does not need to forwarded to the host
|
||||
- If you are going to single step in a debugger, then you are likely to hit the Fabric transaction timeout value. By default this is 30seconds, meaning the chaincode has to complete transactions in 30 seconds or less. In the `test-network/docker/docker-composer-test-net.yml` add `CORE_CHAINCODE_EXECUTETIMEOUT=300s` to the environment options of each peer.
|
||||
- In the command above, the `-d` option has been removed from the command the test-network would have used, and has been replaced with `-it`. This means that docker container will not run in detached mode, and will run in the foregroud.
|
||||
- the peer is connecting to the chaincode container via the docker network. Therefore port 9999 does not need to be forwarded to the host
|
||||
- If you are going to single step in a debugger, then you are likely to hit the Fabric transaction timeout value. By default this is 30 seconds, meaning the chaincode has to complete transactions in 30 seconds or less. In the `test-network/docker/docker-composer-test-net.yml` add `CORE_CHAINCODE_EXECUTETIMEOUT=300s` to the environment options of each peer.
|
||||
- In the command above, the `-d` option has been removed from the command the test-network would have used, and has been replaced with `-it`. This means that docker container will not run in detached mode, and will run in the foreground.
|
||||
|
||||
For Node.js please note:
|
||||
|
||||
|
|
@ -170,11 +168,11 @@ For Node.js please note:
|
|||
- If you are using typescript, ensure that the typescript has been compiled with sourcemaps, otherwise a debugger will struggle matching up the source code.
|
||||
|
||||
For Java please note:
|
||||
|
||||
- Port 800 is forwarded, the debug port for the JVM
|
||||
- `-e DEBUG=true` will trigger the node runtime to be started in debug mode. This is encoded in the `docker/docker-entrypoint.sh` script - this is an example and you may wish to remove this in production images for security
|
||||
- In the java command with the option to start the debugger is `java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000 -jar /chaincode.jar` Note the `0.0.0.0` as the debug port needs to be bound to all network adapters so the debugger can be attached from outside the container
|
||||
|
||||
|
||||
## Running with multiple peers
|
||||
|
||||
In the traditional approach, each peer that the chaincode is approved on will have a container running the chaincode. With the '-as-a-service' approach we need to achieve the same architecture.
|
||||
|
|
@ -194,7 +192,7 @@ We can define the address to be a template in the `connection.json`
|
|||
|
||||
In the peer's environment configuration we then set for org1's peer1
|
||||
|
||||
```
|
||||
```bash
|
||||
CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG="{\"peername\":\"org1peer1\"}"
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
## Running the test network
|
||||
# Running the test network
|
||||
|
||||
You can use the `./network.sh` script to stand up a simple Fabric test network. The test network has two peer organizations with one peer each and a single node raft ordering service. You can also use the `./network.sh` script to create channels and deploy chaincode. For more information, see [Using the Fabric test network](https://hyperledger-fabric.readthedocs.io/en/latest/test_network.html). The test network is being introduced in Fabric v2.0 as the long term replacement for the `first-network` sample.
|
||||
|
||||
Before you can deploy the test network, you need to follow the instructions to [Install the Samples, Binaries and Docker Images](https://hyperledger-fabric.readthedocs.io/en/latest/install.html) in the Hyperledger Fabric documentation.
|
||||
|
||||
## Using the Peer commands
|
||||
|
||||
The `setOrgEnv.sh` script can be used to setup the environment variables for the ogrganziations, this will will help to be able to use the `peer` commands directly.
|
||||
|
||||
First, ensure that the peer binaries are on your path, and the Fabric Config path is set Assuming that you're in the `test-network` directory.
|
||||
|
|
@ -27,4 +28,8 @@ The `setOrgEnv` script outputs a series of `<name>=<value>` strings. These can t
|
|||
|
||||
## Chaincode-as-a-service
|
||||
|
||||
To learn more about how to use the improvements to the Chaincode-as-a-service please see this [tutorial](./test-network/../CHAINCODE_AS_A_SERVICE_TUTORIAL.md). It is expected that this will move to augment the tutorial in the [Hyperledger Fabric ReadTheDocs](https://hyperledger-fabric.readthedocs.io/en/release-2.4/cc_service.html)
|
||||
To learn more about how to use the improvements to the Chaincode-as-a-service please see this [tutorial](./CHAINCODE_AS_A_SERVICE_TUTORIAL.md). It is expected that this will move to augment the tutorial in the [Hyperledger Fabric ReadTheDocs](https://hyperledger-fabric.readthedocs.io/en/release-2.4/cc_service.html)
|
||||
|
||||
## Prometheus and Grafana
|
||||
|
||||
To enable the collection of fabric networks into Prometheus and also have a default Grafana dashboard please see this [tutorial](prometheus-grafana/README.md).
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ function createOrg1() {
|
|||
export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org1.example.com/
|
||||
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://admin:adminpw@localhost:7054 --caname ca-org1 --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://admin:adminpw@localhost:7054 --caname ca-org1 --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
echo 'NodeOUs:
|
||||
|
|
@ -25,56 +25,62 @@ function createOrg1() {
|
|||
Certificate: cacerts/localhost-7054-ca-org1.pem
|
||||
OrganizationalUnitIdentifier: orderer' > "${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml"
|
||||
|
||||
# Since the CA serves as both the organization CA and TLS CA, copy the org's root cert that was generated by CA startup into the org level ca and tlsca directories
|
||||
|
||||
# Copy org1's CA cert to org1's /msp/tlscacerts directory (for use in the channel MSP definition)
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org1.example.com/msp/tlscacerts"
|
||||
cp "${PWD}/organizations/fabric-ca/org1/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org1.example.com/msp/tlscacerts/ca.crt"
|
||||
|
||||
# Copy org1's CA cert to org1's /tlsca directory (for use by clients)
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org1.example.com/tlsca"
|
||||
cp "${PWD}/organizations/fabric-ca/org1/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
|
||||
|
||||
# Copy org1's CA cert to org1's /ca directory (for use by clients)
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org1.example.com/ca"
|
||||
cp "${PWD}/organizations/fabric-ca/org1/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem"
|
||||
|
||||
infoln "Registering peer0"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-org1 --id.name peer0 --id.secret peer0pw --id.type peer --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-org1 --id.name peer0 --id.secret peer0pw --id.type peer --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Registering user"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-org1 --id.name user1 --id.secret user1pw --id.type client --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-org1 --id.name user1 --id.secret user1pw --id.type client --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Registering the org admin"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-org1 --id.name org1admin --id.secret org1adminpw --id.type admin --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-org1 --id.name org1admin --id.secret org1adminpw --id.type admin --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Generating the peer0 msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp" --csr.hosts peer0.org1.example.com --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp" --csr.hosts peer0.org1.example.com --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/config.yaml"
|
||||
|
||||
infoln "Generating the peer0-tls certificates"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" --enrollment.profile tls --csr.hosts peer0.org1.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" --enrollment.profile tls --csr.hosts peer0.org1.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
# Copy the tls CA cert, server cert, server keystore to well known file names in the peer's tls directory that are referenced by peer startup config
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/tlscacerts/"* "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/signcerts/"* "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt"
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/keystore/"* "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key"
|
||||
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org1.example.com/msp/tlscacerts"
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/tlscacerts/"* "${PWD}/organizations/peerOrganizations/org1.example.com/msp/tlscacerts/ca.crt"
|
||||
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org1.example.com/tlsca"
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/tlscacerts/"* "${PWD}/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
|
||||
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org1.example.com/ca"
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/"* "${PWD}/organizations/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem"
|
||||
|
||||
infoln "Generating the user msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://user1:user1pw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://user1:user1pw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/config.yaml"
|
||||
|
||||
infoln "Generating the org admin msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://org1admin:org1adminpw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org1/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://org1admin:org1adminpw@localhost:7054 --caname ca-org1 -M "${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org1/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml"
|
||||
|
|
@ -87,7 +93,7 @@ function createOrg2() {
|
|||
export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org2.example.com/
|
||||
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://admin:adminpw@localhost:8054 --caname ca-org2 --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://admin:adminpw@localhost:8054 --caname ca-org2 --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
echo 'NodeOUs:
|
||||
|
|
@ -105,56 +111,62 @@ function createOrg2() {
|
|||
Certificate: cacerts/localhost-8054-ca-org2.pem
|
||||
OrganizationalUnitIdentifier: orderer' > "${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml"
|
||||
|
||||
# Since the CA serves as both the organization CA and TLS CA, copy the org's root cert that was generated by CA startup into the org level ca and tlsca directories
|
||||
|
||||
# Copy org2's CA cert to org2's /msp/tlscacerts directory (for use in the channel MSP definition)
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org2.example.com/msp/tlscacerts"
|
||||
cp "${PWD}/organizations/fabric-ca/org2/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org2.example.com/msp/tlscacerts/ca.crt"
|
||||
|
||||
# Copy org2's CA cert to org2's /tlsca directory (for use by clients)
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org2.example.com/tlsca"
|
||||
cp "${PWD}/organizations/fabric-ca/org2/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem"
|
||||
|
||||
# Copy org2's CA cert to org2's /ca directory (for use by clients)
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org2.example.com/ca"
|
||||
cp "${PWD}/organizations/fabric-ca/org2/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem"
|
||||
|
||||
infoln "Registering peer0"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-org2 --id.name peer0 --id.secret peer0pw --id.type peer --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-org2 --id.name peer0 --id.secret peer0pw --id.type peer --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Registering user"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-org2 --id.name user1 --id.secret user1pw --id.type client --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-org2 --id.name user1 --id.secret user1pw --id.type client --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Registering the org admin"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-org2 --id.name org2admin --id.secret org2adminpw --id.type admin --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-org2 --id.name org2admin --id.secret org2adminpw --id.type admin --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Generating the peer0 msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp" --csr.hosts peer0.org2.example.com --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp" --csr.hosts peer0.org2.example.com --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/config.yaml"
|
||||
|
||||
infoln "Generating the peer0-tls certificates"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls" --enrollment.profile tls --csr.hosts peer0.org2.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls" --enrollment.profile tls --csr.hosts peer0.org2.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
# Copy the tls CA cert, server cert, server keystore to well known file names in the peer's tls directory that are referenced by peer startup config
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/tlscacerts/"* "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/signcerts/"* "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt"
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/keystore/"* "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key"
|
||||
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org2.example.com/msp/tlscacerts"
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/tlscacerts/"* "${PWD}/organizations/peerOrganizations/org2.example.com/msp/tlscacerts/ca.crt"
|
||||
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org2.example.com/tlsca"
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/tlscacerts/"* "${PWD}/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem"
|
||||
|
||||
mkdir -p "${PWD}/organizations/peerOrganizations/org2.example.com/ca"
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/cacerts/"* "${PWD}/organizations/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem"
|
||||
|
||||
infoln "Generating the user msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://user1:user1pw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://user1:user1pw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/config.yaml"
|
||||
|
||||
infoln "Generating the org admin msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://org2admin:org2adminpw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org2/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://org2admin:org2adminpw@localhost:8054 --caname ca-org2 -M "${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org2/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml"
|
||||
|
|
@ -167,7 +179,7 @@ function createOrderer() {
|
|||
export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/ordererOrganizations/example.com
|
||||
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://admin:adminpw@localhost:9054 --caname ca-orderer --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://admin:adminpw@localhost:9054 --caname ca-orderer --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
echo 'NodeOUs:
|
||||
|
|
@ -185,41 +197,50 @@ function createOrderer() {
|
|||
Certificate: cacerts/localhost-9054-ca-orderer.pem
|
||||
OrganizationalUnitIdentifier: orderer' > "${PWD}/organizations/ordererOrganizations/example.com/msp/config.yaml"
|
||||
|
||||
# Since the CA serves as both the organization CA and TLS CA, copy the org's root cert that was generated by CA startup into the org level ca and tlsca directories
|
||||
|
||||
# Copy orderer org's CA cert to orderer org's /msp/tlscacerts directory (for use in the channel MSP definition)
|
||||
mkdir -p "${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts"
|
||||
cp "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem" "${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
|
||||
|
||||
# Copy orderer org's CA cert to orderer org's /tlsca directory (for use by clients)
|
||||
mkdir -p "${PWD}/organizations/ordererOrganizations/example.com/tlsca"
|
||||
cp "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem" "${PWD}/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"
|
||||
|
||||
infoln "Registering orderer"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-orderer --id.name orderer --id.secret ordererpw --id.type orderer --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-orderer --id.name orderer --id.secret ordererpw --id.type orderer --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Registering the orderer admin"
|
||||
set -x
|
||||
fabric-ca-client register --caname ca-orderer --id.name ordererAdmin --id.secret ordererAdminpw --id.type admin --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem"
|
||||
fabric-ca-client register --caname ca-orderer --id.name ordererAdmin --id.secret ordererAdminpw --id.type admin --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
infoln "Generating the orderer msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://orderer:ordererpw@localhost:9054 --caname ca-orderer -M "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp" --csr.hosts orderer.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://orderer:ordererpw@localhost:9054 --caname ca-orderer -M "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp" --csr.hosts orderer.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/ordererOrganizations/example.com/msp/config.yaml" "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/config.yaml"
|
||||
|
||||
infoln "Generating the orderer-tls certificates"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://orderer:ordererpw@localhost:9054 --caname ca-orderer -M "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls" --enrollment.profile tls --csr.hosts orderer.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://orderer:ordererpw@localhost:9054 --caname ca-orderer -M "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls" --enrollment.profile tls --csr.hosts orderer.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
# Copy the tls CA cert, server cert, server keystore to well known file names in the orderer's tls directory that are referenced by orderer startup config
|
||||
cp "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/tlscacerts/"* "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt"
|
||||
cp "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/signcerts/"* "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt"
|
||||
cp "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/keystore/"* "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key"
|
||||
|
||||
# Copy orderer org's CA cert to orderer's /msp/tlscacerts directory (for use in the orderer MSP definition)
|
||||
mkdir -p "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts"
|
||||
cp "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/tlscacerts/"* "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
|
||||
|
||||
mkdir -p "${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts"
|
||||
cp "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/tlscacerts/"* "${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
|
||||
|
||||
infoln "Generating the admin msp"
|
||||
set -x
|
||||
fabric-ca-client enroll -u https://ordererAdmin:ordererAdminpw@localhost:9054 --caname ca-orderer -M "${PWD}/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem"
|
||||
fabric-ca-client enroll -u https://ordererAdmin:ordererAdminpw@localhost:9054 --caname ca-orderer -M "${PWD}/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/ordererOrg/ca-cert.pem"
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
cp "${PWD}/organizations/ordererOrganizations/example.com/msp/config.yaml" "${PWD}/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp/config.yaml"
|
||||
|
|
|
|||
|
|
@ -1,49 +1,52 @@
|
|||
# Description
|
||||
|
||||
This sample provides an environment to display and capture metrics from the test-network in real time. It consists of a docker-compose file that starts a prometheus and grafana server setup configured to collect and display metrics for the test network.
|
||||
This sample provides an environment to display and capture metrics from the test-network in real time. It consists of a docker-compose file that starts a Prometheus and Grafana server setup configured to collect and display metrics for the test network.
|
||||
|
||||
# Requirements
|
||||
## Requirements
|
||||
|
||||
This sample has been tested and is recomended to be used on **linux** in order to fully benefit from its capabilities, however it can be deployed and works on MacOS-intel machine as well (some modification to the cadvisor docker image and related queries are required to show docker containers metrics).
|
||||
This sample has been tested and is recommended to be used on **linux** in order to fully benefit from its capabilities, however it can be deployed and works on MacOS-intel machine as well (some modification to the cadvisor docker image and related queries are required to show docker containers metrics).
|
||||
You will need to have installed **docker-compose with version 1.29 or above** (note that this is higher than the v1.14 requirement requested for the test-network).
|
||||
|
||||
# How to use
|
||||
## How to use
|
||||
|
||||
1. Go to the test-network directory and run bring up the test-network **./network.sh up createChannel**
|
||||
2. Bring up the Prometheus/Grafana network in the test-network/prometheus-grafana directory and run **docker-compose up -d**
|
||||
3. Log in: type “localhost:3000” on your web browser -> username=“admin”, password=“admin” -> set a new password
|
||||
4. Browse dashboard and analyse results
|
||||
4. Browse dashboard and analyse results
|
||||
- The default dashboard "HLF Performances Review" can be found and displayed by hovering over the dashboard menu and clicking on the browse button.
|
||||

|
||||
Once opened the dashboard, to display the collected metrics and data, adjust the timeframe on the top right to focus on the latest timespan when the network was up.
|
||||
5. Deploy a chaincode (i.e. "./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"), start using the test-network and use the grafana dashboard to analyse and assess your network performances.
|
||||
Extras: add new queries, modify dashboard & add relevant changes to main repo --> extract json and add it to "grafana/dashboards/hlf-performances.json".
|
||||
5. Deploy a chaincode (i.e. "./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"), start using the test-network and use the Grafana dashboard to analyse and assess your network performances.
|
||||
Extras: add new queries, modify dashboard & add relevant changes to main repo --> extract json and add it to "Grafana/dashboards/hlf-performances.json".
|
||||
Metrics can also be displayed directly from Prometheus by going to "localhost:9090".
|
||||
|
||||
# Docker Compose
|
||||
## Docker Compose
|
||||
|
||||
Brings up
|
||||
- a prometheus sever (port 9090) -> pulls metrics from peers, orderer, system(node exporter) and containers(cadvisor)
|
||||
- grafana sever (port 3000) -> collects and display data from prometheus
|
||||
- node exporter (port 9100) -> exposes systems metrics
|
||||
- cadvisor (port 8080) -> exposes docker containers metrics
|
||||
|
||||
# Prometheus "configuration file"
|
||||
- a Prometheus server (port 9090) -> pulls metrics from peers, orderer, system(node exporter) and containers(cadvisor)
|
||||
- Grafana server (port 3000) -> collects and display data from Prometheus
|
||||
- node exporter (port 9100) -> exposes systems metrics
|
||||
- cadvisor (port 8080) -> exposes docker containers metrics
|
||||
|
||||
**Prometheus.yml**
|
||||
## Prometheus "configuration file"
|
||||
|
||||
### Prometheus.yml
|
||||
|
||||
Fabric metrics targets:
|
||||
- peer0.org1.example.com:9444
|
||||
- peer0.org2.example.com:9445
|
||||
- orderer.example.com:9443
|
||||
|
||||
- `peer0.org1.example.com:9444`
|
||||
- `peer0.org2.example.com:9445`
|
||||
- `orderer.example.com:9443`
|
||||
|
||||
System and docker metrics targets:
|
||||
- cadvisor:8080
|
||||
- node-exporter:9100
|
||||
|
||||
- `cadvisor:8080`
|
||||
- `node-exporter:9100`
|
||||
|
||||
Check the state of the connections with targets on http://localhost:9090/targets.
|
||||
|
||||
# Sources
|
||||
## Sources
|
||||
|
||||
Prometheus docs: https://prometheus.io/docs/introduction/overview/
|
||||
Grafana docs: https://grafana.com/docs/
|
||||
[Prometheus docs](https://prometheus.io/docs/introduction/overview/)
|
||||
[Grafana docs](https://grafana.com/docs/)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ volumes:
|
|||
|
||||
services:
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
image: prom/prometheus:v2.32.1
|
||||
container_name: prometheus
|
||||
volumes:
|
||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
|
|
@ -20,7 +20,7 @@ services:
|
|||
- "9090:9090"
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
image: grafana/grafana:8.3.4
|
||||
container_name: grafana
|
||||
user: "104"
|
||||
depends_on:
|
||||
|
|
@ -48,7 +48,7 @@ services:
|
|||
restart: always
|
||||
|
||||
node-exporter:
|
||||
image: prom/node-exporter
|
||||
image: prom/node-exporter:v1.3.1
|
||||
container_name: node-exporter
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
"fiscalYearStartMonth": 0,
|
||||
"gnetId": 893,
|
||||
"graphTooltip": 1,
|
||||
"iteration": 1642423515757,
|
||||
"iteration": 1643645866197,
|
||||
"links": [],
|
||||
"liveNow": false,
|
||||
"panels": [
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
"alertThreshold": true
|
||||
},
|
||||
"percentage": false,
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
|
|
@ -79,77 +79,7 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(rate(container_cpu_system_seconds_total[1m]))/ count(node_cpu_seconds_total{mode=\"idle\"}) without (cpu,mode)",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "a",
|
||||
"refId": "B",
|
||||
"step": 120
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(rate(container_cpu_system_seconds_total{name=~\".+\"}[1m]))/ count(node_cpu_seconds_total{mode=\"idle\"}) without (cpu,mode)",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "nur container",
|
||||
"refId": "F",
|
||||
"step": 10
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(rate(container_cpu_system_seconds_total{id=\"/\"}[1m]))/ count(node_cpu_seconds_total{mode=\"idle\"}) without (cpu,mode)",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "nur docker host",
|
||||
"metric": "",
|
||||
"refId": "A",
|
||||
"step": 20
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(rate(process_cpu_seconds_total[$interval]))/ count(node_cpu_seconds_total{mode=\"idle\"}) without (cpu,mode) * 100",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "host",
|
||||
"metric": "",
|
||||
"refId": "C",
|
||||
"step": 600
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"expr": "sum(rate(container_cpu_system_seconds_total{name=~\".+\"}[1m])) + sum(rate(container_cpu_system_seconds_total{id=\"/\"}[1m])) + sum(rate(process_cpu_seconds_total[1m]))",
|
||||
"hide": true,
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "",
|
||||
"refId": "D",
|
||||
"step": 120
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(rate(container_cpu_usage_seconds_total{name=~\".+\"}[$interval]))/ count(node_cpu_seconds_total{mode=\"idle\"}) without (cpu,mode) * 100",
|
||||
"expr": "100 - (avg(rate(node_cpu_seconds_total{job=\"node\",mode=\"idle\"}[$__interval])) * 100)",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"legendFormat": "",
|
||||
|
|
@ -158,7 +88,7 @@
|
|||
],
|
||||
"thresholds": [],
|
||||
"timeRegions": [],
|
||||
"title": "CPU Usage",
|
||||
"title": "System CPU Usage",
|
||||
"tooltip": {
|
||||
"msResolution": true,
|
||||
"shared": true,
|
||||
|
|
@ -195,10 +125,6 @@
|
|||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fieldConfig": {
|
||||
|
|
@ -260,7 +186,7 @@
|
|||
"alertThreshold": true
|
||||
},
|
||||
"percentage": false,
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
|
|
@ -270,29 +196,21 @@
|
|||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(container_memory_rss{name=~\".+\"}) by (name)",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
"refId": "A",
|
||||
"step": 240
|
||||
},
|
||||
{
|
||||
"exemplar": true,
|
||||
"expr": "sum(container_memory_usage_bytes{name=~\".+\"} - container_memory_cache{name=~\".+\"})",
|
||||
"expr": "sum(container_memory_usage_bytes{name=~\".+\"}) - sum(container_memory_cache{name=~\".+\"})",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "",
|
||||
"refId": "B",
|
||||
"step": 240
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeRegions": [],
|
||||
"title": "Total Memory Usage per Container",
|
||||
"title": "Total Memory Usage by all containers",
|
||||
"tooltip": {
|
||||
"msResolution": true,
|
||||
"shared": true,
|
||||
|
|
@ -325,10 +243,6 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
|
|
@ -386,11 +300,18 @@
|
|||
"text": {},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "count(rate(container_last_seen{name=~\".+\"}[$interval]))",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "count(container_last_seen{name=~\".+\"})",
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "",
|
||||
"refId": "A",
|
||||
"step": 1800
|
||||
}
|
||||
|
|
@ -399,10 +320,6 @@
|
|||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
|
|
@ -465,11 +382,15 @@
|
|||
"showThresholdMarkers": true,
|
||||
"text": {}
|
||||
},
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "min((node_filesystem_size_bytes{fstype=~\"xfs|tmpfs\"} - node_filesystem_free_bytes{fstype=~\"xfs|tmpfs\"} )/ node_filesystem_size_bytes{fstype=~\"xfs|tmpfs\"})",
|
||||
"expr": "min((node_filesystem_size_bytes - node_filesystem_free_bytes )/ node_filesystem_size_bytes)",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
|
|
@ -482,10 +403,6 @@
|
|||
"type": "gauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
|
|
@ -548,11 +465,15 @@
|
|||
"showThresholdMarkers": true,
|
||||
"text": {}
|
||||
},
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "((node_memory_MemTotal_bytes{} - node_memory_MemAvailable_bytes{}) / node_memory_MemTotal_bytes{}) * 100",
|
||||
"expr": "((node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes) * 100",
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "",
|
||||
|
|
@ -642,7 +563,7 @@
|
|||
"alertThreshold": true
|
||||
},
|
||||
"percentage": false,
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
|
|
@ -657,14 +578,11 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(rate(container_cpu_usage_seconds_total{name=~\".+\"}[$interval])) by (name)/ count(node_cpu_seconds_total{mode=\"idle\"}) without (cpu,mode) * 100",
|
||||
"expr": "avg by (name)(rate(container_cpu_usage_seconds_total{name!~\"cadvisor|node-exporter|grafana|prometheus||\"}[$__interval])) * 100",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
"metric": "",
|
||||
"refId": "F",
|
||||
"step": 240
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
|
|
@ -702,98 +620,87 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fieldConfig": {
|
||||
"defaults": {},
|
||||
"overrides": [
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byRegexp",
|
||||
"options": "dev-peer0.org1.example.com-fixed-asset-.*"
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 30,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"properties": [
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 2,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "normal"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"id": "displayName",
|
||||
"value": "dev-peer0.org1.example.com-fixed-asset"
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byRegexp",
|
||||
"options": "dev-peer0.org2.example.com-fixed-asset-.*"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "displayName",
|
||||
"value": "dev-peer0.org2.example.com-fixed-asset"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"unit": "decbytes"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 3,
|
||||
"fillGradient": 0,
|
||||
"grid": {},
|
||||
"gridPos": {
|
||||
"h": 10,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 7
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 10,
|
||||
"legend": {
|
||||
"alignAsTable": true,
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"rightSide": true,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"links": [],
|
||||
"nullPointMode": "null as zero",
|
||||
"options": {
|
||||
"alertThreshold": true
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "table",
|
||||
"placement": "right"
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single"
|
||||
}
|
||||
},
|
||||
"percentage": false,
|
||||
"pluginVersion": "8.3.1",
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": true,
|
||||
"steppedLine": false,
|
||||
"pluginVersion": "8.3.4",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(container_memory_rss{name=~\".+\"}) by (name)",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
"refId": "A",
|
||||
"step": 240
|
||||
},
|
||||
{
|
||||
"exemplar": true,
|
||||
"expr": "sum(container_memory_usage_bytes{name=~\".+\"} - container_memory_cache{name=~\".+\"}) by (name)",
|
||||
"expr": "container_memory_usage_bytes{name!~\"cadvisor|node-exporter|grafana|prometheus||\"} - container_memory_cache{name!~\"cadvisor|node-exporter|grafana|prometheus||\"}",
|
||||
"format": "time_series",
|
||||
"hide": false,
|
||||
"instant": false,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
|
|
@ -801,39 +708,8 @@
|
|||
"step": 240
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeRegions": [],
|
||||
"title": "Total Memory Usage per Container",
|
||||
"tooltip": {
|
||||
"msResolution": true,
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"mode": "time",
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"$$hashKey": "object:1101",
|
||||
"format": "decbytes",
|
||||
"label": "",
|
||||
"logBase": 1,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"$$hashKey": "object:1102",
|
||||
"format": "short",
|
||||
"logBase": 1,
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false
|
||||
}
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"fieldConfig": {
|
||||
|
|
@ -886,26 +762,13 @@
|
|||
},
|
||||
"showHeader": true
|
||||
},
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum(container_spec_memory_limit_bytes{name=~\".+\"} - container_memory_usage_bytes{name=~\".+\"}) by (name) ",
|
||||
"hide": true,
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
"metric": "",
|
||||
"refId": "A",
|
||||
"step": 240
|
||||
},
|
||||
{
|
||||
"expr": "sum(container_spec_memory_limit_bytes{name=~\".+\"}) by (name) ",
|
||||
"hide": true,
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
"refId": "B",
|
||||
"step": 240
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "container_memory_usage_bytes{name!~\"prometheus|cadvisor|grafana|node-exporter\", name=~\".+\"} - container_memory_cache{name!~\"prometheus|cadvisor|grafana|node-exporter\", name=~\".+\"}",
|
||||
"hide": false,
|
||||
|
|
@ -937,35 +800,6 @@
|
|||
"dashes": false,
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fieldConfig": {
|
||||
"defaults": {},
|
||||
"overrides": [
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byRegexp",
|
||||
"options": "dev-peer0.org1.example.com-fixed-asset-.*"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "displayName",
|
||||
"value": "dev-peer0.org1.example.com-fixed-asset"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byRegexp",
|
||||
"options": "dev-peer0.org2.example.com-fixed-asset-.*"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "displayName",
|
||||
"value": "dev-peer0.org2.example.com-fixed-asset"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"fill": 0,
|
||||
"fillGradient": 0,
|
||||
"grid": {},
|
||||
|
|
@ -996,7 +830,7 @@
|
|||
"alertThreshold": true
|
||||
},
|
||||
"percentage": false,
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
|
|
@ -1011,15 +845,11 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(rate(container_cpu_usage_seconds_total{name!~\"prometheus|cadvisor|grafana|node-exporter|\"}[$interval])) by (name) / count(node_cpu_seconds_total{mode=\"idle\"}) without (cpu,mode) * 100",
|
||||
"expr": "avg by (name)(rate(container_cpu_usage_seconds_total{name!~\"cadvisor|node-exporter|grafana|prometheus||\"}[$__interval])) * 100",
|
||||
"hide": false,
|
||||
"instant": false,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
"metric": "",
|
||||
"refId": "F",
|
||||
"step": 240
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
|
|
@ -1061,10 +891,6 @@
|
|||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fieldConfig": {
|
||||
|
|
@ -1126,7 +952,7 @@
|
|||
"alertThreshold": true
|
||||
},
|
||||
"percentage": false,
|
||||
"pluginVersion": "8.3.1",
|
||||
"pluginVersion": "8.3.4",
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
|
|
@ -1136,18 +962,12 @@
|
|||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "sum(container_memory_rss{name!~\"prometheus|cadvisor|grafana|node-exporter|\"}) by (name)",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
"legendFormat": "{{name}}",
|
||||
"refId": "A",
|
||||
"step": 240
|
||||
},
|
||||
{
|
||||
"exemplar": true,
|
||||
"expr": "sum(container_memory_usage_bytes{name!~\"prometheus|cadvisor|grafana|node-exporter|\"}-container_memory_cache{name!~\"prometheus|cadvisor|grafana|node-exporter|\"}) by (name)",
|
||||
"expr": "sum by (name) (container_memory_usage_bytes{name!~\"prometheus|cadvisor|grafana|node-exporter|\"}-container_memory_cache{name!~\"prometheus|cadvisor|grafana|node-exporter|\"})",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"intervalFactor": 2,
|
||||
|
|
@ -1253,7 +1073,32 @@
|
|||
},
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
"overrides": [
|
||||
{
|
||||
"__systemRef": "hideSeriesFrom",
|
||||
"matcher": {
|
||||
"id": "byNames",
|
||||
"options": {
|
||||
"mode": "exclude",
|
||||
"names": [
|
||||
" peer0_org2 fixed-asset_1.0:a8a7611b4fb90446320b6bcf140ec68be0e14321f176dde56ac2418c584a3250"
|
||||
],
|
||||
"prefix": "All except:",
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "custom.hideFrom",
|
||||
"value": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 11,
|
||||
|
|
@ -1279,35 +1124,11 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(chaincode_shim_request_duration_sum{chaincode!~\"_.*\"}[$interval])",
|
||||
"expr": "sum by(job, chaincode) (rate(chaincode_shim_request_duration_sum{chaincode!~\"_.*\"}[$__interval]) / rate(chaincode_shim_request_duration_count{chaincode!~\"_.*\"}[$__interval]))",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"legendFormat": " {{job}} {{chaincode}}",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "chaincode_shim_request_duration_count{chaincode!~\"_.*\"}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"refId": "B"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "chaincode_shim_request_duration_bucket{chaincode=~\"_.*\"}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"refId": "C"
|
||||
}
|
||||
],
|
||||
"title": "Request Duration",
|
||||
|
|
@ -1389,10 +1210,10 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(chaincode_shim_requests_received{chaincode!~\"_.*\"}[$interval])",
|
||||
"expr": "sum without(channel,type)(rate(chaincode_shim_requests_received{chaincode!~\"_.*\"}[$__interval]))",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"legendFormat": "{{job}} {{chaincode}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
|
|
@ -1449,7 +1270,32 @@
|
|||
},
|
||||
"unit": "none"
|
||||
},
|
||||
"overrides": []
|
||||
"overrides": [
|
||||
{
|
||||
"__systemRef": "hideSeriesFrom",
|
||||
"matcher": {
|
||||
"id": "byNames",
|
||||
"options": {
|
||||
"mode": "exclude",
|
||||
"names": [
|
||||
"peer0_org2 simple_1.0:fa575b6f4cc225b509c579775fdf3f3d96f6420477570cde0b1a27036f7357dd"
|
||||
],
|
||||
"prefix": "All except:",
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "custom.hideFrom",
|
||||
"value": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 11,
|
||||
|
|
@ -1475,10 +1321,10 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(chaincode_shim_requests_completed{chaincode!~\"_.*\"}[$interval])",
|
||||
"expr": "sum without(channel, type, success) (rate(chaincode_shim_requests_completed{chaincode!~\"_.*\"}[$__interval]))",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"legendFormat": "{{job}} {{chaincode}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
|
|
@ -1599,38 +1445,14 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(endorser_proposal_duration_sum{chaincode=~\"fixed-asset.*\"}[$interval]) / on (instance) rate(endorser_proposals_received{}[$interval])",
|
||||
"expr": "avg without(channel, chaincode) (rate(endorser_proposal_duration_sum{chaincode!~\"cscc|qscc|_lifecycle\",success=\"true\"}[$__interval]) / rate(endorser_proposal_duration_count{chaincode!~\"cscc|qscc|_lifecycle\",success=\"true\"}[$__interval]))",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "endorser_proposal_request_duration_count{chaincode=~\"fixed-asset.*\"}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"refId": "B"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "endorser_proposal_request_duration_bucket{chaincode=~\"fixed-asset.*\"}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"refId": "C"
|
||||
}
|
||||
],
|
||||
"title": "Proposal Duration",
|
||||
"title": "Successful Proposal Duration",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
|
|
@ -1729,11 +1551,15 @@
|
|||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(endorser_proposals_received{}[$interval])",
|
||||
"expr": "rate(endorser_proposals_received[$__interval])",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{chaincode}} {{instance}}",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
|
|
@ -1811,8 +1637,12 @@
|
|||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(endorser_successful_proposals{}[$interval])",
|
||||
"expr": "rate(endorser_successful_proposals[$__interval])",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{job}}",
|
||||
|
|
@ -1906,28 +1736,16 @@
|
|||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(ledger_block_processing_time_sum{}[$interval])",
|
||||
"expr": "avg without(channel) (rate(ledger_block_processing_time_sum{}[$__interval]) / rate(ledger_block_processing_time_count[$__interval]))",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"exemplar": true,
|
||||
"expr": "ledger_block_processing_time_count{}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "B"
|
||||
},
|
||||
{
|
||||
"exemplar": true,
|
||||
"expr": "ledger_block_processing_time_bucket{}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "C"
|
||||
}
|
||||
],
|
||||
"title": "Block Processing Time",
|
||||
|
|
@ -2009,7 +1827,7 @@
|
|||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(ledger_blockstorage_commit_time_sum{}[$interval])",
|
||||
"expr": "avg without(channel) (rate(ledger_blockstorage_commit_time_sum{}[$__interval]) / rate(ledger_blockstorage_commit_time_count[$__interval]))",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{job}}",
|
||||
|
|
@ -2093,7 +1911,32 @@
|
|||
},
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
"overrides": [
|
||||
{
|
||||
"__systemRef": "hideSeriesFrom",
|
||||
"matcher": {
|
||||
"id": "byNames",
|
||||
"options": {
|
||||
"mode": "exclude",
|
||||
"names": [
|
||||
"peer0_org1"
|
||||
],
|
||||
"prefix": "All except:",
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "custom.hideFrom",
|
||||
"value": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 11,
|
||||
|
|
@ -2114,28 +1957,16 @@
|
|||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "PBFA97CFB590B2093"
|
||||
},
|
||||
"exemplar": true,
|
||||
"expr": "rate(ledger_statedb_commit_time_sum{}[$interval])",
|
||||
"expr": "avg without(channel) (rate(ledger_statedb_commit_time_sum{}[$__interval]) / rate(ledger_statedb_commit_time_count[$__interval]))",
|
||||
"hide": false,
|
||||
"interval": "0.01m",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"exemplar": true,
|
||||
"expr": "ledger_statedb_commit_time_count{}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "B"
|
||||
},
|
||||
{
|
||||
"exemplar": true,
|
||||
"expr": "ledger_statedb_commit_time_bucket{}",
|
||||
"hide": true,
|
||||
"interval": "",
|
||||
"legendFormat": "{{job}}",
|
||||
"refId": "C"
|
||||
}
|
||||
],
|
||||
"title": "StateDB Commit Time",
|
||||
|
|
@ -2190,7 +2021,32 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
"overrides": [
|
||||
{
|
||||
"__systemRef": "hideSeriesFrom",
|
||||
"matcher": {
|
||||
"id": "byNames",
|
||||
"options": {
|
||||
"mode": "exclude",
|
||||
"names": [
|
||||
"peer0_org2"
|
||||
],
|
||||
"prefix": "All except:",
|
||||
"readOnly": true
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "custom.hideFrom",
|
||||
"value": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 11,
|
||||
|
|
@ -2227,7 +2083,7 @@
|
|||
}
|
||||
],
|
||||
"refresh": "5s",
|
||||
"schemaVersion": 33,
|
||||
"schemaVersion": 34,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
|
|
@ -2235,9 +2091,13 @@
|
|||
{
|
||||
"allValue": ".+",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
"selected": true,
|
||||
"text": [
|
||||
"All"
|
||||
],
|
||||
"value": [
|
||||
"$__all"
|
||||
]
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
|
|
@ -2358,16 +2218,20 @@
|
|||
}
|
||||
],
|
||||
"query": "30s,1m,2m,3m,5m,7m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
|
||||
"queryValue": "",
|
||||
"refresh": 2,
|
||||
"skipUrlSync": false,
|
||||
"type": "interval"
|
||||
},
|
||||
{
|
||||
"current": {
|
||||
"isNone": true,
|
||||
"selected": false,
|
||||
"text": "None",
|
||||
"value": ""
|
||||
"selected": true,
|
||||
"text": [
|
||||
"None"
|
||||
],
|
||||
"value": [
|
||||
""
|
||||
]
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
|
|
@ -2394,7 +2258,7 @@
|
|||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-15m",
|
||||
"from": "now-30m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
|
|
@ -2425,6 +2289,6 @@
|
|||
"timezone": "browser",
|
||||
"title": "HLF Performances Review",
|
||||
"uid": "UeOYeJpWy",
|
||||
"version": 2,
|
||||
"version": 1,
|
||||
"weekStart": ""
|
||||
}
|
||||
|
|
@ -11,10 +11,10 @@
|
|||
. scripts/utils.sh
|
||||
|
||||
export CORE_PEER_TLS_ENABLED=true
|
||||
export ORDERER_CA=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
|
||||
export PEER0_ORG1_CA=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||
export PEER0_ORG2_CA=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
||||
export PEER0_ORG3_CA=${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt
|
||||
export ORDERER_CA=${PWD}/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
|
||||
export PEER0_ORG1_CA=${PWD}/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
|
||||
export PEER0_ORG2_CA=${PWD}/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem
|
||||
export PEER0_ORG3_CA=${PWD}/organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem
|
||||
export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
|
||||
export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ setGlobals() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Set environment variables for use in the CLI container
|
||||
# Set environment variables for use in the CLI container
|
||||
setGlobalsCLI() {
|
||||
setGlobals $1
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ set -o pipefail
|
|||
# Where am I?
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
||||
|
||||
ORDERER_CA=${DIR}/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
|
||||
PEER0_ORG1_CA=${DIR}/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||
PEER0_ORG2_CA=${DIR}/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
||||
PEER0_ORG3_CA=${DIR}/test-network/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt
|
||||
ORDERER_CA=${DIR}/test-network/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
|
||||
PEER0_ORG1_CA=${DIR}/test-network/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
|
||||
PEER0_ORG2_CA=${DIR}/test-network/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem
|
||||
PEER0_ORG3_CA=${DIR}/test-network/organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem
|
||||
|
||||
|
||||
if [[ ${ORG,,} == "org1" || ${ORG,,} == "digibank" ]]; then
|
||||
|
|
@ -26,14 +26,14 @@ if [[ ${ORG,,} == "org1" || ${ORG,,} == "digibank" ]]; then
|
|||
CORE_PEER_LOCALMSPID=Org1MSP
|
||||
CORE_PEER_MSPCONFIGPATH=${DIR}/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||
CORE_PEER_ADDRESS=localhost:7051
|
||||
CORE_PEER_TLS_ROOTCERT_FILE=${DIR}/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||
CORE_PEER_TLS_ROOTCERT_FILE=${DIR}/test-network/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
|
||||
|
||||
elif [[ ${ORG,,} == "org2" || ${ORG,,} == "magnetocorp" ]]; then
|
||||
|
||||
CORE_PEER_LOCALMSPID=Org2MSP
|
||||
CORE_PEER_MSPCONFIGPATH=${DIR}/test-network/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
|
||||
CORE_PEER_ADDRESS=localhost:9051
|
||||
CORE_PEER_TLS_ROOTCERT_FILE=${DIR}/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
||||
CORE_PEER_TLS_ROOTCERT_FILE=${DIR}/test-network/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org1.example.com-cert.pem
|
||||
|
||||
else
|
||||
echo "Unknown \"$ORG\", please choose Org1/Digibank or Org2/Magnetocorp"
|
||||
|
|
@ -56,4 +56,4 @@ echo "CORE_PEER_MSPCONFIGPATH=${CORE_PEER_MSPCONFIGPATH}"
|
|||
echo "CORE_PEER_ADDRESS=${CORE_PEER_ADDRESS}"
|
||||
echo "CORE_PEER_TLS_ROOTCERT_FILE=${CORE_PEER_TLS_ROOTCERT_FILE}"
|
||||
|
||||
echo "CORE_PEER_LOCALMSPID=${CORE_PEER_LOCALMSPID}"
|
||||
echo "CORE_PEER_LOCALMSPID=${CORE_PEER_LOCALMSPID}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue