Legacy Setting up a new environment - Arthyon/microservice-poc GitHub Wiki

This guide describes how to set up a new environment to deploy to.

Source code

In the gateway, a new file called env.{environment}.ini must be created which specifies the public url of the Kubernetes cluster and the fallbackurl for services that are not found (which will route to the existing monolith). This file is not optional, and the gateway will crash at runtime if the file does not exist.

This will most likely be a two step process, as we need to deploy once to get Kubernetes to provision a new public ip for our gateway.

Kubernetes

A namespace must be created that equals the name of the release stage specified in Azure DevOps. This must be done before creating the first release, because the Kubernetes-task is scoped to a namespace before running any commands. If the namespace does not exist, the deploy will fail.

Run kubectl create namespace <namespace name> to create it. Namespaces must be lower case.

Azure DevOps

To start with, edit the release pipeline. Clone an existing stage to get started, then click the lightning bolt to set up Pre-deployment conditions. The stage should most likely be run after another stage, and possibly with some approval scheme.

Change the stage name to the same as the Kubernetes namespace from the previous step.

You want to remove the task that creates a github release if you cloned the preprod-stage. We should not create new releases for each environment.

Some services need environment variables. Go to the Variables-tab. You will see that a copy of all variables have been created with the correct scope. Change the values to match your environment.