feat: add gRPC gateway for internal reads - #599
Closed
believetimothy wants to merge 3 commits into
Closed
Conversation
- Add proto/stellabill/v1/*.proto with PlanService and SubscriptionService - Configure buf for Go stub generation - Implement gRPC server with TLS/mTLS support - Add auth interceptor reusing existing TokenVerifier interface - Implement PlanService/SubscriptionService with cursor pagination - Add grpc-gateway REST proxy on separate port - Update cmd/server/main.go to start gRPC+gateway alongside REST - Add GRPC_PORT, GRPC_CERT_FILE, GRPC_KEY_FILE, etc. to config - Write 32 unit tests covering services, auth, server lifecycle - Document architecture, config, and usage in docs/grpc-gateway.md - Add proto-gen/proto-lint Makefile targets Closes Stellabill#411
|
@believetimothy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
believetimothy
had a problem deploying
to
preview-599
July 30, 2026 04:14 — with
GitHub Actions
Failure
believetimothy
had a problem deploying
to
preview-599
August 2, 2026 16:36 — with
GitHub Actions
Failure
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #411
Summary
Add gRPC gateway alongside the existing REST API for internal service-to-service calls. Protobuf definitions for PlanService and SubscriptionService are defined in
proto/stellabill/v1/withgoogle.api.httpannotations so grpc-gateway generates REST handlers from the same proto. The gRPC server runs on a configurable separate port with optional mTLS, while the public REST surface remains unchanged.Architecture
New Files
proto/stellabill/v1/plans.protoproto/stellabill/v1/subscriptions.protobuf.yamlbuf.gen.yamlgen/stellabill/v1/*.pb.gogen/stellabill/v1/*_grpc.pb.gogen/stellabill/v1/*.pb.gw.gogen/openapiv2/stellabill.swagger.jsoninternal/grpc/server.gointernal/grpc/plans.gointernal/grpc/subscriptions.gointernal/grpc/interceptor.gointernal/grpc/wrapper.gointernal/grpc/plans_test.gointernal/grpc/subscriptions_test.gointernal/grpc/server_test.godocs/grpc-gateway.mdModified Files
cmd/server/main.gointernal/config/config.goGRPC_PORT,GRPC_CERT_FILE,GRPC_KEY_FILE,GRPC_CA_CERT_FILE,GRPC_ENABLE_TLSMakefileproto,proto-gen,proto-linttargetsConfiguration
GRPC_PORT00= disabled)GRPC_CERT_FILE""GRPC_KEY_FILE""GRPC_CA_CERT_FILE""GRPC_ENABLE_TLSfalseWhen
GRPC_PORTis set > 0, the grpc-gateway REST proxy is automatically started onGRPC_PORT + 1.Tests
32 tests pass ✅
Pre-existing Issues Fixed
The following compilation errors existed in the repo and were fixed as part of this work:
internal/auth/spiffe.go— Updated SPIFFE API for go-spiffe v2.6.0internal/repository/models.go— AddedUpdatedAt,Versionfieldsinternal/repository/interfaces.go— AddedErrConcurrentUpdateinternal/middleware/webhook_verification.go— Removed duplicate const blockinternal/middleware/middleware.go— Removed unusedcontextimportinternal/logger/logger.go— AddedSafePrintffunctioninternal/middleware/idempotency_store.go— AddedLookupmethodinternal/service/statement_service.go— AddedExportStatementsstubinternal/outbox/— Fixed duplicate type, missing import, HTTP client type mismatchinternal/handlers/tenant_export.go— AddedExportOperationResponsetypeCommands