Hi,
We have a our primary codebase in Golang, and while scaling we want to have a micro-service for some of our tasks.
Major requirements:
- It will be modifying the images and upload to the s3 bucket
- It will be called from our primary server with some texts to be added in image
- In some of the request it should return the path of the image after uploading to S3
Done some research and was planning to achieve this goal using Grpc micro-service as it will be always be a server side call.
I am kind of confused that should I make a different repository for this micro-service or keep it in the same primary repository.
If can be in different repository need some help regarding how the both server will be able to communicate with each others
Hello,
Creating a separate repository for your gRPC microservice is a good practice as it allows for better modularity, maintainability, and scalability. This way, the microservice can be developed, tested, and deployed independently from the primary codebase.
To enable communication between your primary server and the microservice, you can follow these steps: NCEdCloud Login
- Define gRPC Protobufs: Create .proto files defining the gRPC service and messages.
- Generate Code: Use protoc to generate Golang code from the .proto files.
- Implement gRPC Service: Develop the microservice to handle image modification and S3 upload.
- Configure gRPC Client: In the primary server, create a gRPC client to call the microservice.
- Network Configuration: Ensure both services can communicate over the network, typically using service discovery or environment variables for endpoint configuration.
By doing this, your primary server can efficiently call the microservice, passing the necessary data and receiving responses.
Best Regards,
Jennifer Block
It sounds like starting small might be the best call here. I’ve done separate repos before as well as putting a few tightly-coupled microservices in the same repo. I’ve also used workspaces pretty effectively. I would just start with one repo (because it sounds like they will be VERY tightly coupled in the early stages at least) and expand if/when you feel you need it.
Your project structure won’t dictate how your microservices communicate with each other. If you’re using gRPC, start here: