Legacy Setting up deployment for a new service - Arthyon/microservice-poc GitHub Wiki
To make a new service available you need to add some configuration. First the required build-pipeline and deploy must be created in Azure DevOps, then the Kubernetes-configuration must be updated in the repository.
Azure DevOps
A new build pipeline must be added, in addition to connecting this pipeline to the input artifacts in the deploy pipeline.
Adding a new build
The easiest way to do this is to clone an existing pipeline by selecting one, then choosing ... -> Clone.
- Change the name but leave the YAML file path as is
- Choose the
Get sources-step and change Tag format prefix to the new servicename - Change the variables
serviceNameandsourceRootto match the new service - Save and Queue
Connecting build to release
- Wait for the first build to complete so the Container registry is updated with the new image
- Edit the release pipeline (currently called Deploy) and
+ Adda new artifact. - Choose
Azure Container Repositoryand choose the available Service connection - Choose the correct image from the
Repository-field - Note the value in
Source alias, it is important later Add
If the new artifact should automatically trigger a deploy, click the small lightning icon and enable the trigger.
In the repository
The service must be set up in Infrastructure/kubernetes.yml to make Kubernetes manage and discover it.
Make note of these values to make it easier to set up:
- The
Source aliasfrom the previous step - The
nameof the service you added during development to docker-compose.yml and the gateway - The
serviceName-variable from the build pipeline
Start by copying one of the kind: Deployment-entries and one kind: Service.
Deployment
The version-label of the deployment is an environment variable during the deployment, and is on the form RELEASE_ARTIFACTS_{Source alias}_BUILDNUMBER. Add the source alias here, as well as in the container image.
NOTE: This will most likely use double underscore because the source alias contains an underscore.
The container image is on the form {registryName}/{serviceName}:{buildnumber}. registryName is common for all images, so this can stay as it is. serviceName is the variable from the build pipeline. Buildnumber is the variable from the previous paragraph.
Service
In the service-metadata, the name should be the same as the service name in the gateway, and the exposed ports should match the ones the service is listening to. Do not specify a type unless you want to expose it out of Kubernetes (should typically only be exposing the gateway).