docs/adding-new-microservice.md
This document outlines the steps required to add a new microservice to the Online Boutique application.
Create a new directory for your microservice within the src/ directory. The directory name should be the name of your microservice.
Place your microservice's source code inside the newly created directory. The structure of this directory should follow the conventions of the existing microservices. For example, a Python-based service would include at minimum the following files:
README.md: The service's description and documentation.main.py: The application's entry point.requirements.in: A list of Python dependencies.Dockerfile: To containerize the application.Take a look at existing microservices for inspiration.
Create a Dockerfile in your microservice's directory. This file will define the steps to build a container image for your service.
Refer to this example and tweak based on your new service's needs: https://github.com/GoogleCloudPlatform/microservices-demo/blob/main/src/frontend/Dockerfile
Create a new directory under kustomize/components/ in the root of the repository for your microservice. Inside this directory, add the necessary Kubernetes YAML files for your new microservice. This typically includes:
Ensure you follow the existing naming conventions and that the container image specified in the Deployment matches the one built by your cloudbuild.yaml and skaffold.yaml files.
Refer to this example and tweak based on your new service's needs: https://github.com/GoogleCloudPlatform/microservices-demo/tree/main/kustomize/components/shopping-assistant
kustomization.yaml fileAdd your newly created component to the root kustomization file so it gets picked up by the deployment cycle.
The file is available here: https://github.com/GoogleCloudPlatform/microservices-demo/blob/main/kustomize/kustomization.yaml
skaffold.yamlAdd your newly created service to the root skaffold file so the images build correctly.
The file is available here: https://github.com/GoogleCloudPlatform/microservices-demo/blob/main/skaffold.yaml
Add your newly created service to the Helm chart templates and default values.
The chart is available here: https://github.com/GoogleCloudPlatform/microservices-demo/tree/main/helm-chart
Finally, update the project's documentation to reflect the addition of your new microservice. This may include:
README.md if the service introduces significant new functionality.docs/img directory.docs directory if the service requires detailed explanation.