1
All checks were successful
Auth & User Management Service CI / build-services (app/auth_service/Dockerfile, auth_service, auth_service) (push) Successful in 40s
Auth & User Management Service CI / build-services (app/douyin_ecpm_calculation_service/Dockerfile, douyin_ecpm_calculation_service, douyin_ecpm_calculation_service) (push) Successful in 38s
Auth & User Management Service CI / build-services (app/ranking_management/Dockerfile, ranking_management, ranking_management) (push) Successful in 42s
Auth & User Management Service CI / build-services (app/user_management/Dockerfile, user_manager, user_management) (push) Successful in 39s
Auth & User Management Service CI / start-services (push) Successful in 4s
All checks were successful
Auth & User Management Service CI / build-services (app/auth_service/Dockerfile, auth_service, auth_service) (push) Successful in 40s
Auth & User Management Service CI / build-services (app/douyin_ecpm_calculation_service/Dockerfile, douyin_ecpm_calculation_service, douyin_ecpm_calculation_service) (push) Successful in 38s
Auth & User Management Service CI / build-services (app/ranking_management/Dockerfile, ranking_management, ranking_management) (push) Successful in 42s
Auth & User Management Service CI / build-services (app/user_management/Dockerfile, user_manager, user_management) (push) Successful in 39s
Auth & User Management Service CI / start-services (push) Successful in 4s
This commit is contained in:
parent
d04175ee7c
commit
c7f5f9828a
@ -4,24 +4,28 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/config"
|
|
||||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/server"
|
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/server"
|
||||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||||
|
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/config"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/conf"
|
|
||||||
"github.com/zeromicro/go-zero/core/service"
|
"github.com/zeromicro/go-zero/core/service"
|
||||||
"github.com/zeromicro/go-zero/zrpc"
|
"github.com/zeromicro/go-zero/zrpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
)
|
)
|
||||||
|
|
||||||
var configFile = flag.String("f", "etc/douyin_ecpm_calculation_service.yaml", "the config file")
|
const ServiceName = "douyin_ecpm"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
var c config.Config
|
var c config.Config
|
||||||
conf.MustLoad(*configFile, &c)
|
err := config.GetConfig(&c, ServiceName)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
c.RpcServerConf.Name = ServiceName + ".rpc"
|
||||||
ctx := svc.NewServiceContext(c)
|
ctx := svc.NewServiceContext(c)
|
||||||
|
|
||||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||||
@ -31,8 +35,9 @@ func main() {
|
|||||||
reflection.Register(grpcServer)
|
reflection.Register(grpcServer)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
defer s.Stop()
|
defer s.Stop()
|
||||||
|
|
||||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
fmt.Printf("Starting rpc server at %s...\n", c.RpcServerConf.ListenOn)
|
||||||
s.Start()
|
s.Start()
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@ package svc
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/config"
|
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/config"
|
||||||
|
"github.com/spf13/viper"
|
||||||
"github.com/zeromicro/go-zero/core/conf"
|
"github.com/zeromicro/go-zero/core/conf"
|
||||||
"github.com/zeromicro/go-zero/core/discov"
|
"github.com/zeromicro/go-zero/core/discov"
|
||||||
"github.com/zeromicro/go-zero/zrpc"
|
"github.com/zeromicro/go-zero/zrpc"
|
||||||
@ -36,7 +37,7 @@ const EcpmConfigWatchKey = "ecpm_config"
|
|||||||
func (svc *ServiceContext) initEtcd() {
|
func (svc *ServiceContext) initEtcd() {
|
||||||
|
|
||||||
//初始化etcd客户端
|
//初始化etcd客户端
|
||||||
cli, err := clientv3.NewFromURL(svc.Config.Etcd.Hosts[0])
|
cli, err := clientv3.NewFromURL(viper.GetString(config.EtcdAddrKey))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -77,7 +78,7 @@ func (svc *ServiceContext) initAuthServiceClient() {
|
|||||||
clientConf.Token = "auth_service.rpc.key"
|
clientConf.Token = "auth_service.rpc.key"
|
||||||
clientConf.App = "auth_service.rpc"
|
clientConf.App = "auth_service.rpc"
|
||||||
clientConf.Etcd = discov.EtcdConf{ // 通过 etcd 服务发现
|
clientConf.Etcd = discov.EtcdConf{ // 通过 etcd 服务发现
|
||||||
Hosts: svc.Config.Etcd.Hosts,
|
Hosts: []string{viper.GetString(config.EtcdAddrKey)},
|
||||||
Key: "auth_service.rpc",
|
Key: "auth_service.rpc",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,11 @@ func GetConfig(c *Config, serverName string) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
err = viper.Unmarshal(&c)
|
||||||
return viper.Unmarshal(&c)
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.RpcServerConf.Name = serverName + ".rpc"
|
||||||
|
c.RpcServerConf.ServiceConf.Mode = c.Mode
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ func TestGenConfig(t *testing.T) {
|
|||||||
c.RpcServerConf.ListenOn = "0.0.0.0:8081"
|
c.RpcServerConf.ListenOn = "0.0.0.0:8081"
|
||||||
c.Mode = "dev"
|
c.Mode = "dev"
|
||||||
c.Mysql = "root:youtu!0113@tcp(192.168.0.47:3306)/ecpm?charset=utf8mb4&parseTime=True&loc=Local"
|
c.Mysql = "root:youtu!0113@tcp(192.168.0.47:3306)/ecpm?charset=utf8mb4&parseTime=True&loc=Local"
|
||||||
c.Redis = []Redis{{Host: "192.168.0.47:2379:6379"}}
|
c.Redis = []Redis{{Host: "192.168.0.47:6379"}}
|
||||||
c.RpcServerConf.Etcd.Hosts = append(c.RpcServerConf.Etcd.Hosts, "192.168.0.47:2379")
|
c.RpcServerConf.Etcd.Hosts = append(c.RpcServerConf.Etcd.Hosts, "192.168.0.47:2379")
|
||||||
c.RpcServerConf.Etcd.Key = "user_management.rpc"
|
c.RpcServerConf.Etcd.Key = "user_management.rpc"
|
||||||
b, err := json.Marshal(c)
|
b, err := json.Marshal(c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user