diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..dd2969ad --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,31 @@ +name: Main +on: + push: + branches: + - main + +jobs: + dev: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.20" + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Publish dev image + id: docker_dev_build + uses: docker/build-push-action@v2 + with: + push: true + file: "./Dockerfile.dev" + tags: raystack/compass:dev diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 00000000..a9634f3d --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,17 @@ +FROM golang:1.20-alpine3.17 as builder +RUN apk add make +WORKDIR /build/ +COPY . . +RUN make build + +FROM alpine:3.17 + +COPY --from=builder /build/compass /usr/bin/compass +RUN apk update +RUN apk add ca-certificates + +# glibc compatibility library, since go binaries +# don't work well with musl libc that alpine uses +RUN apk add libc6-compat + +ENTRYPOINT ["compass"] \ No newline at end of file diff --git a/Makefile b/Makefile index 4c9bc5b2..a41b9590 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ coverage: test ## Print the code coverage build: ## Build the compass binary @echo "Building guardian version ${VERSION}..." - go build -ldflags "-X ${NAME}/cli.Version=${VERSION}" + CGO_ENABLED=0 go build -ldflags "-X ${NAME}/cli.Version=${VERSION}" @echo "Build complete" buildr: setup diff --git a/internal/server/server.go b/internal/server/server.go index 205b4529..e38eca1a 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -90,6 +90,8 @@ func Serve( // init grpc grpcServer := grpc.NewServer( + grpc.MaxRecvMsgSize(config.GRPC.MaxRecvMsgSize), + grpc.MaxSendMsgSize(config.GRPC.MaxSendMsgSize), grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer( grpc_recovery.UnaryServerInterceptor(), grpc_ctxtags.UnaryServerInterceptor(), @@ -160,8 +162,8 @@ func Serve( ctx, mux.WithHTTPTarget(config.addr(), &http.Server{ Handler: gwmux, - ReadTimeout: 5 * time.Second, - WriteTimeout: 10 * time.Second, + ReadTimeout: 60 * time.Second, + WriteTimeout: 60 * time.Second, IdleTimeout: 120 * time.Second, }), mux.WithGRPCTarget(config.grpcAddr(), grpcServer),