| @@ -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 | |||
| 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 | |||
| @@ -39,7 +39,6 @@ type Config struct { | |||
| OpenstackRpcConf zrpc.RpcClientConf | |||
| OctopusRpcConf zrpc.RpcClientConf | |||
| PcmCoreRpcConf zrpc.RpcClientConf | |||
| NexusUrl string | |||
| JccScheduleUrl string | |||
| MinioConf struct { | |||
| Secret string | |||
| @@ -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() | |||