Jupiter是斗鱼开源的面向服务治理的Golang微服务框架

Overview

GoTest codecov go.dev reference Go Report Card license

JUPITER: Governance-oriented Microservice Framework

Introduction

JUPITER is a governance-oriented microservice framework, which is being used for years at Douyu.

Documentation

See the 中文文档 for the Chinese documentation.

Quick Start

func main() {
	var app jupiter.Application
	app.Startup()
	app.Serve(startHTTPServer())
	app.Serve(startGRPCServer())
	app.Schedule(startWorker())
	app.Run()
}

func startHTTPServer() server.Server {
	server := xecho.DefaultConfig().Build()
	server.GET("/hello", func(ctx echo.Context) error {
		return ctx.JSON(200, "Gopher Wuhan")
	})
	return server
}

func startGRPCServer() server.Server {
	server := xgrpc.DefaultConfig().Build()
	helloworld.RegisterGreeterServer(server.Server, new(greeter.Greeter))
	return server
}

func startWorker() worker.Worker {
	cron := xcron.DefaultConfig().Build()
	cron.Schedule(xcron.Every(time.Second*10), xcron.FuncJob(func() error {
		return nil
	}))
	return cron
}

More Example:

Bugs and Feedback

For bug report, questions and discussions please submit an issue.

Contributing

Contributions are always welcomed! Please see CONTRIBUTING for detailed guidelines.

You can start with the issues labeled with good first issue.

Contact

  • DingTalk:
Issues
  • [BUG] 当主机有多个网卡时,governor服务 panic

    [BUG] 当主机有多个网卡时,governor服务 panic

    F:\code\go\jupiter\example\http\register>go run main.go --config=config.toml

    panic:
       msg: governor start error
       loc: F:/code/go/jupiter/pkg/server/governor/server.go:23
       error: listen tcp4 169.254.98.129:19090: bind: The requested address is not valid in its context.
    1597118095      PANIC   governor start error                    {"error": "listen tcp4 169.254.98.129:19090: bind: The requested address is
    not valid in its context."}
    github.com/douyu/jupiter/pkg/xlog.(*Logger).Panic
           F:/code/go/jupiter/pkg/xlog/log.go:325
    github.com/douyu/jupiter/pkg/xlog.Panic
           F:/code/go/jupiter/pkg/xlog/api.go:65
    github.com/douyu/jupiter/pkg/server/governor.newServer
           F:/code/go/jupiter/pkg/server/governor/server.go:23
    github.com/douyu/jupiter/pkg/server/governor.(*Config).Build
           F:/code/go/jupiter/pkg/server/governor/config.go:67
    github.com/douyu/jupiter.(*Application).initGovernor
           F:/code/go/jupiter/jupiter.go:349
    github.com/douyu/jupiter/pkg/util/xgo.try
           F:/code/go/jupiter/pkg/util/xgo/init.go:47
    github.com/douyu/jupiter/pkg/util/xgo.SerialUntilError.func1
           F:/code/go/jupiter/pkg/util/xgo/serial.go:36
    github.com/douyu/jupiter.(*Application).startup.func1
           F:/code/go/jupiter/jupiter.go:145
    sync.(*Once).doSlow
           D:/Go/src/sync/once.go:66
    sync.(*Once).Do
           D:/Go/src/sync/once.go:57
    github.com/douyu/jupiter.(*Application).startup
           F:/code/go/jupiter/jupiter.go:135
    github.com/douyu/jupiter.(*Application).Startup
           F:/code/go/jupiter/jupiter.go:153
    main.NewEngine
           F:/code/go/jupiter/example/http/register/main.go:44
    
    
    opened by liyue201 12
  • [feat] support p2c with least loaded algorithm.

    [feat] support p2c with least loaded algorithm.

    Describe what this PR does / why we need it

    Grpc load balance support p2c with least loaded algorithm.

    ok  	github.com/douyu/jupiter/pkg/client/grpc/balancer/p2c	2.356s	coverage: 92.9% of statements
    

    Does this pull request fix one issue?

    Describe how you did it

    Describe how to verify it

    Special notes for reviews

    opened by hnlq715 12
  • unified stub and cluster configuration #65

    unified stub and cluster configuration #65

    Describe what this PR does / why we need it

    Unified redis single client and cluster client configuration

    Does this pull request fix one issue?

    Fixes #65

    Describe how you did it

    • rename redis.go to stub.go, redis_test.go to stub_test.go
    • add interface Redis and RedisConfig
    • make RedisStub and RedisClusterStub implement interface Redis
    • add function RawRedisConfig unified cluster and single configuration
    • compatible with past configuration

    Describe how to verify it

    example/client/redis/main.go run: go run main.go -config=config.toml

    Special notes for reviews

    • maybe we can clean old config if compatibility is not so important
    • remember to update doc, or leave it to me
    opened by OhBonsai 12
  • fix: update go mod version to go1.16

    fix: update go mod version to go1.16

    Describe what this PR does / why we need it

    在使用当前项目的 go.mod 规定的最小go版本,不能正确处理依赖相关的库。

    Does this pull request fix one issue?

    这个 pr 已经修复上述问题

    Describe how you did it

    修改 go.mod 最低支持的版本为 go1.16

    Describe how to verify it

    执行 go mod tidy

    Special notes for reviews

    opened by ywanbing 11
  • fix: 传入Variable时,flag重复调用导致失败

    fix: 传入Variable时,flag重复调用导致失败

    Describe what this PR does / why we need #it

    #281

    Does this pull request fix one issue?

    Describe how you did it

    Describe how to verify it

    Special notes for reviews

    opened by whileW 9
  • support apollo configuration center for datasource

    support apollo configuration center for datasource

    Describe what this PR does / why we need it

    Apollo is a very common and useful microservice configuration center.

    Does this pull request fix one issue?

    no

    Describe how you did it

    Refer to the rep apollo and agollo

    Describe how to verify it

    run go test

    Special notes for reviews

    enhancement good first issue to-review 
    opened by liyue201 9
  • [BUG]执行   go get -u github.com/douyu/jupiter/cmd/jupiter 出错

    [BUG]执行 go get -u github.com/douyu/jupiter/cmd/jupiter 出错

    Issue Description

    执行 go get -u github.com/douyu/jupiter/cmd/jupiter 报下面的错:

    github.com/douyu/jupiter/cmd/jupiter: ambiguous import: found package github.com/douyu/jupiter/cmd/jupiter in multiple modules: github.com/douyu/jupiter v0.3.2 (D:\Go\GoPath\pkg\mod\github.com\douyu\[email protected]\cmd\jupiter) github.com/douyu/jupiter/cmd/jupiter v0.0.0-20210716055700-612e8e9696ae (D:\Go\GoPath\pkg\mod\github.com\douyu\jupiter\cmd\[email protected])

    Describe what you expected to happen

    What version of Go are you using (go version)?

    1.16.4
    
    

    What operating system and processor architecture are you using (go env)?

    go env Output
    $ go env
    

    Anything else we need to know?

    opened by ytd7777 7
  • 关于grpc服务注册的server-name问题

    关于grpc服务注册的server-name问题

    // 2. 通过resolver获取服务器地址 func dialServer() { config := grpc.DefaultConfig() config = config.WithDialOption() config.Address = "etcd:///server-name" // 注意必须填写etcd:/// client := helloworld.NewGreeterClient(config.Build()) rep, err := client.SayHello(context.Background(), &helloworld.HelloRequest{ Name: "hi", }) }

    我看客户端通过 config.Address = "etcd:///server-name" 获取对应的grpc服务端信息,请问下服务端那边怎么指定这个server-name,我没有找到相关例子

    opened by tanjiancheng 6
  • example: add uuid server for example

    example: add uuid server for example

    Describe what this PR does / why we need it

    增加一个使用新模板的例子,实现 grpc 和 http 的 两种方式。

    Does this pull request fix one issue?

    Describe how you did it

    Describe how to verify it

    cd example/uuid

    jupiter run -c cmd/uuidserver/.jupiter.toml
    or go run .\cmd\uuidserver\main.go --config=./config/uuidserver-local-live.toml

    Special notes for reviews

    opened by ywanbing 5
  • WIP: Update config.toml

    WIP: Update config.toml

    Describe what this PR does / why we need it

    set logger async = false will be nice for developer, when i debug with etcd client and i can not get the result, because i need to wait for almost 30s for the log, but i do not kown that, this waste me last of time.

    Does this pull request fix one issue?

    Describe how you did it

    Describe how to verify it

    Special notes for reviews

    stale 
    opened by daydaygo 5
  • Feat/php2go

    Feat/php2go

    Describe what this PR does / why we need it

    add mongo config

    Does this pull request fix one issue?

    Describe how you did it

    Describe how to verify it

    Special notes for reviews

    stale 
    opened by mredencom 5
  • feat: replace defers with hooks package

    feat: replace defers with hooks package

    Issue Description

    Type: feature request

    Describe what feature you want

    Additional context

    Add any other context or screenshots about the feature request here.

    enhancement 
    opened by hnlq715 0
  • feat: support sentinel rules from etcd

    feat: support sentinel rules from etcd

    Issue Description

    Type: feature request

    Describe what feature you want

    Additional context

    Add any other context or screenshots about the feature request here.

    enhancement 
    opened by hnlq715 0
  • test: 补充xgrpc的单测用例,提升测试覆盖率

    test: 补充xgrpc的单测用例,提升测试覆盖率

    Issue Description

    Type: feature request

    Describe what feature you want

    Additional context

    Add any other context or screenshots about the feature request here.

    good first issue 
    opened by hnlq715 0
  • test: 补充xecho的单测用例,提升测试覆盖率

    test: 补充xecho的单测用例,提升测试覆盖率

    Issue Description

    Type: feature request

    Describe what feature you want

    Additional context

    Add any other context or screenshots about the feature request here.

    good first issue 
    opened by hnlq715 0
  • feat(cmd): add auto upgrade(#341)

    feat(cmd): add auto upgrade(#341)

    Describe what this PR does / why we need it

    Does this pull request fix one issue?

    Describe how you did it

    Describe how to verify it

    Special notes for reviews

    opened by ywanbing 4
  • [BUG]在配置中使用 redis 的单个地址并设置 addr 的时候报错

    [BUG]在配置中使用 redis 的单个地址并设置 addr 的时候报错

    Issue Description

    Type: bug report

    Describe what happened

    在配置中使用redis 的addr 进行配置,会报错

    [jupiter.redis.uuid]
        addr = "127.0.0.1:6379"
    

    Describe what you expected to happen

    没有问题,正常读取配置

    How to reproduce it (as minimally and precisely as possible)

    Tell us your environment

    What version of Go are you using (go version)?

    $ go version
    
    

    What operating system and processor architecture are you using (go env)?

    go env Output
    $ go env
    

    Anything else we need to know?

    good first issue 
    opened by ywanbing 0
Releases(v0.4.9)
Owner
Douyu
Douyu Open Source
Douyu