Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyu.li1 committed Oct 15, 2024
2 parents b28927e + b7ef2df commit 5f5ebe8
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 66 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ docker-rest-agent:
docker build -t hyperledger/cello-agent-docker:latest -f build_image/docker/agent/docker-rest-agent/Dockerfile.in ./ --build-arg pip=$(PIP) --platform linux/$(ARCH)

fabric:
docker build -t hyperledger/fabric:2.5.9 -f build_image/docker/cello-hlf/Dockerfile build_image/docker/cello-hlf/
docker build -t hyperledger/fabric:2.5.10 -f build_image/docker/cello-hlf/Dockerfile build_image/docker/cello-hlf/

dashboard:
docker build -t hyperledger/cello-dashboard:latest -f build_image/docker/common/dashboard/Dockerfile.in ./
Expand Down
2 changes: 1 addition & 1 deletion bootup/docker-compose-files/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:

# pg database
cello-postgres:
image: postgres:11.1
image: postgres:12.0
container_name: cello-postgres
restart: unless-stopped
environment:
Expand Down
2 changes: 1 addition & 1 deletion bootup/docker-compose-files/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:

# pg database
cello-postgres:
image: postgres:11.1
image: postgres:12.0
container_name: cello-postgres
restart: unless-stopped
environment:
Expand Down
2 changes: 1 addition & 1 deletion bootup/docker-compose-files/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- /opt/cello/api-engine/media:/var/www/media

postgres-server:
image: postgres:11.1
image: postgres:12.0
hostname: cello-postgres-server
container_name: cello-postgres-server
restart: always
Expand Down
12 changes: 6 additions & 6 deletions build_image/docker/cello-hlf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@
# Workdir is set to $GOPATH/src/github.com/hyperledger/fabric
# Data is stored under /var/hyperledger/production

FROM golang:1.22
LABEL maintainer "Baohua Yang <yeasy.github.com>"
FROM golang:1.23.1
LABEL maintainer="Baohua Yang <yeasy.github.com>"

# Orderer, peer, ca, operation api
EXPOSE 7050 7051 7054 8443 9443

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Only useful for this Dockerfile
ENV FABRIC_ROOT=$GOPATH/src/github.com/hyperledger/fabric \
FABRIC_CA_ROOT=$GOPATH/src/github.com/hyperledger/fabric-ca

# BASE_VERSION is used in metadata.Version as major version
ENV BASE_VERSION=2.5.9
ENV BASE_VERSION=2.5.10

# PROJECT_VERSION is required in core.yaml for fabric-baseos and fabric-ccenv
ENV PROJECT_VERSION=2.5.9
ENV HLF_CA_VERSION=1.5.12
ENV PROJECT_VERSION=2.5.10
ENV HLF_CA_VERSION=1.5.13

# generic environment (core.yaml) for builder and runtime: e.g., builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION), golang, java, node
ENV DOCKER_NS=hyperledger
Expand Down
2 changes: 1 addition & 1 deletion 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, which is no longer needed for HLF 2.5.9 or higher versions
# HLF_NODE_BOOTSTRAP_BLOCK: store a base64 encoded zipped bootstrap block, which is no longer needed for HLF 2.5.10 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
6 changes: 3 additions & 3 deletions build_image/docker/common/api-engine/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get update \
WORKDIR /var/www/server

# Install compiled code tools from Artifactory and copy it to opt folder.
RUN curl -L --retry 5 --retry-delay 3 "https://github.com/hyperledger/fabric/releases/download/v2.5.9/hyperledger-fabric-linux-amd64-2.5.9.tar.gz" | tar xz -C /opt/
RUN curl -L --retry 5 --retry-delay 3 "https://github.com/hyperledger/fabric/releases/download/v2.5.10/hyperledger-fabric-linux-amd64-2.5.10.tar.gz" | tar xz -C /opt/

# Copy source code to the working dir
COPY src/api-engine ./
Expand All @@ -23,7 +23,7 @@ RUN pip3 install -r requirements.txt
# Add uwsgi configuration file
COPY build_image/docker/common/api-engine/server.ini /etc/uwsgi/apps-enabled/

ENV RUN_MODE server
ENV RUN_MODE=server

COPY build_image/docker/common/api-engine/entrypoint.sh /
CMD bash /entrypoint.sh
CMD ["bash", "/entrypoint.sh"]
2 changes: 1 addition & 1 deletion src/api-engine/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

FABRIC_CHAINCODE_STORE = "/opt/cello/chaincode"

FABRIC_VERSION = "2.5.9"
FABRIC_VERSION = "2.5.10"
2 changes: 1 addition & 1 deletion src/api-engine/api/lib/agent/docker/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def create(self, info):
'tls': info.get("tls")[2:-1],
'peer_config_file': info.get("config_file")[2:-1],
'orderer_config_file': info.get("config_file")[2:-1],
'img': 'hyperledger/fabric:2.5.9',
'img': 'hyperledger/fabric:2.5.10',
'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
50 changes: 19 additions & 31 deletions src/api-engine/api/lib/configtxgen/configtx.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,9 @@ def __init__(self, network, filepath=CELLO_HOME, orderer=None, raft_option=None,
self.filepath = filepath
self.network = network
self.template = load_configtx(template_path)
# self.orderer = {'BatchTimeout': '2s',
# 'OrdererType': "etcdraft",
# 'BatchSize': {'AbsoluteMaxBytes': '98 MB',
# 'MaxMessageCount': 2000,
# 'PreferredMaxBytes': '10 MB'}} if not orderer else orderer
# self.raft_option = {'TickInterval': "600ms",
# 'ElectionTick': 10,
# 'HeartbeatTick': 1,
# 'MaxInflightBlocks': 5,
# 'SnapshotIntervalSize': "20 MB"} if not raft_option else raft_option

def create(self, consensus, orderers, peers, orderer_cfg=None, application=None, option=None):
"""create the cryptotx.yaml

def create(self, name, consensus, orderers, peers, orderer_cfg=None, application=None, option=None):
"""create the configtx.yaml
param:
consensus:consensus
orderers:the list of orderer
Expand Down Expand Up @@ -101,24 +91,24 @@ def create(self, consensus, orderers, peers, orderer_cfg=None, application=None,
Application=ApplicationCapabilities
)
Application = deepcopy(ApplicationDefaults)
Application["Capabilities"] = Capabilities["Application"]
Orderer = deepcopy(OrdererDefaults)
Orderer["Addresses"] = deepcopy(OrdererAddress)
Orderer["Policies"] = dict(
Readers=dict(Type="ImplicitMeta", Rule="ANY Readers"),
Writers=dict(Type="ImplicitMeta", Rule="ANY Writers"),
Admins=dict(Type="ImplicitMeta", Rule="MAJORITY Admins"),
BlockValidation=dict(Type="ImplicitMeta", Rule="ANY Writers")
)
Orderer["EtcdRaft"]["Consenters"] = deepcopy(Consenters)
Channel = deepcopy(ChannelDefaults)
Application["Capabilities"] = Capabilities["Application"]
Channel["Capabilities"] = Capabilities["Channel"]
Orderer["Capabilities"] = Capabilities["Orderer"]
Orderer["OrdererType"] = consensus
Orderer["EtcdRaft"]["Consenters"] = deepcopy(Consenters)

Profiles = {}
Profiles["TwoOrgsOrdererGenesis"] = deepcopy(Channel)
Profiles["TwoOrgsOrdererGenesis"]["Orderer"] = deepcopy(Orderer)
Profiles["TwoOrgsOrdererGenesis"]["Orderer"]["Organizations"] = OrdererOrganizations
Profiles["TwoOrgsOrdererGenesis"]["Orderer"]["Capabilities"] = Capabilities["Orderer"]
Profiles["TwoOrgsOrdererGenesis"]["Consortiums"] = {'SampleConsortium': {'Organizations': deepcopy(PeerOrganizations)}}
Profiles[name] = deepcopy(Channel)
Profiles[name]["Orderer"] = deepcopy(Orderer)
Profiles[name]["Application"] = deepcopy(Application)
Profiles[name]["Capabilities"] = Capabilities["Channel"]
Profiles[name]["Orderer"]["Capabilities"] = Capabilities["Orderer"]
Profiles[name]["Application"]["Capabilities"] = Capabilities["Application"]
Profiles[name]["Orderer"]["Organizations"] = OrdererOrganizations
Profiles[name]["Application"]["Organizations"] = PeerOrganizations

configtx = dict(
Organizations=Organizations,
Expand All @@ -145,8 +135,8 @@ def createChannel(self, name, organizations):
configtx = yaml.load(f, Loader=yaml.FullLoader)
Profiles = configtx["Profiles"]
Channel = configtx["Channel"]
Orderer = configtx["Orderer"]
Application = configtx["Application"]
Capabilities = configtx["Capabilities"]["Application"]
PeerOrganizations = []
for org in configtx["Organizations"]:
for item in organizations:
Expand All @@ -155,10 +145,8 @@ def createChannel(self, name, organizations):
if PeerOrganizations == []:
raise Exception("can't find organnization")
Profiles[name] = deepcopy(Channel)
Profiles[name]["Consortium"] = "SampleConsortium"
Profiles[name]["Application"] = deepcopy(Application)
Profiles[name]["Application"]["Organizations"] = deepcopy(PeerOrganizations)
Profiles[name]["Application"]["Capabilities"] = deepcopy(Capabilities)
Profiles[name]["Orderer"] = Orderer
Profiles[name]["Application"] = Application

with open('{}/{}/{}'.format(self.filepath, self.network, "configtx.yaml"), 'w', encoding='utf-8') as f:
yaml.safe_dump(configtx, f, sort_keys=False)
Expand Down
2 changes: 1 addition & 1 deletion src/api-engine/api/routes/chaincode/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def package(self, request):
# )
# peer_node = qs.first()
# envs = init_env_vars(peer_node, org)
# peer_channel_cli = PeerChainCode("v2.5.9", **envs)
# peer_channel_cli = PeerChainCode("v2.5.10", **envs)
# return_code, content = peer_channel_cli.lifecycle_calculatepackageid(temp_cc_path)
# if (return_code != 0):
# return Response(
Expand Down
2 changes: 1 addition & 1 deletion src/api-engine/api/routes/channel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,5 +423,5 @@ def join_peers(envs, block_path):
# Join the peers to the channel.
peer_channel_cli = PeerChannel(**envs)
peer_channel_cli.join(
block_file=block_path
block_path=block_path
)
4 changes: 2 additions & 2 deletions src/api-engine/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ coreapi==2.3.3
coreschema==0.0.4
defusedxml==0.6.0
Django==4.2.16
django-allauth==0.41.0
django-allauth==0.55.0
django-cors-headers==3.5.0
django-extensions==2.2.9
django-extensions==3.2.3
django-filter==2.4.0
django-rest-auth==0.9.5
djangorestframework==3.15.2
Expand Down
12 changes: 6 additions & 6 deletions src/dashboard/lambda/mock/matchMock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const pathToRegexp = require('path-to-regexp');
const { pathToRegexp } = require('path-to-regexp');
const bodyParser = require('body-parser');

const mockFile = require('./index');
Expand Down Expand Up @@ -47,11 +47,11 @@ function normalizeConfig(config) {
const handler = config[key];
const { method, path } = parseKey(key);
const keys = [];
const re = pathToRegexp(path, keys);
const { regexp } = pathToRegexp(path, keys);
memo.push({
method,
path,
re,
regexp,
keys,
handler: createHandler(method, path, handler),
});
Expand Down Expand Up @@ -83,9 +83,9 @@ function matchMock(req) {
}
// eslint-disable-next-line no-restricted-syntax
for (const mock of mockData) {
const { method, re, keys } = mock;
const { method, regexp, keys } = mock;
if (method === exceptMethod) {
const match = re.exec(req.path);
const match = regexp.exec(req.path);
if (match) {
const params = {};

Expand All @@ -104,7 +104,7 @@ function matchMock(req) {
}
}

return mockData.filter(({ method, re }) => method === exceptMethod && re.test(exceptPath))[0];
return mockData.filter(({ method, regexp }) => method === exceptMethod && regexp.test(exceptPath))[0];
}
module.exports = (req, res, next) => {
const match = matchMock(req);
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"numeral": "^2.0.6",
"nzh": "^1.0.4",
"omit.js": "^1.0.0",
"path-to-regexp": "^8.1.0",
"path-to-regexp": "^8.2.0",
"prop-types": "^15.6.2",
"qs": "^6.6.0",
"rc-animate": "^2.6.0",
Expand Down
5 changes: 3 additions & 2 deletions src/dashboard/src/components/PageHeaderWrapper/breadcrumb.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import pathToRegexp from 'path-to-regexp';
import { pathToRegexp } from 'path-to-regexp';
import { Link, formatMessage } from 'umi';
import { urlToList } from '../_utils/pathTools';
import { menu } from '../../defaultSettings';
Expand Down Expand Up @@ -33,7 +33,8 @@ export const getBreadcrumb = (breadcrumbNameMap, url) => {
let breadcrumb = breadcrumbNameMap[url];
if (!breadcrumb) {
Object.keys(breadcrumbNameMap).forEach(item => {
if (pathToRegexp(item).test(url)) {
const { regexp } = pathToRegexp(item);
if (regexp.test(url)) {
breadcrumb = breadcrumbNameMap[item];
}
});
Expand Down
5 changes: 3 additions & 2 deletions src/dashboard/src/components/SiderMenu/SiderMenuUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pathToRegexp from 'path-to-regexp';
import { pathToRegexp } from 'path-to-regexp';
import { urlToList } from '../_utils/pathTools';

/**
Expand All @@ -20,7 +20,8 @@ export const getFlatMenuKeys = menuData => {
export const getMenuMatches = (flatMenuKeys, path) =>
flatMenuKeys.filter(item => {
if (item) {
return pathToRegexp(item).test(path);
const { regexp } = pathToRegexp(item);
return regexp.test(path);
}
return false;
});
Expand Down
5 changes: 3 additions & 2 deletions src/dashboard/src/pages/Authorized.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import pathToRegexp from 'path-to-regexp';
import { pathToRegexp } from 'path-to-regexp';
import { connect, Redirect } from 'umi';
import Authorized from '@/utils/Authorized';
import { getAuthority } from '@/utils/authority';
Expand All @@ -12,7 +12,8 @@ function AuthComponent({ children, location, routerData }) {
let authorities;
routeData.forEach(route => {
// match prefix
if (pathToRegexp(`${route.path}(.*)`).test(path)) {
const { regexp } = pathToRegexp(`${route.path}(.*)`);
if (regexp.test(path)) {
authorities = route.authority || authorities;

// get children authority recursively
Expand Down
8 changes: 6 additions & 2 deletions src/dashboard/src/utils/getPageTitle.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { formatMessage } from 'umi';
import pathToRegexp from 'path-to-regexp';
import { pathToRegexp } from 'path-to-regexp';
import isEqual from 'lodash/isEqual';
import memoizeOne from 'memoize-one';
import { menu, title } from '../defaultSettings';

export const matchParamsPath = (pathname, breadcrumbNameMap) => {
const pathKey = Object.keys(breadcrumbNameMap).find(key => pathToRegexp(key).test(pathname));
const pathKey = Object.keys(breadcrumbNameMap).find(key => {
const { regexp } = pathToRegexp(key);
return regexp.test(pathname);
});

return breadcrumbNameMap[pathKey];
};

Expand Down

0 comments on commit 5f5ebe8

Please sign in to comment.