From d0cc272a1d7d23dc34aa2259c17ca0f16ea71afd Mon Sep 17 00:00:00 2001 From: John Ake Date: Mon, 2 Oct 2023 14:34:40 +0100 Subject: [PATCH] Replicate production env to AKS --- .github/workflows/build-and-deploy.yml | 24 +++++++++++++++++++ .github/workflows/database-copy.yml | 2 +- .github/workflows/restore-paas-db-to-aks.yml | 9 +++++++ .../production_aks.tfvars.json | 4 +++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index b6b21fc9..d0531d42 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -119,6 +119,30 @@ jobs: environment: ${{ matrix.environment }} azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + deploy_v2_production: + name: Deploy to production_aks environment + runs-on: ubuntu-latest + continue-on-error: true + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + environment: + name: production_aks + url: ${{ steps.deploy_v2.outputs.environment_url }} + concurrency: deploy_production_aks + needs: [docker, deploy_v2_nonprod] + + outputs: + environment_url: ${{ steps.deploy_v2.outputs.environment_url }} + + steps: + - uses: actions/checkout@v3 + - uses: ./.github/workflows/actions/deploy_v2 + id: deploy_v2 + with: + environment_name: production_aks + docker_image: ${{ needs.docker.outputs.docker_image }} + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + arm-access-key: ${{ secrets.ARM_ACCESS_KEY }} + deploy_nonprod: name: Deploy to ${{ matrix.environment }} environment runs-on: ubuntu-latest diff --git a/.github/workflows/database-copy.yml b/.github/workflows/database-copy.yml index f5c0eea9..09918f13 100644 --- a/.github/workflows/database-copy.yml +++ b/.github/workflows/database-copy.yml @@ -10,7 +10,7 @@ jobs: name: Restore DB strategy: matrix: - environment: [dev, test, preprod] + environment: [dev, test, preprod, production] max-parallel: 1 uses: ./.github/workflows/restore-paas-db-to-aks.yml with: diff --git a/.github/workflows/restore-paas-db-to-aks.yml b/.github/workflows/restore-paas-db-to-aks.yml index 3a69c2a1..74bcda40 100644 --- a/.github/workflows/restore-paas-db-to-aks.yml +++ b/.github/workflows/restore-paas-db-to-aks.yml @@ -13,6 +13,7 @@ on: - dev - test - preprod + - production env: BACKUP_ARTIFACT_NAME: ${{ inputs.environment }}-backup @@ -86,6 +87,9 @@ jobs: preprod) echo "ENVIRONMENT_AKS=preproduction_aks" >> $GITHUB_OUTPUT ;; + production) + echo "ENVIRONMENT_AKS=production_aks" >> $GITHUB_OUTPUT + ;; *) echo "unknown cluster" ;; @@ -133,6 +137,11 @@ jobs: echo "cluster_name=$test_cluster_name" >> $GITHUB_ENV echo "app_name=find-a-lost-trn-preproduction" >> $GITHUB_ENV ;; + production_aks) + echo "cluster_rg=$production_cluster_rg" >> $GITHUB_ENV + echo "cluster_name=$production_cluster_name" >> $GITHUB_ENV + echo "app_name=find-a-lost-trn-production" >> $GITHUB_ENV + ;; *) echo "unknown cluster" ;; diff --git a/terraform/aks/workspace_variables/production_aks.tfvars.json b/terraform/aks/workspace_variables/production_aks.tfvars.json index 9e0c6a86..c55ae080 100644 --- a/terraform/aks/workspace_variables/production_aks.tfvars.json +++ b/terraform/aks/workspace_variables/production_aks.tfvars.json @@ -1,10 +1,12 @@ { "app_environment": "production", "cluster": "production", + "file_environment": "prod", "enable_monitoring": false, "namespace": "tra-production", "azure_resource_prefix": "s189p01", "config_short": "pd", "service_short": "faltrn", - "app_key_vault": "s189p01-faltrn-pp-app-kv" + "app_key_vault": "s189p01-faltrn-pd-app-kv", + "worker_replicas": 0 }