Skip to content

Commit

Permalink
[CE-358] Fix static port mapping of explorer
Browse files Browse the repository at this point in the history
In fabric kafka mode, now we use a static port mapping of the explorer
service, which will result in port conflicts with multiple chains inside
the same host.

This patchset use the EXPLORER_PORT for dynamic mapping.

Change-Id: Ibcb8f29aff8b06d30e7cfa29f8f9004e42731c60
Signed-off-by: Baohua Yang <yangbaohua@gmail.com>
  • Loading branch information
yeasy committed May 10, 2018
1 parent 47f3cc6 commit 31f058e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ services:
- ${COMPOSE_PROJECT_PATH}/explorer-artifacts/config.json:/blockchain-explorer/config.json
- ${COMPOSE_PROJECT_PATH}/crypto-config:/blockchain-explorer/first-network/crypto-config
ports:
#- "${DASHBOARD_PORT}:8080"
- "8150:8080"
- "${EXPLORER_PORT}:8080"
depends_on:
- mysql
- orderer.example.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ services:
- ${COMPOSE_PROJECT_PATH}/explorer-artifacts/config.json:/blockchain-explorer/config.json
- ${COMPOSE_PROJECT_PATH}/crypto-config:/blockchain-explorer/first-network/crypto-config
ports:
- "${DASHBOARD_PORT}:8080"
- "${EXPLORER_PORT}:8080"
depends_on:
- mysql
- orderer.example.com
Expand Down
2 changes: 1 addition & 1 deletion src/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
WORKER_TYPE_VSPHERE, \
CLUSTER_PORT_START, CLUSTER_PORT_STEP, \
NETWORK_SIZE_FABRIC_PRE_V1, NETWORK_SIZE_FABRIC_V1, \
CLUSTER_NETWORK, EXPLORER_PORT,\
CLUSTER_NETWORK, EXPLORER_PORTS,\
CLUSTER_LOG_TYPES, CLUSTER_LOG_LEVEL, \
request_debug, request_get, request_json_body, VIRTUAL_MACHINE, \
VCENTER, VMUUID, VMMEMORY, VMCPU, VMNAME, VMIP, VMNETMASK, VMDNS, \
Expand Down
4 changes: 2 additions & 2 deletions src/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
'orderer': 7050
}

EXPLORER_PORT = {
'dashboard': 7060
EXPLORER_PORTS = {
'explorer': 8080
}

SERVICE_PORTS = dict(list(PEER_SERVICE_PORTS.items()) +
Expand Down
6 changes: 3 additions & 3 deletions src/modules/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
WORKER_TYPES, WORKER_TYPE_DOCKER, WORKER_TYPE_SWARM, WORKER_TYPE_K8S, \
WORKER_TYPE_VSPHERE, VMIP, \
NETWORK_SIZE_FABRIC_PRE_V1, \
PEER_SERVICE_PORTS, EXPLORER_PORT, \
PEER_SERVICE_PORTS, EXPLORER_PORTS, \
ORDERER_SERVICE_PORTS, \
NETWORK_STATUS_CREATING, NETWORK_STATUS_RUNNING, NETWORK_STATUS_DELETING

Expand Down Expand Up @@ -155,7 +155,7 @@ def gen_ports_mapping(self, peer_num, ca_num, start_port, host_id):
peer_num * (len(peer_service_ports.items())) + \
ca_num * len(ca_service_ports.items()) + \
len(ORDERER_SERVICE_PORTS.items()) + \
len(EXPLORER_PORT.items())
len(EXPLORER_PORTS.items())
logger.debug("request port number {}".format(request_port_num))

if start_port <= 0: # need to dynamic find available ports
Expand Down Expand Up @@ -197,7 +197,7 @@ def gen_ports_mapping(self, peer_num, ca_num, start_port, host_id):
orderer_ports[k] = ports[pos]
logger.debug("pos={}".format(pos))
pos += 1
for k, v in EXPLORER_PORT.items(): # exporer ports
for k, v in EXPLORER_PORTS.items(): # explorer ports
explorer_ports[k] = ports[pos]
pos += 1

Expand Down

0 comments on commit 31f058e

Please sign in to comment.