From febdf409dad45a10bae06ca32a9207b21f1b7e4b Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Tue, 12 Dec 2023 10:04:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4nacos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: e14474817f56db006ac29206ac6c9fe7b855d45e --- api/etc/pcm.yaml | 115 ++++++++++++++++++++++++++++------ api/internal/config/config.go | 1 - api/pcm.go | 21 +------ 3 files changed, 98 insertions(+), 39 deletions(-) diff --git a/api/etc/pcm.yaml b/api/etc/pcm.yaml index 04d0736c..9192fb9b 100644 --- a/api/etc/pcm.yaml +++ b/api/etc/pcm.yaml @@ -1,18 +1,97 @@ -NacosConfig: - DataId: pcm-core-api.yaml - Group: DEFAULT_GROUP - ServerConfigs: -# - IpAddr: 127.0.0.1 -# Port: 8848 -# - IpAddr: 10.101.15.7 -# Port: 8848 - - IpAddr: nacos.jcce.dev - Port: 8848 - ClientConfig: - NamespaceId: test -# NamespaceId: test - TimeoutMs: 5000 - NotLoadCacheAtStart: true - LogDir: - CacheDir: - LogLevel: debug \ No newline at end of file +Name: pcm.core.api +Host: 0.0.0.0 +Port: 8999 + +Timeout: 50000 + +DB: + DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local + +Redis: + Host: 10.206.0.12:6379 + Pass: redisPW123 + +Cache: + - Host: 10.206.0.12:6379 + Pass: redisPW123 + +# k8s rpc +K8sNativeConf: + # target: nacos://10.206.0.12:8848/pcm.kubenative.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + Endpoints: + - pcm-participant-kubernetes-service:2003 + NonBlock: true + +#rpc +THRpcConf: + target: nacos://10.206.0.12:8848/pcm.th.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + +#rpc +ModelArtsRpcConf: + target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + +#rpc +ModelArtsImgRpcConf: + target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + +#rpc +ACRpcConf: + target: nacos://10.206.0.12:8848/pcm.ac.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +#rpc +CephRpcConf: + target: nacos://10.206.0.12:8848/pcm.ceph.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 50000 + +OctopusRpcConf: + target: nacos://10.206.0.12:8848/pcm.octopus.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +OpenstackRpcConf: + target: nacos://10.206.0.12:8848/pcm.openstack.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +# core rpc +PcmCoreRpcConf: + target: nacos://10.206.0.12:8848/pcm.core.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api + # Endpoints: + # - 127.0.0.1:8888 + NonBlock: true + Timeout: 20000 + +JccScheduleUrl: http://jcce-schedule-service:8082 + + +MinioConf: + Secret: minio_xnu122@_ + AccessKey: minioadmin + Endpoint: http://121.89.220.60:9000 + +RegistryConf: + Username: jointcloudNudt + Password: Nudt@123 + +SnowflakeConf: + MachineId: 1 \ No newline at end of file diff --git a/api/internal/config/config.go b/api/internal/config/config.go index c731d85f..7f4b6dee 100644 --- a/api/internal/config/config.go +++ b/api/internal/config/config.go @@ -39,7 +39,6 @@ type Config struct { OpenstackRpcConf zrpc.RpcClientConf OctopusRpcConf zrpc.RpcClientConf PcmCoreRpcConf zrpc.RpcClientConf - NexusUrl string JccScheduleUrl string MinioConf struct { Secret string diff --git a/api/pcm.go b/api/pcm.go index 1af29e8d..2b499b8f 100644 --- a/api/pcm.go +++ b/api/pcm.go @@ -26,7 +26,6 @@ import ( "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/mqs" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" - commonConfig "gitlink.org.cn/jcce-pcm/utils/nacos" ) var configFile = flag.String("f", "api/etc/pcm.yaml", "the config file") @@ -34,26 +33,8 @@ var configFile = flag.String("f", "api/etc/pcm.yaml", "the config file") func main() { flag.Parse() - var bootstrapConfig commonConfig.BootstrapConfig - conf.MustLoad(*configFile, &bootstrapConfig) - - //解析业务配置 var c config.Config - - nacosConfig := bootstrapConfig.NacosConfig - serviceConfigContent := nacosConfig.InitConfig(func(data string) { - err := conf.LoadFromYamlBytes([]byte(data), &c) - if err != nil { - panic(err) - } - }) - err := conf.LoadFromYamlBytes([]byte(serviceConfigContent), &c) - if err != nil { - panic(err) - } - - // 注册到nacos - nacosConfig.DiscoveryRest(&c.RestConf) + conf.MustLoad(*configFile, &c) serviceGroup := service.NewServiceGroup() defer serviceGroup.Stop()