This repo exists to answer a few questions I'm frequently asked regarding usage of multi-step builds, docker-compose, consul, and go-micro. Configuration is as follows:
-registry_address
to be consul.service.consul
and knowing it will
all Just Work™.This example uses the api, parts of srv, and cli components from the official micro greeter example. For details on each component, please review the original.
docker-compose up microapi
That's it. Seriously. The microapi
block is configured with dependencies on all other components
to provide a simple entry point.
In the docker-compose file, microapi
is bound to 8090 on the host. This allows for convenient curl
based testing.
❯ curl "localhost:8090/greeter/say/hello?name=John"
{"message":"Hello John"}
Log samples for the above request:
microapi_1 | 172.20.0.1 - - [21/Sep/2017:17:28:33 +0000] "GET /greeter/say/hello?name=John HTTP/1.1" 200 24 "" "curl/7.54.0"
api_1 | 2017/09/21 17:28:33 Received Say.Hello API request
srv_1 | 2017/09/21 17:28:33 Received Say.Hello request
vip_1 | 2017/09/21 17:28:23 Received VIP.CheckName request
vip_1 | 2017/09/21 17:28:23 is vip check false
consul is also launched with a ui, and bound to the host at 8500. Navigate to
http://localhost:8500/ui
to view the current running services.