Skip to content

Commit

Permalink
modify coded document
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangmingke committed Jul 17, 2020
1 parent 7983e64 commit 2c104a7
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 30 deletions.
2 changes: 0 additions & 2 deletions pkg/proxy/confProxy/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ func (d *DataSource) AppConfigScanner() []*structs.ConfNode {
return confuNodes
}

///juno-agent/app.a246-249-249.prod.ali-bj-g/wsd-projecta-group-srv-content-go/prod/static/config-prod-bjalig.toml/35306
///juno-agent/app.a246-249-249.prod.ali-bj-g/wsd-projecta-group-srv-content-go/ALIYUN-HB2-G_prod/static/config-prod-bjalig.toml/35306
// watch 监听配置变动
func (d *DataSource) watch() {
// etcd的key用作配置数据读取
Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/regProxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (proxy *RegProxy) Put(ctx context.Context, in *pb.PutRequest) (out *pb.PutR
bytes.HasPrefix(in.GetKey(), []byte("http:")):
// todo(gorexlv): v1 注册信息需要额外补全,后续添加, 暂时去掉
// node, err = extractRegInfoV1(in.GetKey(), in.GetValue())
case bytes.HasPrefix(in.GetKey(), []byte("/wsd-reg/")):
case bytes.HasPrefix(in.GetKey(), []byte("/reg/")):
node, err = extractRegInfoV2(in.GetKey(), in.GetValue())
case bytes.HasPrefix(in.GetKey(), []byte("/dubbo/")):
// todo(gorexlv): v3 dubbo注册信息需要额外补全,后续添加, 暂时去掉
Expand Down Expand Up @@ -153,7 +153,7 @@ func extractRegInfoV1(key, val []byte) (node *structs.ServiceNode, err error) {

// extractRegInfoV2 ...
func extractRegInfoV2(key []byte, val []byte) (node *structs.ServiceNode, err error) {
appName, addr := xstring.Split(strings.TrimLeft(string(key), "/wsd-reg/"), "/providers/").Head2()
appName, addr := xstring.Split(strings.TrimLeft(string(key), "/reg/"), "/providers/").Head2()
xlog.Info("extractRegInfoV2", xlog.String("appName", appName), xlog.String("addr", addr))
uri, err := url.Parse(addr)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/report/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func buildConfig() {
config.Addr = "http://127.0.0.1:8080/report"
config.Internal = 60
config.RegionCode = "WUHAN"
config.ZoneName = "DY"
config.ZoneName = "Test"
}
func TestMain(m *testing.M) {
instantiationReport()
Expand Down
4 changes: 2 additions & 2 deletions pkg/structs/conf_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type ContentNode struct {
Version int64 `json:"version"` // 应用部署配置版本
}

// ConfKey 存储配置的key字段 for instance /wsd-sider/wsd.go-141-66.stress.unp/wsd-ocr-task-intercepter-go/stress/static/config-stress.toml
// ConfKey 存储配置的key字段 for instance
type ConfKey struct {
Prefix string `json:"prefix"`
Hostname string `json:"hostname"`
Expand Down Expand Up @@ -126,7 +126,7 @@ func ParserConfValue(value string) (valueData ConfValue, err error) {
return
}

// ConfReport {"file_name":"config-live.toml","md5":"0f07572ba1212a75d8b5a0167c5507c2","hostname":"wsd-go.a1-41-116.live.unp","env":"live","timestamp":1560477493}
// ConfReport {"file_name":"config-live.toml","md5":"0f07572ba1212a75d8b5a0167c5507c2","hostname":"xxx.live.unp","env":"live","timestamp":1560477493}
type ConfReport struct {
FileName string `json:"file_name"`
MD5 string `json:"md5"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/structs/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type ProgramExt struct {
FileName string `json:"file_name" toml:"file_name"` // profile name
FilePath string `json:"file_path" toml:"file_path"` // profile path
Manager string `json:"manager" toml:"manager"` // systemd|supervisor
ProgramName string `json:"program" toml:"program"` // programName eg: wsd-live-srv-room-go
ProgramName string `json:"program" toml:"program"` // programName eg: xxx
StartCommand string `json:"start_command" toml:"start_command"`
Environments []string `json:"environments" toml:"environments"` // environment variable
User string `json:"user" toml:"user"` // user account name
Expand Down
4 changes: 2 additions & 2 deletions testdata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

func main() {

result := `root 2750175 0.6 0.1 1640248 77596 ? Sl 7月04 123:09 /home/www/server/wsd-penaten-admin-juno-go/bin/wsd-penaten-admin-juno-go --host=10.1.56.26 --config=config/config-prod.toml
www 2750176 1.5 0.0 617680 34476 ? Sl 7月04 276:47 /home/www/server/wsd-penaten-admin-generatorcode-go/bin/wsd-penaten-admin-generatorcode-go --host=10.1.56.26 --config=config/config-prod.toml`
result := `root 2750175 0.6 0.1 1640248 77596 ? Sl 7月04 123:09 /home/www/server/xxx/bin/xxx --host=127.0.0.1 --config=config/config-prod.toml
www 2750176 1.5 0.0 617680 34476 ? Sl 7月04 276:47 /home/www/server/xxx/bin/xxx --host=127.0.0.1 --config=config/config-prod.toml`
arr := strings.Split(result, "\n")
for _, line := range arr {
items := strings.SplitAfterN(line, " ", 11)
Expand Down
2 changes: 1 addition & 1 deletion testdata/testdata/supervisor.d/test1.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[program:tes1:]
directory=/home/www/server/test1
environment=LD_LIBRARY_PATH="/home/www/server/test1/lib",JUNO_TIME="189092893"
command=/home/www/server/test1/bin/test1 --host=0.0.0.1 --config=/home/www/.config/juno-agent/wsd-projecta-msg-srv-chatroom-tim-go/config/config-pre.toml
command=/home/www/server/test1/bin/test1 --host=0.0.0.1 --config=/home/www/.config/juno-agent/xxx/config/config-pre.toml
user=this is a change
autostart=true
autorestart=true
Expand Down
23 changes: 4 additions & 19 deletions testdata/testdata/systemd.d/test1.conf
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
[Unit]
Description=wsd-live-srv-demo-go
Documentation=wsd-live-srv-demo-go
Description=xxx
Documentation=xxx
After=network.target
Wants=network.target

[Service]
Environment="DY_APP_ID={{DY_APP_ID}}"
Environment="DY_APP_NAME=wsd-live-srv-demo-go"
Environment="DY_APP_HOME=/home/www/server"
Environment="DY_APP_HTTP_PORT={{DY_APP_HTTP_PORT}}"
Environment="DY_APP_RPC_PORT={{DY_APP_RPC_PORT}}"
Environment="DY_APP_LOG_DIR={{DY_APP_LOG_DIR}}"
Environment="DY_APP_ENV={{DY_APP_ENV}}"
Environment="DY_APP_LOG_DIR_TYPE={{DY_APP_LOG_DIR_TYPE}}"
Environment="DY_APP_CONTAINER={{DY_APP_CONTAINER}}"
Environment="DY_APP_REGION={{DY_APP_REGION}}"
Environment="DY_APP_ZONE={{DY_APP_ZONE}}"
Environment="DY_APP_MONITOR_PORT={{DY_APP_MONITOR_PORT}}"
Environment="DY_APP_SRC_GROUP={{DY_APP_SRC_GROUP}}"
Environment="DY_APP_SRC_REPO={{DY_APP_SRC_REPO}}"
Environment="DY_APP_SRC_VER={{DY_APP_SRC_VER}}"
Environment="DY_APP_REGISTRY_ENDPOINTS={{DY_APP_REGISTRY_ENDPOINTS}}"
Environment="APP_ID={{APP_ID}}"

User=www
Group=www
WorkingDirectory=/home/www/server

ExecStart=/home/www/server/bin/wsd-live-srv-demo-go --host=127.0.0.1 --config=/home/www/.config/juno-agent/agent-test/config/config-pre.toml
ExecStart=/home/www/server/bin/xxx --host=127.0.0.1 --config=/home/www/.config/juno-agent/agent-test/config/config-pre.toml
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process

Expand Down

0 comments on commit 2c104a7

Please sign in to comment.