Skip to content

Latest commit

 

History

History

gob

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

linkerd examples

Goals

  • Illustrate how to use linkerd and namerd in production-like environments
  • Have some fun

Non-goals

  • Implement a useful application
  • Provide exemplary Go code

The Application: Gob's Microservice

gob

Gob's program, from the television show Arrested Development, was a childish, inane program. So, naturally, we've turned it into a microservice web application that can be run at scale!

This application consists of several components:

  • web -- Gob's frontend -- serves plaintext
  • word -- chooses a word for web when one isn't provided
  • gen -- given a word and a limit, generates a stream of text

The web service is fairly simple (and entirely plaintext):

$ curl -s 'localhost:8080/'
Gob's web service!

Send me a request like:

  localhost:8080/gob

You can tell me what to say with:

  localhost:8080/gob?text=WHAT_TO_SAY&limit=NUMBER

web may call both word and gen to satisfy a request.

word and gen implement protobuf over gRPC.

All three services are implemented in Go with no shared code (except the generated proto file). They may be built and run independently.

Running locally

If you want to run these programs locally, you'll need to install Go 1.6 or later. Start all three services and send a request:

$ go run src/word/main.go &
$ go run src/gen/main.go &
$ go run src/web/main.go &

$ curl -s localhost:8080/gob?limit=1
banana

Running with docker-compose

You can also use the docker-compose file to run all three services with Docker. In the docker-compose environment, the services communicate with each other using linkerd and namerd, configured with the YAML files from the config directory of this project. To build and start all of the services:

$ docker-compose build
$ docker-compose up

Send a request to linkerd on port 4141, which will be routed to the web service (assuming you have the DOCKER_IP env variable set to your docker IP):

$ curl -s $DOCKER_IP:4141/gob?limit=1
illusion

Visit the linkerd admin dashboard at $DOCKER_IP:9990, and the namerd admin dashboard at $DOCKER_IP:9991.

Running remotely

This repo also provides configs for running the application in dc/os and kubernetes. These configs take advantage of pre-built Docker images published to [https://hub.docker.com/u/gobsvc/].