Skip to content

Commit

Permalink
Added gRPC logging stream server (#147)
Browse files Browse the repository at this point in the history
* Tmp

* Added buildservice proto

* Renamed build service

* Updated proto

* Added gRPC server implementation

* Reformatted

* Testing code

* GRPC impl

* Added link to docs

* Moved SQL gen to proper functions

* Small fixes

* Skip if buildID = 0

* Renamed api package to v5

* Added proto package name

* Moved HTTP and gRPC to their own files

* Updated CHANGELOG.md

* Added RETURNING to sqlite test

* Changed Codacy to ignore generated protobuf files

* Added alta/protopatch to set initialisms

* Error on fail to bind

* Updated CHANGELOG.md

* Updated CHANGELOG.md

* Update build.go

* Changed gRPC to not stream chunks

* Renamed LogID->WorkerLogID
  • Loading branch information
applejag authored Mar 3, 2022
1 parent ef5729e commit ae9081c
Show file tree
Hide file tree
Showing 16 changed files with 1,141 additions and 106 deletions.
2 changes: 2 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ engines:
enabled: true
exclude_paths:
- internal/deprecated/**
# Generated protobuf files
- api/wharfapi/*/*.pb.go
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.proto]
indent_size = 2
indent_style = space
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ This project tries to follow [SemVer 2.0.0](https://semver.org/).
- Added query parameter `?engine=ID` to `POST /api/project/{projectId}/build`
to allow specifying which execution engine to use for the new build. (#134)

- Added gRPC server (on the same port) for injecting logs in a single stream.
See [`api/wharfapi/v5/builds.proto`](./api/wharfapi/v5/builds.proto) for full
documentation of the API. (#147)

- Added granular migrations support. Thanks to this, wharf-api now initializes
much quicker as it can skip applying migrations that are already
applied. (#144)
Expand All @@ -50,7 +54,13 @@ This project tries to follow [SemVer 2.0.0](https://semver.org/).
the Sqlite database driver. The HTTP response model still uses the field name
`"token"`. (#144)

- Added dependency `github.com/go-gormigrate/gormigrate/v2` v2.0.0. (#144)
- Added numerous dependencies:

- `github.com/alta/protopatch` v0.5.0 (#147)
- `github.com/go-gormigrate/gormigrate/v2` v2.0.0. (#144)
- `github.com/soheilhy/cmux` v0.1.5 (#147)
- `google.golang.org/grpc` v1.44.0 (#147)
- `google.golang.org/protobuf` v1.27.1 (#147)

- Changed version of numerous dependencies:

Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: install tidy deps check \
docker docker-run serve swag-force swag \
docker docker-run serve swag-force swag proto \
lint lint-md lint-go \
lint-fix lint-fix-md lint-fix-go

Expand All @@ -23,6 +23,9 @@ deps:
go install github.com/mgechev/revive@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/swaggo/swag/cmd/swag@v1.8.0
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
go install github.com/alta/protopatch/cmd/protoc-gen-go-patch@v0.5.0
go mod download
npm install

Expand Down Expand Up @@ -63,6 +66,16 @@ swag: docs/docs.go
docs/docs.go:
swag init --parseDependency --parseDepth 1

proto:
protoc -I . \
-I `go list -m -f {{.Dir}} github.com/alta/protopatch` \
-I `go list -m -f {{.Dir}} google.golang.org/protobuf` \
--go-patch_out=plugin=go,paths=source_relative:. \
--go-patch_out=plugin=go-grpc,paths=source_relative:. \
./api/wharfapi/v5/builds.proto
# Generated files have some non-standard formatting, so let's format it.
goimports -w ./api/wharfapi/v5/.

lint: lint-md lint-go
lint-fix: lint-fix-md lint-fix-go

Expand Down
285 changes: 285 additions & 0 deletions api/wharfapi/v5/builds.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ae9081c

Please sign in to comment.