mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
Updated logging
- updated the logging for the application command; wasn't very good - added some information to the help option. the current settings useful if you're not sure what you've set Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
This commit is contained in:
parent
cc8123bdc5
commit
337584045d
3 changed files with 61 additions and 9 deletions
|
|
@ -42,6 +42,33 @@ TLSADMIN_AUTH=tlsadmin:tlsadminpw
|
|||
RCAADMIN_AUTH=rcaadmin:rcaadminpw
|
||||
|
||||
function print_help() {
|
||||
log
|
||||
log "--- Fabric Information"
|
||||
log "Fabric Version is \t ${FABRIC_VERSION}"
|
||||
log "Fabric CA Version is \t ${FABRIC_CA_VERSION}"
|
||||
log "Container Registry is \t ${FABRIC_CONTAINER_REGISTRY}"
|
||||
log "Network name is \t ${NETWORK_NAME}"
|
||||
log "Channel name is \t ${CHANNEL_NAME}"
|
||||
log
|
||||
log "--- Targetted Chaincode Information"
|
||||
log "Chaincode name is \t ${CHAINCODE_NAME}"
|
||||
log "Chaincode image is \t ${CHAINCODE_IMAGE}"
|
||||
log "Chaincode lavel is \t ${CHAINCODE_LABEL}"
|
||||
log
|
||||
log "--- Cluster Information"
|
||||
log "Cluster name is \t ${CLUSTER_NAME}"
|
||||
log "Cluster namespace is \t ${NS}"
|
||||
log "Local Registry is \t ${LOCAL_REGISTRY_NAME}"
|
||||
log "Local Registry port is \t ${LOCAL_REGISTRY_PORT}"
|
||||
log "nginx http port is \t ${NGINX_HTTP_PORT}"
|
||||
log "nginx https port is \t ${NGINX_HTTP2_PORT}"
|
||||
log
|
||||
log "--- Script Information"
|
||||
log "Log file written to \t ${LOG_FILE}"
|
||||
log "Debug log written to \t ${DEBUG_FILE}"
|
||||
log
|
||||
|
||||
|
||||
echo todo: help output, parse mode, flags, env, etc.
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +86,9 @@ function print_help() {
|
|||
# check for kind, kubectl, etc.
|
||||
check_prereqs
|
||||
|
||||
# Initialize the logging system - control output to 'network.log' and everything else to 'network-debug.log'
|
||||
logging_init
|
||||
|
||||
## Parse mode
|
||||
if [[ $# -lt 1 ]] ; then
|
||||
print_help
|
||||
|
|
@ -68,8 +98,7 @@ else
|
|||
shift
|
||||
fi
|
||||
|
||||
# Initialize the logging system - control output to 'network.log' and everything else to 'network-debug.log'
|
||||
logging_init
|
||||
|
||||
|
||||
if [ "${MODE}" == "kind" ]; then
|
||||
log "Initializing KIND cluster \"${CLUSTER_NAME}\":"
|
||||
|
|
@ -148,7 +177,7 @@ elif [ "${MODE}" == "rest-easy" ]; then
|
|||
elif [ "${MODE}" == "application" ]; then
|
||||
log "Getting application connection information:"
|
||||
application_connection
|
||||
log "🏁 - Output in...xxx"
|
||||
log "🏁 - Application connection information ready."
|
||||
|
||||
else
|
||||
print_help
|
||||
|
|
|
|||
|
|
@ -57,7 +57,11 @@ function construct_application_configmap() {
|
|||
ca_pem=build/msp/organizations/peerOrganizations/org2.example.com/msp/cacerts/org2-ecert-ca.pem
|
||||
|
||||
echo "$(json_ccp 2 $peer_pem $ca_pem)" > build/application/gateways/org2_ccp.json
|
||||
|
||||
|
||||
pop_fn
|
||||
|
||||
push_fn "Getting Application Identities"
|
||||
|
||||
local cert=build/msp/organizations/peerOrganizations/org1.example.com/users/Admin\@org1.example.com/msp/signcerts/cert.pem
|
||||
local pk=build/msp/organizations/peerOrganizations/org1.example.com/users/Admin\@org1.example.com/msp/keystore/server.key
|
||||
|
||||
|
|
@ -68,14 +72,24 @@ function construct_application_configmap() {
|
|||
|
||||
echo "$(app_id Org2MSP $cert $pk)" > build/application/wallet/appuser_org2.id
|
||||
|
||||
kubectl -n $NS delete configmap app-fabric-tls-v1-map || log "app-fabric-tls-v1-map not present"
|
||||
pop_fn
|
||||
|
||||
push_fn "Creating ConfigMap \"app-fabric-tls-v1-map\" with TLS certificates for the application"
|
||||
kubectl -n $NS delete configmap app-fabric-tls-v1-map || true
|
||||
kubectl -n $NS create configmap app-fabric-tls-v1-map --from-file=./build/msp/organizations/peerOrganizations/org1.example.com/msp/tlscacerts
|
||||
pop_fn
|
||||
|
||||
kubectl -n $NS delete configmap app-fabric-ids-v1-map || log "app-fabric-id-v1-map not present"
|
||||
push_fn "Creating ConfigMap \"app-fabric-ids-v1-map\" with identities for the application"
|
||||
kubectl -n $NS delete configmap app-fabric-ids-v1-map || true
|
||||
kubectl -n $NS create configmap app-fabric-ids-v1-map --from-file=./build/application/wallet
|
||||
pop_fn
|
||||
|
||||
kubectl -n $NS delete configmap app-fabric-ccp-v1-map || log "app-fabric-id-v1-map not present"
|
||||
push_fn "Creating ConfigMap \"app-fabric-ccp-v1-map\" with ConnectionProfile for the application"
|
||||
kubectl -n $NS delete configmap app-fabric-ccp-v1-map || true
|
||||
kubectl -n $NS create configmap app-fabric-ccp-v1-map --from-file=./build/application/gateways
|
||||
pop_fn
|
||||
|
||||
push_fn "Creating ConfigMap \"app-fabric-org1-v1-map\" with Organization 1 information for the application"
|
||||
|
||||
cat <<EOF > build/app-fabric-org1-v1-map.yaml
|
||||
apiVersion: v1
|
||||
|
|
@ -104,11 +118,16 @@ function application_connection() {
|
|||
|
||||
construct_application_configmap
|
||||
|
||||
log ""
|
||||
log
|
||||
log "For k8s applications:"
|
||||
log "Config Maps created for the application"
|
||||
log "To deploy your application updated the image name and issue these commands"
|
||||
log ""
|
||||
log "kubectl -n $NS apply -f kube/application-deployment.yaml"
|
||||
log "kubectl -n $NS rollout status deploy/application-deployment"
|
||||
|
||||
log
|
||||
log "For non-k8s applications:"
|
||||
log "ConnectionPrfiles are in ${PWD}/build/application/gateways"
|
||||
log "Identities are in ${PWD}/build/application/wallets"
|
||||
log
|
||||
}
|
||||
|
|
@ -17,6 +17,10 @@ function logging_init() {
|
|||
|
||||
# Send stdout and stderr from child programs to the debug log file
|
||||
exec 1>>${DEBUG_FILE} 2>>${DEBUG_FILE}
|
||||
|
||||
# There can be a race between the tail starting and the next log statement
|
||||
# write nothing to the file to kill a (very small) bit of time
|
||||
echo -ne >>${LOG_FILE}
|
||||
}
|
||||
|
||||
function exit_fn() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue