pull/351/head
wangchuxiao 2 years ago
parent 632ff783c6
commit 04a0614319

@ -50,7 +50,9 @@ func main() {
r.Use(utils.CorsHandler())
log.Info("load config: ", config.Config)
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
r.GET("/metrics", promePkg.PrometheusHandler())
if config.Config.Prometheus.Enable {
r.GET("/metrics", promePkg.PrometheusHandler())
}
// user routing group, which handles user registration and login services
userRouterGroup := r.Group("/user")
{

@ -21,7 +21,7 @@ func main() {
flag.Parse()
var wg sync.WaitGroup
wg.Add(1)
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort)
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort, *prometheusPort)
gate.Init(*rpcPort, *wsPort)
gate.Run(*prometheusPort)
wg.Wait()

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImAdminCmsPort
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.AdminCmsPrometheusPort[0], "adminCMSPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.AdminCmsPrometheusPort[0], "adminCMSPrometheusPort default listen port")
flag.Parse()
fmt.Println("start cms rpc server, port: ", *rpcPort)
rpcServer := rpcMessageCMS.NewAdminCMSServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImAuthPort
rpcPort := flag.Int("port", defaultPorts[0], "RpcToken default listen port 10800")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.AuthPrometheusPort[0], "authPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.AuthPrometheusPort[0], "authPrometheusPort default listen port")
flag.Parse()
fmt.Println("start auth rpc server, port: ", *rpcPort)
rpcServer := rpcAuth.NewRpcAuthServer(*rpcPort)

@ -12,7 +12,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImCachePort
rpcPort := flag.Int("port", defaultPorts[0], "RpcToken default listen port 10800")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.CachePrometheusPort[0], "cachePrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.CachePrometheusPort[0], "cachePrometheusPort default listen port")
flag.Parse()
fmt.Println("start cache rpc server, port: ", *rpcPort)
rpcServer := rpcCache.NewCacheServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImConversationPort
rpcPort := flag.Int("port", defaultPorts[0], "RpcConversation default listen port 11300")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.ConversationPrometheusPort[0], "conversationPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.ConversationPrometheusPort[0], "conversationPrometheusPort default listen port")
flag.Parse()
fmt.Println("start conversation rpc server, port: ", *rpcPort)
rpcServer := rpcConversation.NewRpcConversationServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImFriendPort
rpcPort := flag.Int("port", defaultPorts[0], "get RpcFriendPort from cmd,default 12000 as port")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.FriendPrometheusPort[0], "friendPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.FriendPrometheusPort[0], "friendPrometheusPort default listen port")
flag.Parse()
fmt.Println("start friend rpc server, port: ", *rpcPort)
rpcServer := friend.NewFriendServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImGroupPort
rpcPort := flag.Int("port", defaultPorts[0], "get RpcGroupPort from cmd,default 16000 as port")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.GroupPrometheusPort[0], "groupPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.GroupPrometheusPort[0], "groupPrometheusPort default listen port")
flag.Parse()
fmt.Println("start group rpc server, port: ", *rpcPort)
rpcServer := group.NewGroupServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImMessagePort
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.MessagePrometheusPort[0], "msgPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessagePrometheusPort[0], "msgPrometheusPort default listen port")
flag.Parse()
fmt.Println("start msg rpc server, port: ", *rpcPort)
rpcServer := msg.NewRpcChatServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImOfficePort
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.OfficePrometheusPort[0], "officePrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.OfficePrometheusPort[0], "officePrometheusPort default listen port")
flag.Parse()
fmt.Println("start office rpc server, port: ", *rpcPort)
rpcServer := rpc.NewOfficeServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImOrganizationPort
rpcPort := flag.Int("port", defaultPorts[0], "get RpcOrganizationPort from cmd,default 11200 as port")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.OrganizationPrometheusPort[0], "organizationPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.OrganizationPrometheusPort[0], "organizationPrometheusPort default listen port")
flag.Parse()
fmt.Println("start organization rpc server, port: ", *rpcPort)
rpcServer := organization.NewServer(*rpcPort)

@ -11,7 +11,7 @@ import (
func main() {
defaultPorts := config.Config.RpcPort.OpenImUserPort
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
prometheusPort := flag.Int("prometheus-port", config.Config.Prometheus.UserPrometheusPort[0], "userPrometheusPort default listen port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.UserPrometheusPort[0], "userPrometheusPort default listen port")
flag.Parse()
fmt.Println("start user rpc server, port: ", *rpcPort)
rpcServer := user.NewUserServer(*rpcPort)

@ -84,7 +84,7 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
for ((j = 0; j < ${#service_ports[*]}; j++)); do
#Start the service in the background
# ./${service_filename[$i]} -port $j &
cmd="./${service_filename[$i]} -port ${service_ports[$j]} -prometheus-port ${prome_ports[$j]}"
cmd="./${service_filename[$i]} -port ${service_ports[$j]} -prometheus_port ${prome_ports[$j]}"
if [ $i -eq 0 -o $i -eq 1 ]; then
cmd="./${service_filename[$i]} -port ${service_ports[$j]}"
fi
@ -92,6 +92,6 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
nohup $cmd >>../logs/openIM.log 2>&1 &
sleep 1
pid="netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1"
echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:$j pid:$(eval $pid)$COLOR_SUFFIX"
echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:${service_ports[$j]} pid:$(eval $pid)$COLOR_SUFFIX"
done
done

Loading…
Cancel
Save