繁体   English   中英

Go 微型仪表板在 docker-compose 内部运行时未注册我的服务

[英]Go micro dashboard does not register my service when running inside docker-compose

我是 go-micro 的新手,试图在我的 docker-compose 设置中让micro server作为另一个服务运行,但是我的第一个微服务没有在 Micro Web(Go 微仪表板)中显示。 如果我在 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 ,我的示例服务包含在列表中。 所以,这似乎是仪表板本身的一个错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM