Mar 2, 2020

How we are maintaining ProtoBuf (Protocol Buffers) at Nuclei

We at Nuclei, welcome the latest technologies in our stack. We have our Micro Services in Java and Go Lang. I as a Full Stack Developer got an opportunity to completely build this system for us.### GitHub Actions + GitHub Package Registry + gRPC# **Problems which our solution solved!**1. Getting Go and Java artifacts at a swoosh2. Cost effective practice3. Robust Architecture4. Managing protocol buffer definitions at ease5. Generating the appropriate language files from the definitions6. Following Semantic Versioning along with Pre-Releases.# Challenges we faced.Managing proto files is a cumbersome task for both the user and the creator of the proto.Distributing it in a cost effective yet efficient method was another big task.Using JFrog Artifactory with Jenkins needed separate server to host.# How We Manage Protocol Buffer Files.We have a monorepo known as Protorepo where we keep our latest protocol buffer files.![](https://cdn-images-1.medium.com/max/4496/1*gj7PHDuRNdy84xw7Wy2ZhQ.png)# How do we build the Java and Go Lang code?We are using GitHub Actions + GitHub Package Registry.When one creates a new release. Let’s say version V1.0.0. It triggers our GitHub Action which generates GitHub Packages (Artifacts for Java) available for the other projects and it even pushes new releases with same versions for Go Lang according to the project name.# How do we pull dependencies?For java →```javaplugins { id("maven-publish")}publishing { repositories { maven { name = "GitHubPackages" url = uri("https://maven.pkg.github.com/USERNAME/URL") credentials { username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") password = project.findProperty("gpr.key") ?: System.getenv("PASSWORD") } } } publications { gpr(MavenPublication) { from(components.java) } }}```**For Go:** All the releases gets accumulated in a repository named **Proto-gen.**There all the Golang generated proto files are stored by releases. If a developer needs to use that proto file let’s say filename is foobar.pb.go. That project becomes a module in the **Proto-gen **repository. To get it one has to just pull it using the url followed by the version**\*example**: go get github.com/example-org/foobar@v1.0\*.0For Go →```gogo get go get github.com/CDNA-Technologies/proto-gen/go/proto/master-data```# How helpful it is?1. We are able to generate 30+ artifacts for Go as well as Java in less than 3 minutes.1. Building code and shipping it was never so quick and easy for us.1. All our Development Operations become even more easier.1. GitHub gives us storage and CI & CD minutes in our team plan, so why not use it.1. Data is safe and secured.

RELATED ARTICLES

No items found.
Written by
Full Name
Published on
22 January 2021

Get a free consultation on Segmentation strategy and
Ecosystem practices

Drop us a line.
Thank you! We'll be in touch soon.
Oops! Something went wrong while submitting the form.
Schedule a demo
Let’s Connect
We’ve received your request. We’ll be in touch soon.
Oops! Something went wrong while submitting the form.