Skip to content

Commit

Permalink
Merge pull request #276 from pace/grpc
Browse files Browse the repository at this point in the history
add grpc client and server middleware setup code
  • Loading branch information
Ferlonas authored Sep 24, 2021
2 parents 54b8e89 + 54490e1 commit 8539fd3
Show file tree
Hide file tree
Showing 2,356 changed files with 438,332 additions and 17,608 deletions.
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GOPATH?=~/go

GO:=go
GO_TEST_FLAGS:=-mod=vendor -count=1 -v -cover -race
PROTO_TMP:=$(shell pwd)/proto.tmp

export JAEGER_SERVICE_NAME:=unittest
export JAEGER_SAMPLER_TYPE:=const
Expand Down Expand Up @@ -37,11 +38,19 @@ jsonapi:
-path tools/testserver/simple/open-api.go \
-source tools/testserver/simple/open-api.json

lint: $(GOPATH)/bin/golangci-lint
$(GOPATH)/bin/golangci-lint run
grpc: tools/testserver/math/math.pb.go

$(GOPATH)/bin/golangci-lint:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.21.0
tools/testserver/math/math.pb.go: tools/testserver/math/math.proto
mkdir -p $(PROTO_TMP)
GOBIN=$(PROTO_TMP) $(GO) install -mod=vendor google.golang.org/grpc/cmd/protoc-gen-go-grpc
GOBIN=$(PROTO_TMP) $(GO) install -mod=vendor google.golang.org/protobuf/cmd/protoc-gen-go
protoc --plugin=$(PROTO_TMP)/protoc-gen-go-grpc \
--plugin=$(PROTO_TMP)/protoc-gen-go \
-I=./ --go-grpc_out=$(dir @) --go_out=$(dir @) $<
rm -rf $(PROTO_TMP)

lint:
$(GO) run -mod=vendor github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout 2m

test:
$(GO) test $(GO_TEST_FLAGS) -short ./...
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ A pace/bricks microservice is:
* **http** (logging, metrics, tracing, retries)
* **s3** via http (logging, metrics, tracing, health)
* **couchdb** via http (logging, metrics, tracing, retries, health)
* **grpc** (logging, metrics, tracing, retries)
* provides two commands **control** and **daemon**
* provides a **RESTful** API
* code is generated from the **OpenAPIv3** spec
* authenticated via **OAuth2**
* encoded using **[json:api](https://jsonapi.org/)**
* that supports **logging**, **tracing** and **metrics**
* optionally provides a **GRPC** API
* code is generated from the **protoc** spec
* that supports **logging**, **tracing** and **metrics**

## Install

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ services:
working_dir: /srv
ports:
- "3000:3000"
- "3001:3001"
environment:
- JAEGER_AGENT_HOST=jaeger
- JAEGER_SAMPLER_TYPE=const
Expand Down
28 changes: 13 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,48 @@ replace github.com/adjust/rmq/v3 => github.com/daemonfire300/rmq/v3 v3.0.2
require (
github.com/adjust/rmq/v3 v3.0.0
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/bsm/redislock v0.5.0
github.com/caarlos0/env v3.3.0+incompatible
github.com/certifi/gocertifi v0.0.0-20180118203423-deb3ae2ef261
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
github.com/dave/jennifer v1.0.2
github.com/getkin/kin-openapi v0.0.0-20180813063848-e1956e8013e5
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-kivik/couchdb/v3 v3.2.6
github.com/go-kivik/kivik/v3 v3.2.3
github.com/go-pg/pg v6.14.5+incompatible
github.com/go-redis/redis/v7 v7.4.1
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/mux v1.6.2
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/golangci/golangci-lint v1.42.0
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a // indirect
github.com/jpillora/backoff v1.0.0
github.com/mattn/go-isatty v0.0.11
github.com/mattn/go-isatty v0.0.12
github.com/mattn/goveralls v0.0.9
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/minio/minio-go/v7 v7.0.7
github.com/opentracing/opentracing-go v1.0.2
github.com/opentracing/opentracing-go v1.1.0
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v0.8.0
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e // indirect
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 // indirect
github.com/prometheus/client_golang v1.7.1
github.com/rs/xid v1.2.1
github.com/rs/zerolog v1.17.2
github.com/shopspring/decimal v0.0.0-20200105231215-408a2507e114
github.com/sony/gobreaker v0.4.1
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.2 // indirect
github.com/spf13/cobra v1.2.1
github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
github.com/uber-go/atomic v1.3.2 // indirect
github.com/uber/jaeger-client-go v2.14.0+incompatible
github.com/uber/jaeger-lib v1.5.0
github.com/zenazn/goji v0.9.0
golang.org/x/mod v0.5.0 // indirect
golang.org/x/tools v0.1.5
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
google.golang.org/genproto v0.0.0-20210719143636-1d5a45f8e492 // indirect
google.golang.org/grpc v1.39.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0
google.golang.org/protobuf v1.27.1
)

replace github.com/codahale/hdrhistogram => github.com/HdrHistogram/hdrhistogram-go v0.9.0
Loading

0 comments on commit 8539fd3

Please sign in to comment.