diff --git a/README.md b/README.md index 4bf96a3b7..f07b58a48 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,13 @@ Hyperledger Cello is a blockchain provision and operation system, which helps manage blockchain networks in an efficient way. 1. [Introduction](#introduction) -2. [Main Features](#main-features) -3. [Quick Start](#quick-start) +2. [Quick Start](#quick-start) +3. [Main Features](#main-features) 4. [Documentation](#documentation-getting-started-and-develop-guideline) 5. [Why named cello?](#why-named-cello) 6. [Notice](#incubation-notice) - +7. [Inclusive Language Statement](#inclusive-language-statement) + ## Introduction Using Cello, everyone can easily: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e8d3c4b40..cb5afb707 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,10 +38,6 @@ stages: dockerfile: "build_image/docker/common/nginx/Dockerfile.in" - imagename: "hyperledger/cello-dashboard" dockerfile: "build_image/docker/common/dashboard/Dockerfile.in" - # - name: ansibleagent - # images: - # - imagename: "hyperledger/cello-ansible-agent" - # dockerfile: "build_image/docker/agent/ansible/Dockerfile.in" # - name: fabricoperator # images: # - imagename: "hyperledger/cello-k8s-operator-agent" diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml index c570497fc..39be2edc1 100644 --- a/ci/azure-pipelines.yml +++ b/ci/azure-pipelines.yml @@ -36,10 +36,6 @@ stages: dockerfile: "build_image/docker/common/nginx/Dockerfile.in" - imagename: "hyperledger/cello-dashboard" dockerfile: "build_image/docker/common/dashboard/Dockerfile.in" - - name: ansibleagent - images: - - imagename: "hyperledger/cello-ansible-agent" - dockerfile: "build_image/docker/agent/ansible/Dockerfile.in" # - name: fabricoperator # images: # - imagename: "hyperledger/cello-k8s-operator-agent" diff --git a/src/api-engine/api/lib/peer/channel.py b/src/api-engine/api/lib/peer/channel.py index 1673259fd..641b2a9f9 100644 --- a/src/api-engine/api/lib/peer/channel.py +++ b/src/api-engine/api/lib/peer/channel.py @@ -18,20 +18,20 @@ def __init__(self, version=FABRIC_VERSION, peer=FABRIC_TOOL, **kwargs): self.osnadmin = peer + "/osnadmin" super(Channel, self).__init__(version, **kwargs) - def create(self, channel, orderer_url, block_path, time_out="90s"): + def create(self, channel, orderer_admin_url, block_path, time_out="90s"): try: res = 0x100 command = "" if os.getenv("CORE_PEER_TLS_ENABLED") == "false" or os.getenv("CORE_PEER_TLS_ENABLED") is None: - command = "{} channel join --channelID {} --config-block {} -o {}".format(self.osnadmin, channel, block_path, orderer_url) + command = "{} channel join --channelID {} --config-block {} -o {}".format(self.osnadmin, channel, block_path, orderer_admin_url) else: ORDERER_CA = os.getenv("ORDERER_CA") ORDERER_ADMIN_TLS_SIGN_CERT = os.getenv("ORDERER_ADMIN_TLS_SIGN_CERT") ORDERER_ADMIN_TLS_PRIVATE_KEY = os.getenv("ORDERER_ADMIN_TLS_PRIVATE_KEY") - command = "{} channel join --channelID {} --config-block {} -o {} --ca-file {} --client-cert {} --client-key {}".format(self.osnadmin, channel, block_path, orderer_url, ORDERER_CA, ORDERER_ADMIN_TLS_SIGN_CERT, ORDERER_ADMIN_TLS_PRIVATE_KEY) + command = "{} channel join --channelID {} --config-block {} -o {} --ca-file {} --client-cert {} --client-key {}".format(self.osnadmin, channel, block_path, orderer_admin_url, ORDERER_CA, ORDERER_ADMIN_TLS_SIGN_CERT, ORDERER_ADMIN_TLS_PRIVATE_KEY) - LOG.info(f"Running command: {command}") + LOG.info(f"{command}") res = os.system(command) # The return value of os.system is not the result of executing the program. It is a 16 bit number, @@ -78,7 +78,7 @@ def update(self, channel, channel_tx, orderer_url): res = res >> 8 return res - def fetch(self, option, channel): + def fetch(self, block_path, channel, orderer_general_url): """ Fetch a specified block, writing it to a file e.g. .block. params: @@ -86,14 +86,19 @@ def fetch(self, option, channel): channel: channel id. """ try: - res = subprocess.call(args=[ - self.peer, - "channel", - "fetch", - "{}".format(option), - "-c", - channel - ]) + res = 0x100 + command = "" + if os.getenv("CORE_PEER_TLS_ENABLED") == "false" or os.getenv("CORE_PEER_TLS_ENABLED") is None: + command = "{} channel fetch config {} -o {} -c {}".format(self.peer, block_path, orderer_general_url, channel) + else: + ORDERER_CA = os.getenv("ORDERER_CA") + orderer_address = orderer_general_url.split(":")[0] + command = "{} channel fetch config {} -o {} --ordererTLSHostnameOverride {} -c {} --tls --cafile {}".format(self.peer, block_path, orderer_general_url, orderer_address, channel, ORDERER_CA) + + LOG.info(f"{command}") + res = os.system(command) + + res = res >> 8 except Exception as e: err_msg = "fetch a specified block failed {}!".format(e) raise Exception(err_msg) @@ -123,7 +128,7 @@ def join(self, block_path): try: command = "{} channel join -b {} ".format(self.peer, block_path) - LOG.info(f"Running command: {command}") + LOG.info(f"{command}") res = os.system(command) diff --git a/src/api-engine/api/routes/channel/views.py b/src/api-engine/api/routes/channel/views.py index f96e197b9..633afe005 100644 --- a/src/api-engine/api/routes/channel/views.py +++ b/src/api-engine/api/routes/channel/views.py @@ -150,21 +150,32 @@ def create(self, request): ConfigTX(org.network.name).create(name, org.network.consensus, _orderers, _peers) ConfigTxGen(org.network.name).genesis(profile=name, channelid=name, outputblock="{}.block".format(name)) - block_path = "{}/{}/{}.block".format( - CELLO_HOME, org.network.name, name) + # osnadmin channel join ordering_node = Node.objects.get(id=orderers[0]) envs = init_env_vars(ordering_node, org) peer_channel_cli = PeerChannel(**envs) peer_channel_cli.create( channel=name, - orderer_url="{}.{}:{}".format( + orderer_admin_url="{}.{}:{}".format( ordering_node.name, org.name.split(".", 1)[1], str(7053)), - block_path=block_path + block_path="{}/{}/{}.block".format( + CELLO_HOME, org.network.name, name) ) + + # peer channel join for i in range(len(peers)): peer_node = Node.objects.get(id=peers[i]) envs = init_env_vars(peer_node, org) - join_peers(envs, block_path) + join_peers(envs, "{}/{}/{}.block".format( + CELLO_HOME, org.network.name, name)) + + # peer channel fetch + peer_node = Node.objects.get(id=peers[0]) + envs = init_env_vars(peer_node, org) + peer_channel_cli = PeerChannel(**envs) + peer_channel_cli.fetch(block_path="{}/{}/config_block.pb".format(CELLO_HOME, org.network.name), + channel=name, orderer_general_url="{}.{}:{}".format( + ordering_node.name, org.name.split(".", 1)[1], str(7050))) channel = Channel( name=name, @@ -395,7 +406,8 @@ def init_env_vars(node, org): if(node.type == "orderer"): envs = { - "ORDERER_CA": "{}/msp/tlscacerts/tlsca.{}-cert.pem".format(dir_certificate, org_domain), + "CORE_PEER_TLS_ENABLED": "true", + "ORDERER_CA": "{}/orderers/{}/msp/tlscacerts/tlsca.{}-cert.pem".format(dir_certificate, node.name + "." + org_domain, org_domain), "ORDERER_ADMIN_TLS_SIGN_CERT": "{}/orderers/{}/tls/server.crt".format(dir_certificate, node.name + "." + org_domain), "ORDERER_ADMIN_TLS_PRIVATE_KEY": "{}/orderers/{}/tls/server.key".format(dir_certificate, node.name + "." + org_domain) }