client와 server 빌드를 분리하고 client에는 node_exporter 통합
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
//go:build server
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
//go:build server
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
//go:build server
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
//go:build server
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
|
||||
@ -5,10 +5,8 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
"repositories.action2quare.com/ayo/houston/client"
|
||||
"repositories.action2quare.com/ayo/houston/shared"
|
||||
"repositories.action2quare.com/ayo/houston/shared/protos"
|
||||
|
||||
@ -25,7 +23,6 @@ type HoustonServer interface {
|
||||
type serverConfig struct {
|
||||
GrpcPort int `json:"grpc_port"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
RunAsClient bool `json:"run_as_client"`
|
||||
}
|
||||
|
||||
type DeployRequest struct {
|
||||
@ -177,30 +174,7 @@ func (hs *houstonServer) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
closeCount := int32(0)
|
||||
var hc client.HoustonClient
|
||||
if loadServerConfig().RunAsClient {
|
||||
hc, err = client.NewClient(false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
go func() {
|
||||
hc.Start()
|
||||
if atomic.AddInt32(&closeCount, 1) == 1 {
|
||||
hs.Stop()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
err = hs.rpcServer.Serve(lis)
|
||||
if atomic.AddInt32(&closeCount, 1) == 1 {
|
||||
if hc != nil {
|
||||
hc.Shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
return hs.rpcServer.Serve(lis)
|
||||
}
|
||||
|
||||
func (hs *houstonServer) Stop() {
|
||||
|
||||
Reference in New Issue
Block a user