client와 server 빌드를 분리하고 client에는 node_exporter 통합

This commit is contained in:
2023-11-13 11:35:52 +09:00
parent 432cc68024
commit d43b83e761
15 changed files with 404 additions and 36 deletions

View File

@ -1,3 +1,5 @@
//go:build server
package server
import (

View File

@ -1,3 +1,5 @@
//go:build server
package server
import (

View File

@ -1,3 +1,5 @@
//go:build server
package server
import (

View File

@ -1,3 +1,5 @@
//go:build server
package server
import (

View File

@ -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() {