diff --git a/cpp/tools/build_ppc.sh b/cpp/tools/build_ppc.sh index 509a0bd0..c7ec3f7a 100644 --- a/cpp/tools/build_ppc.sh +++ b/cpp/tools/build_ppc.sh @@ -35,7 +35,7 @@ default_version="v1.1.0" compatibility_version=${default_version} command="deploy" -disable_ra2018="false" +disable_ra2018="true" LOG_WARN() { local content=${1} @@ -420,9 +420,9 @@ generate_node_config_ini() { ; the threadPoolSize thread_count = 4 ; the gatewayService endpoint information - service.gateway_target = + gateway_target = ; the components - service.components = + components = nodeid=${nodeid} [crypto] @@ -524,8 +524,9 @@ generate_node_config_ini() { ; MB max_log_file_size=200 ; LineID, TimeStamp, ProcessID, ThreadName, ThreadID and Message - format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% - enable_rotate_by_hour=false + ;format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% + format=%Severity%|%TimeStamp%|%Message% + enable_rotate_by_hour=true log_name_pattern=ppcs-psi4ef.log ; Y,m,d,H,M,S are supported, N is the sequence number log_%Y%m%d.%H%M%S.%N.log rotate_name_pattern=log_%Y%m%d.%H%M.log diff --git a/cpp/tools/build_wedpr_cem.sh b/cpp/tools/build_wedpr_cem.sh index 5cb54e9d..0a2a6ed2 100644 --- a/cpp/tools/build_wedpr_cem.sh +++ b/cpp/tools/build_wedpr_cem.sh @@ -377,8 +377,9 @@ generate_config_ini() { ; MB max_log_file_size=200 ; LineID, TimeStamp, ProcessID, ThreadName, ThreadID and Message - format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% - enable_rotate_by_hour=false + ;format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% + format=%Severity%|%TimeStamp%|%Message% + enable_rotate_by_hour=true log_name_pattern=ppcs-psi4ef.log ; Y,m,d,H,M,S are supported, N is the sequence number log_%Y%m%d.%H%M%S.%N.log rotate_name_pattern=log_%Y%m%d.%H%M.log diff --git a/cpp/tools/ppc-builder/conf/config-example.toml b/cpp/tools/ppc-builder/conf/config-example.toml index 7225f7e7..a27685dd 100644 --- a/cpp/tools/ppc-builder/conf/config-example.toml +++ b/cpp/tools/ppc-builder/conf/config-example.toml @@ -43,7 +43,7 @@ holding_msg_minutes = 30 # configuration for the ppc-node [[agency.node]] # disable the ra2018 psi or not, default enable ra2018 - disable_ra2018 = false + disable_ra2018 = true deploy_ip=["127.0.0.1:2"] # node name, Notice: node_name in the same agency and group must be unique node_name = "node0" @@ -128,7 +128,7 @@ holding_msg_minutes = 30 # configuration for the ppc-node [[agency.node]] # disable the ra2018 psi or not, default enable ra2018 - disable_ra2018 = false + disable_ra2018 = true deploy_ip=["127.0.0.1:2"] # node name, Notice: node_name in the same agency and group must be unique node_name = "node0" diff --git a/cpp/tools/ppc-builder/src/config/ppc_node_config_generator.py b/cpp/tools/ppc-builder/src/config/ppc_node_config_generator.py index 3e9d8c2c..857502fb 100644 --- a/cpp/tools/ppc-builder/src/config/ppc_node_config_generator.py +++ b/cpp/tools/ppc-builder/src/config/ppc_node_config_generator.py @@ -203,9 +203,9 @@ def __generate_transport_config__(self, config_content, node_config, node_id, de ; the threadPoolSize thread_count = 4 ; the gatewayService endpoint information - service.gateway_target = + gateway_target = ; the components - service.components = + components = nodeid= """ section = "transport" @@ -213,8 +213,8 @@ def __generate_transport_config__(self, config_content, node_config, node_id, de config_content[section]["listen_port"] = str( node_config.grpc_listen_port) config_content[section]["host_ip"] = deploy_ip - config_content[section]["service.gateway_target"] = node_config.gateway_config.gateway_grpc_target - config_content[section]["service.components"] = node_config.components + config_content[section]["gateway_target"] = node_config.gateway_config.gateway_grpc_target + config_content[section]["components"] = node_config.components config_content[section]["nodeid"] = node_id def __generate_ra2018psi_config__(self, config_content, ra2018psi_config): diff --git a/cpp/tools/ppc-builder/src/tpl/config.ini.gateway b/cpp/tools/ppc-builder/src/tpl/config.ini.gateway index 8acc4990..10afa936 100644 --- a/cpp/tools/ppc-builder/src/tpl/config.ini.gateway +++ b/cpp/tools/ppc-builder/src/tpl/config.ini.gateway @@ -39,8 +39,9 @@ ; MB max_log_file_size=200 ; LineID, TimeStamp, ProcessID, ThreadName, ThreadID and Message - format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% - enable_rotate_by_hour=false + ;format=%Severity%|ppcs-gateway|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% + format=%Severity%|%TimeStamp%|%Message% + enable_rotate_by_hour=true log_name_pattern=ppcs-gateway.log ; Y,m,d,H,M,S are supported, N is the sequence number log_%Y%m%d.%H%M%S.%N.log rotate_name_pattern=log_%Y%m%d.%H%M.log diff --git a/cpp/tools/ppc-builder/src/tpl/config.ini.node b/cpp/tools/ppc-builder/src/tpl/config.ini.node index 177536ac..d47d7883 100644 --- a/cpp/tools/ppc-builder/src/tpl/config.ini.node +++ b/cpp/tools/ppc-builder/src/tpl/config.ini.node @@ -4,7 +4,7 @@ ; the private key path for the psi-server private_key_path = conf/node.pem ; disable the ra2018 or not, default enable ra2018 - disable_ra2018 = false + disable_ra2018 = true ; the path that allows programs to access ; data_location = data ; task_timeout_minutes = 180 @@ -38,9 +38,9 @@ ; the threadPoolSize thread_count = 4 ; the gatewayService endpoint information - service.gateway_target = + gateway_target = ; the components - service.components = + components = nodeid= [storage] @@ -101,8 +101,9 @@ ; MB max_log_file_size=200 ; LineID, TimeStamp, ProcessID, ThreadName, ThreadID and Message - format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% - enable_rotate_by_hour=false + ;format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% + format=%Severity%|%TimeStamp%|%Message% + enable_rotate_by_hour=true log_name_pattern=ppcs-psi4ef.log ; Y,m,d,H,M,S are supported, N is the sequence number log_%Y%m%d.%H%M%S.%N.log rotate_name_pattern=log_%Y%m%d.%H%M.log diff --git a/cpp/wedpr-computing/ppc-cem/tests/data/config.ini b/cpp/wedpr-computing/ppc-cem/tests/data/config.ini index 5cf1c6f8..c9562ec0 100644 --- a/cpp/wedpr-computing/ppc-cem/tests/data/config.ini +++ b/cpp/wedpr-computing/ppc-cem/tests/data/config.ini @@ -56,7 +56,7 @@ max_log_file_size=200 ; LineID, TimeStamp, ProcessID, ThreadName, ThreadID and Message #format=%Severity%|ppcs-psi4ef|system-id|%TimeStamp%|%ThreadName%-%ThreadID%|%Message% - #enable_rotate_by_hour=false + #enable_rotate_by_hour=true #log_name_pattern=ppcs-psi4ef.log ; Y,m,d,H,M,S are supported, N is the sequence number log_%Y%m%d.%H%M%S.%N.log #rotate_name_pattern=log_%Y%m%d.%H%M.log diff --git a/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp b/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp index 530be4c0..7a6344e8 100644 --- a/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp +++ b/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp @@ -137,14 +137,14 @@ void PPCConfig::loadFrontConfig(bool requireTransport, loadEndpointConfig(m_frontConfig->mutableSelfEndPoint(), true, "transport", pt); // the gateway targets - auto gatewayTargets = pt.get("transport.service.gateway_target", ""); + auto gatewayTargets = pt.get("transport.gateway_target", ""); if (gatewayTargets.empty()) { - BOOST_THROW_EXCEPTION(InvalidConfig() << errinfo_comment( - "Must specify the transport.service.gateway_target!")); + BOOST_THROW_EXCEPTION( + InvalidConfig() << errinfo_comment("Must specify the transport.gateway_target!")); } // the components - auto components = pt.get("transport.service.components", ""); + auto components = pt.get("transport.components", ""); boost::split(m_frontConfig->mutableComponents(), components, boost::is_any_of(",")); } diff --git a/cpp/wedpr-transport/sdk/ProTransportImpl.cpp b/cpp/wedpr-transport/sdk/ProTransportImpl.cpp index 2ff873ed..3763e339 100644 --- a/cpp/wedpr-transport/sdk/ProTransportImpl.cpp +++ b/cpp/wedpr-transport/sdk/ProTransportImpl.cpp @@ -32,8 +32,9 @@ using namespace ppc::sdk; ProTransportImpl::ProTransportImpl(ppc::front::FrontConfig::Ptr config, int keepAlivePeriodMs) : m_config(std::move(config)), m_keepAlivePeriodMs(keepAlivePeriodMs) { - // default enable health-check - auto grpcServerConfig = std::make_shared(config->selfEndPoint(), true); + // Note: since the config has been moved away, should not use the `config`, use `m_config` + // instead default enable health-check + auto grpcServerConfig = std::make_shared(m_config->selfEndPoint(), true); m_server = std::make_shared(grpcServerConfig); FrontFactory frontFactory; @@ -41,14 +42,13 @@ ProTransportImpl::ProTransportImpl(ppc::front::FrontConfig::Ptr config, int keep std::make_shared(m_config->grpcConfig(), m_config->gatewayGrpcTarget()); m_front = frontFactory.build(std::make_shared(), std::make_shared(), - std::make_shared(), m_gateway, config); + std::make_shared(), m_gateway, m_config); auto msgBuilder = std::make_shared(std::make_shared()); - auto frontService = std::make_shared(msgBuilder, m_front); - frontService->setHealthCheckService(m_server->server()->GetHealthCheckService()); + m_frontService = std::make_shared(msgBuilder, m_front); // register the frontService - m_server->registerService(frontService); + m_server->registerService(m_frontService); } void ProTransportImpl::start() @@ -65,6 +65,8 @@ void ProTransportImpl::start() }); m_timer->start(); m_server->start(); + // Note: the server is inited after start + m_frontService->setHealthCheckService(m_server->server()->GetHealthCheckService()); m_front->start(); } diff --git a/cpp/wedpr-transport/sdk/ProTransportImpl.h b/cpp/wedpr-transport/sdk/ProTransportImpl.h index ed29cbdd..76e2ce3a 100644 --- a/cpp/wedpr-transport/sdk/ProTransportImpl.h +++ b/cpp/wedpr-transport/sdk/ProTransportImpl.h @@ -24,7 +24,8 @@ namespace ppc::protocol { class GrpcServer; -} +class FrontServer; +} // namespace ppc::protocol namespace ppc::sdk @@ -44,6 +45,7 @@ class ProTransportImpl : public Transport, public std::enable_shared_from_this

m_server; + std::shared_ptr m_frontService; int m_keepAlivePeriodMs; std::shared_ptr m_timer; };