harlow / go-micro-services

HTTP up front, Protobufs in the rear
MIT License
1.09k stars 165 forks source link

Add Consul for service discovery #25

Closed harlow closed 6 years ago

harlow commented 6 years ago

Previously the repository was using "links" in docker-compose to connect to the other services. To simulate a scenario where each service is run independently we can use Consul to allow the services to discover each other.

Addresses: #24

harlow commented 6 years ago

there may be an abstraction i'm missing here:

+   // geo client
+   geoAddrs, err := s.Registry.Service(geoName)
+   if err != nil {
+       return fmt.Errorf("geo address error: %v", err)
+   }
+   conn, err := tracing.Dialer(geoAddrs[0], s.Tracer)
+   if err != nil {
+       return fmt.Errorf("dialer error: %v", err)
+   }
+   s.geoClient = geo.NewGeoClient(conn)

seems like quite a bit of boiler-plate for creating a new client with addrs and tracer. will leave for now, but may tinker w/ this some more