Skip to content

Commit

Permalink
Merge pull request BuoyantIO#80 from BuoyantIO/grampelberg/tracing
Browse files Browse the repository at this point in the history
Updates for tracing tutorial
  • Loading branch information
grampelberg authored Nov 15, 2019
2 parents 02cea83 + bbed3a6 commit e12c8dd
Show file tree
Hide file tree
Showing 38 changed files with 623 additions and 1,110 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM buoyantio/emojivoto-svc-base:v8
FROM buoyantio/emojivoto-svc-base:v9

ARG svc_name

Expand Down
129 changes: 0 additions & 129 deletions Gopkg.lock

This file was deleted.

9 changes: 0 additions & 9 deletions Gopkg.toml

This file was deleted.

5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ deploy-to-docker-compose:
$(MAKE) -C emojivoto-voting-svc build-container
docker-compose -f ./docker-compose.yml up -d

integration-tests: deploy-to-docker-compose
WEB_URL=http://localhost:8080 $(MAKE) -C integration_test test
docker-compose stop
docker-compose rm -vf

push-%:
docker push buoyantio/emojivoto-$*:$(IMAGE_TAG)

Expand Down
75 changes: 44 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,33 @@ Deploy the application to Minikube using the Linkerd2 service mesh.

1. Install the `linkerd` CLI

```
```bash
curl https://run.linkerd.io/install | sh
```

2. Install Linkerd2
1. Install Linkerd2

```
```bash
linkerd install | kubectl apply -f -
```

3. View the dashboard!
1. View the dashboard!

```
```bash
linkerd dashboard
```

4. Inject, Deploy, and Enjoy
1. Inject, Deploy, and Enjoy

```
linkerd inject emojivoto.yml | kubectl apply -f -
```bash
kubectl kustomize kustomize/deployment | \
linkerd inject - | \
kubectl apply -f -
```

5. Use the app!
1. Use the app!

```
```bash
minikube -n emojivoto service web-svc
```

Expand All @@ -53,7 +55,7 @@ It's also possible to run the app with docker-compose (without Linkerd2).

Build and run:

```
```bash
make deploy-to-docker-compose
```

Expand All @@ -63,35 +65,39 @@ The web app will be running on port 8080 of your docker host.

The `VoteBot` service can generate some traffic for you. It votes on emoji
"randomly" as follows:

- It votes for :doughnut: 15% of the time.
- When not voting for :doughnut:, it picks an emoji at random

If you're running the app using the instructions above, the VoteBot will have
been deployed and will start sending traffic to the vote endpoint.

If you'd like to run the bot manually:
```

```bash
export WEB_HOST=localhost:8080 # replace with your web location
go run emojivoto-web/cmd/vote-bot/main.go
```

## Releasing a new version

To update the docker images:

1. Update the tag name in `common.mk`
2. Update the base image tags in `Makefile` and `Dockerfile`
3. Build base docker image `make build-base-docker-image`
4. Build docker images `make build`
5. Push the docker images to hub.docker.com
```bash
docker login
docker push buoyantio/emojivoto-svc-base:v8
docker push buoyantio/emojivoto-emoji-svc:v8
docker push buoyantio/emojivoto-voting-svc:v8
docker push buoyantio/emojivoto-web:v8
```
6. Update `emojivoto.yml`, `docker-compose.yml`
1. Update the base image tags in `Makefile` and `Dockerfile`
1. Build base docker image `make build-base-docker-image`
1. Build docker images `make build`
1. Push the docker images to hub.docker.com

```bash
docker login
docker push buoyantio/emojivoto-svc-base:v9
docker push buoyantio/emojivoto-emoji-svc:v9
docker push buoyantio/emojivoto-voting-svc:v9
docker push buoyantio/emojivoto-web:v9
```

1. Update `emojivoto.yml`, `docker-compose.yml`

## Local Development

Expand All @@ -101,30 +107,35 @@ This app is written with React and bundled with webpack.
Use the following to run the emojivoto go services and develop on the frontend.

Set up proto files, build apps
```

```bash
make build
```

Start the voting service
```

```bash
GRPC_PORT=8081 go run emojivoto-voting-svc/cmd/server.go
```

[In a separate terminal window] Start the emoji service
```

```bash
GRPC_PORT=8082 go run emojivoto-emoji-svc/cmd/server.go
```

[In a separate terminal window] Bundle the frontend assets
```

```bash
cd emojivoto-web/webapp
yarn install
yarn webpack # one time asset-bundling OR
yarn webpack-dev-server --port 8083 # bundle/serve reloading assets
```

[In a separate terminal window] Start the web service
```

```bash
export WEB_PORT=8080
export VOTINGSVC_HOST=localhost:8081
export EMOJISVC_HOST=localhost:8082
Expand All @@ -140,12 +151,14 @@ go run emojivoto-web/cmd/server.go
```

[Optional] Start the vote bot for automatic traffic generation.
```

```bash
export WEB_HOST=localhost:8080
go run emojivoto-web/cmd/vote-bot/main.go
```

View emojivoto
```

```bash
open http://localhost:8080
```
7 changes: 2 additions & 5 deletions common.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export IMAGE_TAG := v8
export IMAGE_TAG := v9

.PHONY: package protoc test

Expand All @@ -10,13 +10,10 @@ clean:
mkdir -p $(target_dir)
mkdir -p gen

dep:
dep ensure

protoc:
protoc -I .. ../proto/*.proto --go_out=plugins=grpc:gen

package: protoc dep compile build-container
package: protoc compile build-container

build-container:
docker build .. -t "buoyantio/$(svc_name):$(IMAGE_TAG)" --build-arg svc_name=$(svc_name)
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
web:
image: buoyantio/emojivoto-web:v8
image: buoyantio/emojivoto-web:v9
environment:
- WEB_PORT=8080
- EMOJISVC_HOST=emoji-svc:8080
Expand All @@ -15,22 +15,22 @@ services:
- emoji-svc

vote-bot:
image: buoyantio/emojivoto-web:v8
image: buoyantio/emojivoto-web:v9
entrypoint: emojivoto-vote-bot
environment:
- WEB_HOST=web:8080
depends_on:
- web

emoji-svc:
image: buoyantio/emojivoto-emoji-svc:v8
image: buoyantio/emojivoto-emoji-svc:v9
environment:
- GRPC_PORT=8080
ports:
- "8081:8080"

voting-svc:
image: buoyantio/emojivoto-voting-svc:v8
image: buoyantio/emojivoto-voting-svc:v9
environment:
- GRPC_PORT=8080
ports:
Expand Down
Loading

0 comments on commit e12c8dd

Please sign in to comment.