agent: set working directory from agent

This commit is contained in:
Gyu-Ho Lee 2016-03-21 15:17:40 -07:00
parent 4ac4546a8d
commit 72f6e5d815
4 changed files with 78 additions and 125 deletions

View File

@ -40,7 +40,8 @@ import (
type (
Flags struct {
GRPCPort string
GRPCPort string
WorkingDirectory string
}
// ZookeeperConfig is zookeeper configuration.
@ -64,7 +65,7 @@ type (
var (
shell = os.Getenv("SHELL")
agentLogPath = filepath.Join(homeDir(), "agent.log")
agentLogPath = "agent.log"
etcdBinaryPath = filepath.Join(os.Getenv("GOPATH"), "bin/etcd")
etcdToken = "etcd_token"
@ -113,9 +114,17 @@ func init() {
shell = "sh"
}
Command.PersistentFlags().StringVar(&globalFlags.GRPCPort, "agent-port", ":3500", "Port to server agent gRPC server.")
Command.PersistentFlags().StringVar(&globalFlags.WorkingDirectory, "working-directory", homeDir(), "Working directory.")
}
func CommandFunc(cmd *cobra.Command, args []string) {
if !exist(globalFlags.WorkingDirectory) {
log.Fatalf("%s does not exist", globalFlags.WorkingDirectory)
}
if !filepath.HasPrefix(agentLogPath, globalFlags.WorkingDirectory) {
agentLogPath = filepath.Join(globalFlags.WorkingDirectory, agentLogPath)
}
f, err := openToAppend(agentLogPath)
if err != nil {
log.Println(err)
@ -157,20 +166,14 @@ func (t *transporterServer) Transfer(ctx context.Context, r *Request) (*Response
peerIPs := strings.Split(r.PeerIPs, "___")
if r.Operation == Request_Start || r.Operation == Request_Restart {
if r.WorkingDirectory == "" {
r.WorkingDirectory = homeDir()
if !filepath.HasPrefix(etcdDataDir, globalFlags.WorkingDirectory) {
etcdDataDir = filepath.Join(globalFlags.WorkingDirectory, etcdDataDir)
}
if !exist(r.WorkingDirectory) {
return nil, fmt.Errorf("%s does not exist", r.WorkingDirectory)
if !filepath.HasPrefix(zkWorkingDir, globalFlags.WorkingDirectory) {
zkWorkingDir = filepath.Join(globalFlags.WorkingDirectory, zkWorkingDir)
}
if !filepath.HasPrefix(etcdDataDir, r.WorkingDirectory) {
etcdDataDir = filepath.Join(r.WorkingDirectory, etcdDataDir)
}
if !filepath.HasPrefix(zkWorkingDir, r.WorkingDirectory) {
zkWorkingDir = filepath.Join(r.WorkingDirectory, zkWorkingDir)
}
if !filepath.HasPrefix(zkDataDir, r.WorkingDirectory) {
zkDataDir = filepath.Join(r.WorkingDirectory, zkDataDir)
if !filepath.HasPrefix(zkDataDir, globalFlags.WorkingDirectory) {
zkDataDir = filepath.Join(globalFlags.WorkingDirectory, zkDataDir)
}
if r.LogPrefix != "" {
if !strings.HasPrefix(filepath.Base(r.DatabaseLogPath), r.LogPrefix) {
@ -180,14 +183,14 @@ func (t *transporterServer) Transfer(ctx context.Context, r *Request) (*Response
r.MonitorResultPath = filepath.Join(filepath.Dir(r.MonitorResultPath), r.LogPrefix+"_"+filepath.Base(r.MonitorResultPath))
}
} else {
if !filepath.HasPrefix(r.DatabaseLogPath, r.WorkingDirectory) {
r.DatabaseLogPath = filepath.Join(r.WorkingDirectory, r.DatabaseLogPath)
if !filepath.HasPrefix(r.DatabaseLogPath, globalFlags.WorkingDirectory) {
r.DatabaseLogPath = filepath.Join(globalFlags.WorkingDirectory, r.DatabaseLogPath)
}
if !filepath.HasPrefix(r.MonitorResultPath, r.WorkingDirectory) {
r.MonitorResultPath = filepath.Join(r.WorkingDirectory, r.MonitorResultPath)
if !filepath.HasPrefix(r.MonitorResultPath, globalFlags.WorkingDirectory) {
r.MonitorResultPath = filepath.Join(globalFlags.WorkingDirectory, r.MonitorResultPath)
}
}
log.Printf("Working directory: %s", r.WorkingDirectory)
log.Printf("Working directory: %s", globalFlags.WorkingDirectory)
log.Printf("etcd data directory: %s", etcdDataDir)
log.Printf("Zookeeper working directory: %s", zkWorkingDir)
log.Printf("Zookeeper data directory: %s", zkDataDir)

View File

@ -94,23 +94,20 @@ type Request struct {
// ZookeeperMaxClientCnxns limits the number of concurrent connections
// (at the socket level) that a single client, identified by IP address.
ZookeeperMaxClientCnxns int64 `protobuf:"varint,7,opt,name=zookeeperMaxClientCnxns,proto3" json:"zookeeperMaxClientCnxns,omitempty"`
// WorkingDirectory is the working directory of the remote machine.
// If empty, it will use its home directory.
WorkingDirectory string `protobuf:"bytes,8,opt,name=workingDirectory,proto3" json:"workingDirectory,omitempty"`
// LogPrefix prefixes all logs to be generated in agent.
LogPrefix string `protobuf:"bytes,9,opt,name=logPrefix,proto3" json:"logPrefix,omitempty"`
LogPrefix string `protobuf:"bytes,8,opt,name=logPrefix,proto3" json:"logPrefix,omitempty"`
// DatabaseLogPath is the file path to store the database logs.
DatabaseLogPath string `protobuf:"bytes,10,opt,name=databaseLogPath,proto3" json:"databaseLogPath,omitempty"`
DatabaseLogPath string `protobuf:"bytes,9,opt,name=databaseLogPath,proto3" json:"databaseLogPath,omitempty"`
// MonitorResultPath is the file path to store monitoring results.
MonitorResultPath string `protobuf:"bytes,11,opt,name=monitorResultPath,proto3" json:"monitorResultPath,omitempty"`
MonitorResultPath string `protobuf:"bytes,10,opt,name=monitorResultPath,proto3" json:"monitorResultPath,omitempty"`
// GoogleCloudProjectName is the project name to use
// to upload logs.
GoogleCloudProjectName string `protobuf:"bytes,12,opt,name=googleCloudProjectName,proto3" json:"googleCloudProjectName,omitempty"`
GoogleCloudProjectName string `protobuf:"bytes,11,opt,name=googleCloudProjectName,proto3" json:"googleCloudProjectName,omitempty"`
// GoogleCloudStorageJSONKey is the key to be used to upload
// data and logs to Google Cloud Storage.
GoogleCloudStorageJSONKey string `protobuf:"bytes,13,opt,name=googleCloudStorageJSONKey,proto3" json:"googleCloudStorageJSONKey,omitempty"`
GoogleCloudStorageJSONKey string `protobuf:"bytes,12,opt,name=googleCloudStorageJSONKey,proto3" json:"googleCloudStorageJSONKey,omitempty"`
// GoogleCloudStorageBucketName is the bucket name to store all data and logs.
GoogleCloudStorageBucketName string `protobuf:"bytes,14,opt,name=googleCloudStorageBucketName,proto3" json:"googleCloudStorageBucketName,omitempty"`
GoogleCloudStorageBucketName string `protobuf:"bytes,13,opt,name=googleCloudStorageBucketName,proto3" json:"googleCloudStorageBucketName,omitempty"`
}
func (m *Request) Reset() { *m = Request{} }
@ -246,44 +243,38 @@ func (m *Request) MarshalTo(data []byte) (int, error) {
i++
i = encodeVarintMessage(data, i, uint64(m.ZookeeperMaxClientCnxns))
}
if len(m.WorkingDirectory) > 0 {
data[i] = 0x42
i++
i = encodeVarintMessage(data, i, uint64(len(m.WorkingDirectory)))
i += copy(data[i:], m.WorkingDirectory)
}
if len(m.LogPrefix) > 0 {
data[i] = 0x4a
data[i] = 0x42
i++
i = encodeVarintMessage(data, i, uint64(len(m.LogPrefix)))
i += copy(data[i:], m.LogPrefix)
}
if len(m.DatabaseLogPath) > 0 {
data[i] = 0x52
data[i] = 0x4a
i++
i = encodeVarintMessage(data, i, uint64(len(m.DatabaseLogPath)))
i += copy(data[i:], m.DatabaseLogPath)
}
if len(m.MonitorResultPath) > 0 {
data[i] = 0x5a
data[i] = 0x52
i++
i = encodeVarintMessage(data, i, uint64(len(m.MonitorResultPath)))
i += copy(data[i:], m.MonitorResultPath)
}
if len(m.GoogleCloudProjectName) > 0 {
data[i] = 0x62
data[i] = 0x5a
i++
i = encodeVarintMessage(data, i, uint64(len(m.GoogleCloudProjectName)))
i += copy(data[i:], m.GoogleCloudProjectName)
}
if len(m.GoogleCloudStorageJSONKey) > 0 {
data[i] = 0x6a
data[i] = 0x62
i++
i = encodeVarintMessage(data, i, uint64(len(m.GoogleCloudStorageJSONKey)))
i += copy(data[i:], m.GoogleCloudStorageJSONKey)
}
if len(m.GoogleCloudStorageBucketName) > 0 {
data[i] = 0x72
data[i] = 0x6a
i++
i = encodeVarintMessage(data, i, uint64(len(m.GoogleCloudStorageBucketName)))
i += copy(data[i:], m.GoogleCloudStorageBucketName)
@ -371,10 +362,6 @@ func (m *Request) Size() (n int) {
if m.ZookeeperMaxClientCnxns != 0 {
n += 1 + sovMessage(uint64(m.ZookeeperMaxClientCnxns))
}
l = len(m.WorkingDirectory)
if l > 0 {
n += 1 + l + sovMessage(uint64(l))
}
l = len(m.LogPrefix)
if l > 0 {
n += 1 + l + sovMessage(uint64(l))
@ -597,35 +584,6 @@ func (m *Request) Unmarshal(data []byte) error {
}
}
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WorkingDirectory", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessage
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthMessage
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.WorkingDirectory = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LogPrefix", wireType)
}
@ -654,7 +612,7 @@ func (m *Request) Unmarshal(data []byte) error {
}
m.LogPrefix = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 10:
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DatabaseLogPath", wireType)
}
@ -683,7 +641,7 @@ func (m *Request) Unmarshal(data []byte) error {
}
m.DatabaseLogPath = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 11:
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MonitorResultPath", wireType)
}
@ -712,7 +670,7 @@ func (m *Request) Unmarshal(data []byte) error {
}
m.MonitorResultPath = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 12:
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GoogleCloudProjectName", wireType)
}
@ -741,7 +699,7 @@ func (m *Request) Unmarshal(data []byte) error {
}
m.GoogleCloudProjectName = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 13:
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GoogleCloudStorageJSONKey", wireType)
}
@ -770,7 +728,7 @@ func (m *Request) Unmarshal(data []byte) error {
}
m.GoogleCloudStorageJSONKey = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 14:
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GoogleCloudStorageBucketName", wireType)
}
@ -996,38 +954,37 @@ var (
)
var fileDescriptorMessage = []byte{
// 526 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x93, 0xcf, 0x72, 0xd2, 0x50,
0x14, 0xc6, 0xa1, 0x7f, 0x20, 0x39, 0x08, 0xc5, 0x3b, 0x6a, 0xaf, 0x9d, 0x0e, 0xe3, 0x60, 0x17,
0x1d, 0x47, 0xe8, 0x4c, 0xeb, 0x38, 0x2e, 0xba, 0x11, 0xd8, 0xd4, 0x6a, 0xcb, 0x04, 0x57, 0xee,
0x42, 0x38, 0xa4, 0x91, 0x90, 0x8b, 0x37, 0x37, 0x0a, 0x5d, 0xf9, 0x18, 0x3e, 0x52, 0x97, 0x3e,
0x82, 0x7f, 0x5e, 0xc4, 0xc3, 0xa1, 0x01, 0x0b, 0xe2, 0x22, 0x33, 0xf7, 0x7c, 0xdf, 0xef, 0x3b,
0x49, 0xee, 0x3d, 0x17, 0x8a, 0x43, 0x8c, 0x63, 0xd7, 0xc7, 0xfa, 0x48, 0x2b, 0xa3, 0xc4, 0x36,
0x2d, 0x23, 0xb3, 0x57, 0xf3, 0x03, 0x73, 0x95, 0x74, 0xeb, 0x9e, 0x1a, 0x1e, 0xf9, 0xca, 0x57,
0x47, 0xec, 0x76, 0x93, 0x3e, 0x57, 0x5c, 0xf0, 0x6a, 0x96, 0xaa, 0x7e, 0xcd, 0x41, 0xde, 0xc1,
0x4f, 0x09, 0xc6, 0x46, 0xbc, 0x04, 0x5b, 0x8d, 0x50, 0xbb, 0x26, 0x50, 0x91, 0xcc, 0x3e, 0xc9,
0x1e, 0x96, 0x8e, 0x65, 0x9d, 0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0xff, 0x7d, 0x4c, 0xf6, 0x23, 0xca, 0x03, 0x00, 0x00,
// 505 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x93, 0xcf, 0x72, 0x12, 0x41,
0x10, 0xc6, 0x21, 0x09, 0x61, 0xb7, 0x91, 0x04, 0xa7, 0xd4, 0x8c, 0xa9, 0x14, 0x65, 0x61, 0x0e,
0x39, 0x08, 0xa9, 0x4a, 0x2c, 0xcb, 0x43, 0x2e, 0x42, 0x2e, 0x31, 0x9a, 0x50, 0x8b, 0x27, 0x6f,
0xcb, 0xd2, 0x6c, 0xd6, 0x2c, 0xdb, 0x38, 0x3b, 0x6b, 0x91, 0x3c, 0x89, 0x8f, 0x94, 0xa3, 0x07,
0x1f, 0xc0, 0x3f, 0x2f, 0x62, 0xd3, 0x04, 0x30, 0x44, 0x3c, 0x4c, 0xd5, 0xf4, 0xf7, 0xfd, 0xbe,
0x86, 0xd9, 0xe9, 0x81, 0xf2, 0x00, 0xd3, 0xd4, 0x0f, 0xb1, 0x31, 0x34, 0x64, 0x49, 0x15, 0x78,
0x9b, 0xd8, 0xed, 0x7a, 0x18, 0xd9, 0x8b, 0xac, 0xdb, 0x08, 0x68, 0xb0, 0x1f, 0x52, 0x48, 0xfb,
0xe2, 0x76, 0xb3, 0xbe, 0x54, 0x52, 0xc8, 0x6e, 0x92, 0xaa, 0x7d, 0x2f, 0x40, 0xd1, 0xc3, 0xcf,
0x19, 0xa6, 0x56, 0xbd, 0x02, 0x97, 0x86, 0x68, 0x7c, 0x1b, 0x51, 0xa2, 0xf3, 0xcf, 0xf2, 0x7b,
0x1b, 0x07, 0xba, 0x21, 0x5d, 0x1b, 0xb7, 0x48, 0xe3, 0x7c, 0xea, 0x7b, 0x73, 0x54, 0x1d, 0x82,
0xd3, 0xf3, 0xad, 0xdf, 0xf5, 0x53, 0xd4, 0x2b, 0x12, 0xdb, 0x5a, 0x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20, 0xd1, 0xe5, 0x80, 0x6a, 0xc2, 0xce, 0x7d, 0xb3, 0x99, 0x05, 0x97, 0x38,
0xf9, 0xed, 0xb2, 0x34, 0xf8, 0x2f, 0x53, 0xab, 0x83, 0x3b, 0x1b, 0x2b, 0xe5, 0x42, 0xa1, 0x63,
0x7d, 0x63, 0x2b, 0x39, 0xe5, 0xc0, 0x1a, 0xc3, 0xc3, 0x4a, 0x5e, 0x95, 0xc6, 0x33, 0x9a, 0x8a,
0xbc, 0x52, 0x7b, 0x0e, 0xce, 0x74, 0x9c, 0xc6, 0xc8, 0x78, 0x26, 0x18, 0x2e, 0x83, 0xfb, 0x91,
0xe8, 0x54, 0xee, 0xa3, 0x92, 0xaf, 0xed, 0x82, 0xc3, 0x89, 0x21, 0x25, 0x93, 0x49, 0x4b, 0xb3,
0x20, 0xe0, 0xc7, 0x22, 0x43, 0xed, 0x78, 0xd3, 0xf2, 0xe0, 0x08, 0x4a, 0x1f, 0x8c, 0x9f, 0x30,
0x67, 0x2c, 0x1a, 0x55, 0x07, 0x47, 0xca, 0x3e, 0xef, 0x37, 0xee, 0x4e, 0xf0, 0xf6, 0xe6, 0xac,
0x9e, 0x74, 0xad, 0xe5, 0x9a, 0x8f, 0x6e, 0x7e, 0x56, 0x73, 0x37, 0xbf, 0xaa, 0xf9, 0x6f, 0xbc,
0x7e, 0xf0, 0xfa, 0xfa, 0xbb, 0x9a, 0xeb, 0xae, 0xcb, 0xbb, 0x3a, 0xfc, 0x13, 0x00, 0x00, 0xff,
0xff, 0xb2, 0xf8, 0x8a, 0x3b, 0x9e, 0x03, 0x00, 0x00,
}

View File

@ -40,29 +40,25 @@ message Request {
// (at the socket level) that a single client, identified by IP address.
int64 zookeeperMaxClientCnxns = 7;
// WorkingDirectory is the working directory of the remote machine.
// If empty, it will use its home directory.
string workingDirectory = 8;
// LogPrefix prefixes all logs to be generated in agent.
string logPrefix = 9;
string logPrefix = 8;
// DatabaseLogPath is the file path to store the database logs.
string databaseLogPath = 10;
string databaseLogPath = 9;
// MonitorResultPath is the file path to store monitoring results.
string monitorResultPath = 11;
string monitorResultPath = 10;
// GoogleCloudProjectName is the project name to use
// to upload logs.
string googleCloudProjectName = 12;
string googleCloudProjectName = 11;
// GoogleCloudStorageJSONKey is the key to be used to upload
// data and logs to Google Cloud Storage.
string googleCloudStorageJSONKey = 13;
string googleCloudStorageJSONKey = 12;
// GoogleCloudStorageBucketName is the bucket name to store all data and logs.
string googleCloudStorageBucketName = 14;
string googleCloudStorageBucketName = 13;
}
message Response {

View File

@ -34,7 +34,6 @@ type (
ZookeeperPreAllocSize int64
ZookeeperMaxClientCnxns int64
WorkingDirectory string
LogPrefix string
DatabaseLogPath string
MonitorResultPath string
@ -69,7 +68,6 @@ func init() {
StartCommand.PersistentFlags().Int64Var(&globalFlags.ZookeeperPreAllocSize, "zk-pre-alloc-size", 65536*1024, "Disk pre-allocation size in bytes.")
StartCommand.PersistentFlags().Int64Var(&globalFlags.ZookeeperMaxClientCnxns, "zk-max-client-conns", 5000, "Maximum number of concurrent Zookeeper connection.")
StartCommand.PersistentFlags().StringVar(&globalFlags.WorkingDirectory, "working-directory", "", "Working directory of the remote machine. If empty, it will use its home directory.")
StartCommand.PersistentFlags().StringVar(&globalFlags.LogPrefix, "log-prefix", "", "Prefix to all logs to be generated in agents.")
StartCommand.PersistentFlags().StringVar(&globalFlags.DatabaseLogPath, "database-log-path", "database.log", "Path of database log.")
StartCommand.PersistentFlags().StringVar(&globalFlags.MonitorResultPath, "monitor-result-path", "monitor.csv", "CSV file path of monitoring results.")
@ -118,7 +116,6 @@ func CommandFunc(cmd *cobra.Command, args []string) {
req.ZookeeperPreAllocSize = globalFlags.ZookeeperPreAllocSize
req.ZookeeperMaxClientCnxns = globalFlags.ZookeeperMaxClientCnxns
req.WorkingDirectory = globalFlags.WorkingDirectory
req.LogPrefix = globalFlags.LogPrefix
req.DatabaseLogPath = globalFlags.DatabaseLogPath
req.MonitorResultPath = globalFlags.MonitorResultPath