forked from envoyproxy/ratelimit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Steve Sloka <[email protected]>
- Loading branch information
1 parent
bb55b1b
commit 990defc
Showing
30 changed files
with
241 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,8 @@ cover.out | |
bin/ | ||
.idea/ | ||
vendor | ||
cert.pem | ||
key.pem | ||
private.pem | ||
redis-per-second.conf | ||
redis.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
FROM golang:1.10.4 AS build | ||
WORKDIR /go/src/github.com/lyft/ratelimit | ||
FROM golang:1.14 AS build | ||
WORKDIR /ratelimit | ||
|
||
ENV GOPROXY=https://proxy.golang.org | ||
COPY go.mod go.sum /ratelimit/ | ||
RUN go mod download | ||
|
||
COPY src src | ||
COPY script script | ||
COPY vendor vendor | ||
COPY glide.yaml glide.yaml | ||
COPY glide.lock glide.lock | ||
COPY proto proto | ||
|
||
RUN script/install-glide | ||
RUN glide install | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o /usr/local/bin/ratelimit -ldflags="-w -s" -v github.com/lyft/ratelimit/src/service_cmd | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/ratelimit -ldflags="-w -s" -v github.com/envoyproxy/ratelimit/src/service_cmd | ||
|
||
FROM alpine:3.8 AS final | ||
FROM alpine:3.11 AS final | ||
RUN apk --no-cache add ca-certificates | ||
COPY --from=build /usr/local/bin/ratelimit /bin/ratelimit | ||
COPY --from=build /go/bin/ratelimit /bin/ratelimit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
ifeq ("$(GOPATH)","") | ||
$(error GOPATH must be set) | ||
endif | ||
export GO111MODULE=on | ||
MODULE = github.com/envoyproxy/ratelimit | ||
|
||
SHELL := /bin/bash | ||
GOREPO := ${GOPATH}/src/github.com/lyft/ratelimit | ||
|
||
.PHONY: bootstrap | ||
bootstrap: | ||
script/install-glide | ||
glide install | ||
go get github.com/golang/mock/[email protected] | ||
|
||
.PHONY: bootstrap_tests | ||
bootstrap_tests: | ||
cd ./vendor/github.com/golang/mock/mockgen && go install | ||
define REDIS_STUNNEL | ||
cert = private.pem | ||
pid = /var/run/stunnel.pid | ||
|
@@ -33,6 +27,7 @@ redis.conf: | |
echo "$$REDIS_STUNNEL" >> $@ | ||
redis-per-second.conf: | ||
echo "$$REDIS_PER_SECOND_STUNNEL" >> $@ | ||
|
||
.PHONY: bootstrap_redis_tls | ||
bootstrap_redis_tls: redis.conf redis-per-second.conf | ||
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \ | ||
|
@@ -51,27 +46,27 @@ docs_format: | |
.PHONY: fix_format | ||
fix_format: | ||
script/docs_fix_format | ||
go fmt $(shell glide nv) | ||
go fmt $(MODULE)/... | ||
|
||
.PHONY: check_format | ||
check_format: docs_format | ||
@gofmt -l $(shell glide nv | sed 's/\.\.\.//g') | tee /dev/stderr | read && echo "Files failed gofmt" && exit 1 || true | ||
@gofmt -l $(shell go list -f '{{.Dir}}' ./...) | tee /dev/stderr | read && echo "Files failed gofmt" && exit 1 || true | ||
|
||
.PHONY: compile | ||
compile: | ||
mkdir -p ${GOREPO}/bin | ||
cd ${GOREPO}/src/service_cmd && go build -o ratelimit ./ && mv ./ratelimit ${GOREPO}/bin | ||
cd ${GOREPO}/src/client_cmd && go build -o ratelimit_client ./ && mv ./ratelimit_client ${GOREPO}/bin | ||
cd ${GOREPO}/src/config_check_cmd && go build -o ratelimit_config_check ./ && mv ./ratelimit_config_check ${GOREPO}/bin | ||
mkdir -p ./bin | ||
go build -mod=readonly -o ./bin/ratelimit $(MODULE)/src/service_cmd | ||
go build -mod=readonly -o ./bin/ratelimit_client $(MODULE)/src/client_cmd | ||
go build -mod=readonly -o ./bin/ratelimit_config_check $(MODULE)/src/config_check_cmd | ||
|
||
.PHONY: tests_unit | ||
tests_unit: compile | ||
go test -race ./... | ||
go test -race $(MODULE)/... | ||
|
||
.PHONY: tests | ||
tests: compile | ||
go test -race -tags=integration ./... | ||
go test -race -tags=integration $(MODULE)/... | ||
|
||
.PHONY: docker | ||
docker: tests | ||
docker build . -t lyft/ratelimit:`git rev-parse HEAD` | ||
docker build . -t envoyproxy/ratelimit:`git rev-parse HEAD` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.