Go micro 仪表板在 docker-compose 中运行时不会注册我的服务



我是go-micro的新手,试图在我的docker-compose设置中micro server作为另一个服务运行,但是我的第一个微服务没有显示在Micro Web(Go Micro仪表板(中。如果我在 docker-compose 之外运行micro server我可以在仪表板中看到几个与 go-micro 相关的微服务,但在 docker-compose 内部没有显示任何微服务。

我整理了一个示例代码来重现我的经历,我使用micro new生成了服务并且没有更改其中的任何内容,docker-compose.yml反映了我如何在我开始体验的项目中设置它:

https://github.com/shackra/go-micro-docker-compose-bug

我做错了什么,如何让微仪表板在 docker-compose 中按预期工作?

编辑

我在 docker 撰写中添加了一个网络,没有任何运气,也使我的示例服务可以在 docker 中编译。

编辑 2

如果我重新启动服务微抱怨它:

micro_1    | 2020-07-02 03:25:36  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:25:36 +0000] "GET /services HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1    | 2020-07-02 03:25:39  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:25:39 +0000] "GET /client HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1    | 2020-07-02 03:28:34  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:28:34 +0000] "GET /client HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1    | 2020-07-02 03:28:38  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:28:37 +0000] "GET /services HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
example_1  | 2020-07-02 03:30:55  file=grpc/grpc.go:791 level=info Deregistering node: go.micro.service.example-58b408cc-eec2-41a3-8d7f-5ac1751ad795
example_1  | 2020-07-02 03:30:55  file=grpc/grpc.go:814 level=info Unsubscribing from topic: go.micro.service.example
example_1  | 2020-07-02 03:30:55  file=grpc/grpc.go:959 level=info Broker [http] Disconnected from 127.0.0.1:45863
micro_1    | 2020-07-02 03:30:55  file=registry/registry.go:102 level=error service=api unable to get go.micro.service.example service: service not found
go-micro-docker-compose-bug_example_1 exited with code 0
micro_1    | 2020-07-02 03:30:58  file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = "transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused"","status":"Internal Server Error"})
micro_1    | 2020-07-02 03:31:08  file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = "transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused"","status":"Internal Server Error"})
micro_1    | 2020-07-02 03:31:18  file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = "transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused"","status":"Internal Server Error"})

我真的不明白,为什么它会报告没有找到服务和客户端,但仍然能够连接到我的服务?

似乎尽管Micro的仪表板什么也没显示,但如果我发出micro list services我的示例服务就会列出

然后,我从docker-compose.yml中删除了网络,停止了docker-compose并再次放置它,再次发出micro list services,我的示例服务包含在列表中。因此,这似乎是仪表板本身的错误。

最新更新