Skip to content

Commit

Permalink
delete preoperation of genesis block before order service start
Browse files Browse the repository at this point in the history
Signed-off-by: YoungHypo <[email protected]>
  • Loading branch information
YoungHypo committed Sep 21, 2024
1 parent d68c9f6 commit d950ac8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
3 changes: 1 addition & 2 deletions build_image/docker/cello-hlf/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# It will read the following env variables
# HLF_NODE_MSP: store a base64 encoded zipped "msp" path
# HLF_NODE_TLS: store a base64 encoded zipped "tls" path
# HLF_NODE_BOOTSTRAP_BLOCK: store a base64 encoded zipped bootstrap block
# HLF_NODE_BOOTSTRAP_BLOCK: store a base64 encoded zipped bootstrap block, which is no longer needed for HLF 2.5.9 or higher versions
# HLF_NODE_PEER_CONFIG: store a base64 encoded zipped peer configuration file (core.yaml)
# HLF_NODE_ORDERER_CONFIG: store a base64 encoded zipped orderer configuration file (orderer.yaml)

Expand Down Expand Up @@ -47,7 +47,6 @@ fi
# Read each file from env and store under the ${cfg_path}
for name in HLF_NODE_MSP \
HLF_NODE_TLS \
HLF_NODE_BOOTSTRAP_BLOCK \
HLF_NODE_PEER_CONFIG \
HLF_NODE_ORDERER_CONFIG
do
Expand Down
13 changes: 9 additions & 4 deletions src/agent/docker-rest-agent/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def create_node():
env = {
'HLF_NODE_MSP': request.form.get('msp'),
'HLF_NODE_TLS':request.form.get('tls'),
'HLF_NODE_BOOTSTRAP_BLOCK':request.form.get('bootstrap_block'),
'HLF_NODE_PEER_CONFIG':request.form.get('peer_config_file'),
'HLF_NODE_ORDERER_CONFIG':request.form.get('orderer_config_file'),
'platform': 'linux/amd64',
Expand Down Expand Up @@ -72,16 +71,22 @@ def create_node():
'FABRIC_LOGGING_SPEC':'DEBUG',
'ORDERER_GENERAL_LISTENADDRESS': '0.0.0.0',
'ORDERER_GENERAL_LISTENPORT': '7050',
'ORDERER_GENERAL_GENESISMETHOD':'file',
'ORDERER_GENERAL_LOCALMSPDIR': '/etc/hyperledger/fabric/msp',
'ORDERER_GENERAL_GENESISFILE': '/etc/hyperledger/fabric/genesis.block',
'ORDERER_GENERAL_TLS_ENABLED': 'true',
'ORDERER_GENERAL_TLS_PRIVATEKEY':'/etc/hyperledger/fabric/tls/server.key',
'ORDERER_GENERAL_TLS_CERTIFICATE':'/etc/hyperledger/fabric/tls/server.crt',
'ORDERER_GENERAL_TLS_ROOTCAS': '[/etc/hyperledger/fabric/tls/ca.crt]',
'ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE': '/etc/hyperledger/fabric/tls/server.crt',
'ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY': '/etc/hyperledger/fabric/tls/server.key',
'ORDERER_GENERAL_CLUSTER_ROOTCAS': '[/etc/hyperledger/fabric/tls/ca.crt]',
'ORDERER_GENERAL_LOCALMSPDIR': '/etc/hyperledger/fabric/msp',
'ORDERER_GENERAL_LOCALMSPID': 'OrdererMSP',

"ORDERER_ADMIN_LISTENADDRESS": "0.0.0.0:7053",
"ORDERER_ADMIN_TLS_ENABLED": "true",
"ORDERER_ADMIN_TLS_CERTIFICATE": "/etc/hyperledger/fabric/tls/server.crt",
"ORDERER_ADMIN_TLS_PRIVATEKEY": "/etc/hyperledger/fabric/tls/server.key",
"ORDERER_ADMIN_TLS_CLIENTROOTCAS": "[/etc/hyperledger/fabric/tls/ca.crt]",
"ORDERER_ADMIN_TLS_CLIENTAUTHREQUIRED": "true"
}
env.update(order_envs)
try:
Expand Down
3 changes: 1 addition & 2 deletions src/api-engine/api/lib/agent/docker/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ def create(self, info):
data = {
'msp': info.get("msp")[2:-1],
'tls': info.get("tls")[2:-1],
'bootstrap_block': info.get("bootstrap_block")[2:-1],
'peer_config_file': info.get("config_file")[2:-1],
'orderer_config_file': info.get("config_file")[2:-1],
'img': 'yeasy/hyperledger-fabric:2.2.0',
'img': 'hyperledger/fabric:2.5.9',
'cmd': 'bash /tmp/init.sh "peer node start"' if info.get("type") == "peer" else 'bash /tmp/init.sh "orderer"',
'name': info.get("name"),
'type': info.get("type"),
Expand Down
1 change: 0 additions & 1 deletion src/api-engine/api/routes/network/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def _agent_params(self, pk):
info["config_file"] = node.config_file
info["type"] = node.type
info["name"] = "{}.{}".format(node.name, org_name)
info["bootstrap_block"] = network.genesisblock
info["urls"] = agent.urls
info["network_type"] = network.type
info["agent_type"] = agent.type
Expand Down
8 changes: 2 additions & 6 deletions src/api-engine/api/routes/node/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,8 @@ def _generate_config(self, type, org, node):
a = NodeConfig(org)
a.peer(node, **args)
else:
args.update({"General_ListenPort": 7050})
args.update(
{"General_LocalMSPID": "{}OrdererMSP".format(org.capitalize())})
args.update({"General_TLS_Enabled": True})
args.update({"General_BootstrapFile": "genesis.block"})
args.update({"General_BootstrapMethod": "none"})
args.update({"ChannelParticipation_Enabled": True})

a = NodeConfig(org)
a.orderer(node, **args)
Expand Down Expand Up @@ -458,7 +455,6 @@ def _agent_params(self, pk):
info["config_file"] = node.config_file
info["type"] = node.type
info["name"] = "{}.{}".format(node.name, org_name)
info["bootstrap_block"] = network.genesisblock
info["urls"] = agent.urls
info["network_type"] = network.type
info["agent_type"] = agent.type
Expand Down
1 change: 0 additions & 1 deletion src/api-engine/api/routes/organization/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def _generate_config(self, type, org, node):
args.update(
{"General_LocalMSPID": "{}OrdererMSP".format(org.capitalize())})
args.update({"General_TLS_Enabled": True})
args.update({"General_BootstrapFile": "genesis.block"})

a = NodeConfig(org)
a.orderer(node, **args)
Expand Down

0 comments on commit d950ac8

Please sign in to comment.