3

I'm new to go-micro, tried to have micro server running as another service in my docker-compose setup however my first micro-service is not getting show in Micro Web (the Go Micro dashboard). If I run micro server outside docker-compose I can see several go-micro-related micro-services in the dashboard, but inside docker-compose none is displayed.

I have put together an example code that reproduces what I experience, I generated the service using micro new and changed nothing in it, the docker-compose.yml reflects how I have it setup in my project where I began experiencing this:

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

What am I doing wrong and how do I get the Micro dashboard to work as expected inside docker-compose?

EDIT

I have added a network in docker compose without any luck, also made my example service compilable inside docker.

EDIT 2

if I restart the service micro complains about it:

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"})

I don't really get it, why would it report no services nor clients were found but still being able to connect with my service?

shackra
  • 277
  • 3
  • 16
  • 56
  • Services inside docker run in a separate network environment. Are you aware of this? – baldr Jul 01 '20 at 14:56
  • @baldr I am but it seems that micro can point to the IP of my service as if I restart my service Micro complains it cannot connect to it again ("connection refused" is the error) – shackra Jul 01 '20 at 16:16
  • address the service by its name, not IP? I am not sure I understand the problem right, so just commenting here. – baldr Jul 01 '20 at 16:41
  • @baldr by IP, let me edit my question so you can see what I mean – shackra Jul 01 '20 at 20:10
  • @baldr is weird but I wasn't unable to reproduce micro's complaint is being unable to connect to my service after restarting the service. – shackra Jul 01 '20 at 20:30
  • 2
    create a docker network ("bridge" type) and assign it to both services in compose file. Your services should be able to see each other by their container names. – baldr Jul 01 '20 at 20:40
  • @baldr I will be back to you when I'm able to compile my service inside Docker so I can test this with more confidence – shackra Jul 02 '20 at 02:33
  • @baldr added a network as you asked but `micro server` shoes no client or service in localhost:8082; I did update the source code of the example linked in my question if you want to check that out – shackra Jul 02 '20 at 03:27

1 Answers1

0

it seems that despite micro's dashboard showing nothing, if I issue micro list services my example service is listed

I then removed the network from the docker-compose.yml, stopped docker-compose and put it up again, issued micro list services again and my example service was included in the listing. So, this seems to be a bug with the dashboard itself.

shackra
  • 277
  • 3
  • 16
  • 56