I'm new to the world of gRPC
and Protocol Buffers
but I really want to setup convenient environment for development with gRPC
. I use microservices (basically SOA) architecture with multi-repo style (please don't ask why - I don't want to discuss my choice). So I came through some questions about structure of project with gRPC
, that's what I have now:
Schema
which has Protos
repository. There are only .proto
files, build script
(simple shell script that compiles all proto files and push result to their own repos), .protolangs
file (so that build script
will understand what languages have to be compiled) and CI configuration
file.proto
files (with inner folders for every languages). IMHO: that's better to have only several submodules
instead of one but with all compiled .proto
files in every servicegit submodules
of repos with compiled .proto
files (golang, nodejs, etc.) to communicate with each otherSo what is my question?
In Protos
repository several folders (for each service with .proto
files) of this kind:
$ tree
.
├── README.md
├── .gitignore
├── .gitlab-ci.yml
├── build.sh
├── api
│ ├── .protolangs
│ ├── api.proto
│ └── common.proto
└── user
├── .protolangs
├── common.proto
├── user.info.proto
└── user.proto
I want to separate .proto
files so that I will have common.proto
and .proto
for every inner logic of my service (like: info, entry, etc.). With nodejs
everything fine - just compile whole folder. But when I do compile for golang
- it can not import by relative path. Now I think to write simple tool that will collect all .proto
files, generate only one and then compile it. But is there any better way to deal with it?
P.S: I use gitlab so subgroups may not be available in some git providers.
P.P.S: I will be very appreciated for all recommendations to improve this structure
P.P.P.S: I read this article from Namely
and I liked it. So my structure may be similar with structure from article above