Skip to content

Commit

Permalink
feat: new deppkg api (#86)
Browse files Browse the repository at this point in the history
* deppkg list support POST
* update jupiter, support governor
  • Loading branch information
sysulq committed Jul 15, 2021
1 parent 43d3094 commit 7445813
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 66 deletions.
8 changes: 4 additions & 4 deletions api/apiv1/analysis/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ func TopologyRelationship(c echo.Context) error {
}

type ReqList struct {
PkgQs string `query:"pkgQs"`
AppName string `query:"app_name" json:"app_name"`
Operate string `query:"operate"`
Ver string `query:"ver"`
PkgQs string `query:"pkgQs" form:"pkgQs"`
AppName string `query:"app_name" form:"app_name"`
Operate string `query:"operate" form:"operate"`
Ver string `query:"ver" form:"ver"`
}

// 版本列表
Expand Down
17 changes: 8 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ go 1.14
require (
github.com/BurntSushi/toml v0.3.1
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/alibaba/sentinel-golang v0.4.0
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e
github.com/apache/rocketmq-client-go v0.0.0-20191211114916-85ee94b43cef
github.com/alibaba/sentinel-golang v0.6.0
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18
github.com/apache/rocketmq-client-go/v2 v2.0.0
github.com/arsmn/fiber-swagger/v2 v2.3.0
github.com/beeker1121/goque v2.1.0+incompatible
github.com/bojand/ghz v0.56.0
github.com/casbin/casbin/v2 v2.7.2
github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292
github.com/coreos/etcd v3.3.22+incompatible
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc // indirect
github.com/douyu/jupiter v0.2.4
github.com/douyu/jupiter v0.2.9
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/go-git/go-git/v5 v5.1.0
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df
Expand All @@ -26,7 +26,7 @@ require (
github.com/gofiber/fiber/v2 v2.5.0
github.com/golang/protobuf v1.4.2
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/go-cmp v0.4.0
github.com/google/go-cmp v0.5.1
github.com/gorilla/sessions v1.2.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/jhump/protoreflect v1.7.0
Expand All @@ -43,11 +43,10 @@ require (
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/onsi/ginkgo v1.12.3
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/pkg/errors v0.9.1
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff
github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.6.0
github.com/sirupsen/logrus v1.7.0
github.com/smartystreets/assertions v1.0.1 // indirect
github.com/spf13/cast v1.3.1
github.com/spf13/viper v1.6.3
Expand All @@ -60,8 +59,8 @@ require (
github.com/urfave/negroni v1.0.0
github.com/valyala/fasthttp v1.21.0 // indirect
go.uber.org/zap v1.15.0
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392
golang.org/x/lint v0.0.0-20200302205851-738671d3881b
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
Expand Down
357 changes: 324 additions & 33 deletions go.sum

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions internal/app/adminengine/engine_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"strconv"
"time"

"github.com/douyu/juno/internal/pkg/service/user"

"github.com/douyu/juno/api/apiv1/resource"
"github.com/douyu/juno/api/apiv1/test/platform"
"github.com/douyu/juno/api/apiv1/worker"
Expand All @@ -33,6 +31,7 @@ import (
"github.com/douyu/juno/internal/pkg/service/confgo"
"github.com/douyu/juno/internal/pkg/service/notify"
"github.com/douyu/juno/internal/pkg/service/openauth"
"github.com/douyu/juno/internal/pkg/service/user"
"github.com/douyu/juno/pkg/cfg"
"github.com/douyu/juno/pkg/constx"
"github.com/douyu/juno/pkg/pb"
Expand All @@ -41,6 +40,7 @@ import (
"github.com/douyu/jupiter/pkg/client/etcdv3"
jgrpc "github.com/douyu/jupiter/pkg/client/grpc"
"github.com/douyu/jupiter/pkg/flag"
"github.com/douyu/jupiter/pkg/server/governor"
"github.com/douyu/jupiter/pkg/server/xecho"
"github.com/douyu/jupiter/pkg/worker/xcron"
"github.com/douyu/jupiter/pkg/xlog"
Expand Down Expand Up @@ -82,14 +82,6 @@ func New() *Admin {
Action: func(name string, fs *flag.FlagSet) {},
})

flag.Register(&flag.StringFlag{
Name: "host",
Usage: "--host",
EnvVar: "Juno_Host",
Default: "",
Action: func(name string, fs *flag.FlagSet) {},
})

eng := &Admin{}
err := eng.Startup(
eng.parseFlag,
Expand Down Expand Up @@ -215,10 +207,18 @@ func (eng *Admin) serveGovern() (err error) {
if err != nil {
xlog.Panic(err.Error())
}

server := governor.RawConfig("server.govern").Build()
err = eng.Serve(server)

if err != nil {
return err
}

//eng.SetGovernor(cfg.Cfg.Server.Govern.Host + ":" + strconv.Itoa(cfg.Cfg.Server.Govern.Port))
err = client.Close()
if err != nil {
xlog.Panic(err.Error())
return err
}
return
}
Expand Down
1 change: 1 addition & 0 deletions internal/app/adminengine/router_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func apiV1(server *xecho.Server) {
analysisGroup.GET("/topology/list", analysis.TopologyList)
analysisGroup.GET("/topology/relationship", analysis.TopologyRelationship)
analysisGroup.GET("/deppkg/list", analysis.DependenceList)
analysisGroup.POST("/deppkg/list", analysis.DependenceList)
}

systemGroup := v1.Group("/system")
Expand Down
5 changes: 2 additions & 3 deletions internal/pkg/invoker/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package invoker
import (
"time"

rocketmq2 "github.com/apache/rocketmq-client-go"
"github.com/coreos/etcd/clientv3"
"github.com/douyu/juno/pkg/cfg"
"github.com/douyu/jupiter/pkg/client/rocketmq"
Expand All @@ -35,7 +34,7 @@ var (
Resty *resty.Client

// event producer
EventProducer rocketmq2.Producer
EventProducer *rocketmq.Producer
)

// Init invoker
Expand Down Expand Up @@ -71,7 +70,7 @@ func Init() {
mqConfig.Addr = config.Addr
mqConfig.DialTimeout = config.DialTimeout

EventProducer, err = mqConfig.Build()
EventProducer = mqConfig.Build()
if err != nil {
panic("init junoevnet producer failed. err=" + err.Error())
}
Expand Down
9 changes: 4 additions & 5 deletions internal/pkg/service/appevent/appevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import (

"github.com/douyu/juno/pkg/cfg"

"github.com/apache/rocketmq-client-go/primitive"

rocketmq2 "github.com/apache/rocketmq-client-go"
"github.com/apache/rocketmq-client-go/v2/primitive"
"github.com/douyu/jupiter/pkg/client/rocketmq"

"github.com/douyu/juno/pkg/model/view"

Expand All @@ -24,11 +23,11 @@ var (

type appEvent struct {
eventChan chan db.AppEvent
eventProducer rocketmq2.Producer
eventProducer *rocketmq.Producer
topic string
}

func InitAppEvent(eventProducer rocketmq2.Producer, topic string) *appEvent {
func InitAppEvent(eventProducer *rocketmq.Producer, topic string) *appEvent {
obj := &appEvent{
eventChan: make(chan db.AppEvent, 10000),
eventProducer: eventProducer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (w *localWorker) Init(o Option) {

queue, err := goque.OpenQueue(o.WorkerQueueDir)
if err != nil {
xlog.Panicf("init local worker queue failed")
xlog.Panicf("init local worker queue failed, %s, err=%s", o.WorkerQueueDir, err)
}
w.queue = queue

Expand Down

0 comments on commit 7445813

Please sign in to comment.