Example GoLang and Linkerd using Docker and Docker Compose
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
go-client
go-server
linkerd
README.md
docker-compose.yml
ping.sh

README.md

Example linkerd with Go grpc

We want to have lots of services and not much configuration. Sounds good. Hence linkerd. Specify resources and let linkerd handle the load balancing etc.

First, build the docker image for the Go grpc service locally as this will be referred to in the docker-compose file:

docker build -t go-server  ./go-server

Next, run docker-compose docker-compose up build. This spins up 2 of grpc servers.

Then, do some server calls using:

go run ./go-client/main.go

Visit the Linkerd admin/requests page.

To test you can run ./ping.sh [NUMBER], for example ./ping.sh 10 would call the service 10 times.

Voila.

To add more servers you will need to:

  • add new servers in the docker-compose.yml file like this, including a port:
      server-2:
       image: go-server
       container_name: server-2
       environment:
         - PORT=[YOUR_NEW_PORT]
       ports:
         - [YOUR_NEW_PORT]:[YOUR_NEW_PORT]
    
  • add image name and port to linkerd/disco/helloworld.Greeter