From 6909a57e838b2aa42212a78dd62d3f0a7883c3fc Mon Sep 17 00:00:00 2001 From: Steven Fawcett Date: Wed, 23 Sep 2020 13:24:21 +0100 Subject: [PATCH 1/3] Added Production Checks --- .github/workflows/statuscake.yml | 2 +- terraform/statuscake/dev.bk.vars | 4 ---- terraform/statuscake/dev.env.tfvars | 12 ------------ terraform/statuscake/production.bk.vars | 4 ---- terraform/statuscake/production.env.tfvars | 12 ------------ terraform/statuscake/test.env.tfvars | 12 +++++++++++- 6 files changed, 12 insertions(+), 34 deletions(-) delete mode 100644 terraform/statuscake/dev.bk.vars delete mode 100644 terraform/statuscake/dev.env.tfvars delete mode 100644 terraform/statuscake/production.bk.vars delete mode 100644 terraform/statuscake/production.env.tfvars diff --git a/.github/workflows/statuscake.yml b/.github/workflows/statuscake.yml index a69b58bd8..b1ee49616 100644 --- a/.github/workflows/statuscake.yml +++ b/.github/workflows/statuscake.yml @@ -1,4 +1,4 @@ -name: Deploy Status Cake (Beta Test) +name: Deploy Status Cake on: workflow_dispatch: diff --git a/terraform/statuscake/dev.bk.vars b/terraform/statuscake/dev.bk.vars deleted file mode 100644 index 7a97ef141..000000000 --- a/terraform/statuscake/dev.bk.vars +++ /dev/null @@ -1,4 +0,0 @@ -storage_account_name = "s146d01sgtfstate" -key="api_statuscake.dev.terraform.tfstate" - - diff --git a/terraform/statuscake/dev.env.tfvars b/terraform/statuscake/dev.env.tfvars deleted file mode 100644 index 4a75d17b9..000000000 --- a/terraform/statuscake/dev.env.tfvars +++ /dev/null @@ -1,12 +0,0 @@ -alerts = { -ftt = { - website_name = "get-teacher-training-API (Development)" - website_url = "https://get-into-teaching-api-dev.london.cloudapps.digital/api/operations/health_check" - test_type = "HTTP" - check_rate = 300 - contact_group = [185038] - trigger_rate = 0 - custom_header = "{\"Content-Type\": \"application/x-www-form-urlencoded\"}" - status_codes = "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599" - } -} diff --git a/terraform/statuscake/production.bk.vars b/terraform/statuscake/production.bk.vars deleted file mode 100644 index 58fd126cf..000000000 --- a/terraform/statuscake/production.bk.vars +++ /dev/null @@ -1,4 +0,0 @@ -storage_account_name="s146t01sgtfstate" -key="api_statuscake.production.terraform.tfstate" - - diff --git a/terraform/statuscake/production.env.tfvars b/terraform/statuscake/production.env.tfvars deleted file mode 100644 index f350b48ab..000000000 --- a/terraform/statuscake/production.env.tfvars +++ /dev/null @@ -1,12 +0,0 @@ -alerts = { -ftt = { - website_name = "Get Teacher Training API (Production)" - website_url = "https://get-into-teaching-api-production.london.cloudapps.digital/api/operations/health_check" - test_type = "HTTP" - check_rate = 60 - contact_group = [185037] - trigger_rate = 0 - custom_header = "{\"Content-Type\": \"application/x-www-form-urlencoded\"}" - status_codes = "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599" - } -} diff --git a/terraform/statuscake/test.env.tfvars b/terraform/statuscake/test.env.tfvars index 5414fc326..b4c7b9a71 100644 --- a/terraform/statuscake/test.env.tfvars +++ b/terraform/statuscake/test.env.tfvars @@ -1,6 +1,6 @@ alerts = { ftt = { - website_name = "Get Teacher Training API (Beta test)" + website_name = "Get Teacher Training API (Test Space)" website_url = "https://get-into-teaching-api-test.london.cloudapps.digital/api/operations/health_check" test_type = "HTTP" check_rate = 60 @@ -9,4 +9,14 @@ ftt = { custom_header = "{\"Content-Type\": \"application/x-www-form-urlencoded\"}" status_codes = "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599" } +ptt = { + website_name = "Get Teacher Training API (Production Space)" + website_url = "https://get-into-teaching-api-prod.london.cloudapps.digital/api/operations/health_check" + test_type = "HTTP" + check_rate = 60 + contact_group = [185037] + trigger_rate = 0 + custom_header = "{\"Content-Type\": \"application/x-www-form-urlencoded\"}" + status_codes = "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599" + } } From 2297b9a8bfde16c4e6af5902116d1a074fc81b4c Mon Sep 17 00:00:00 2001 From: Steven Fawcett Date: Mon, 28 Sep 2020 09:09:10 +0100 Subject: [PATCH 2/3] There should only be one API in each CF Space --- terraform/paas/dev.env.tfvars | 4 +--- terraform/paas/test.env.tfvars | 2 -- terraform/paas/ur.bk.vars | 2 -- terraform/paas/ur.env.tfvars | 10 ---------- 4 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 terraform/paas/ur.bk.vars delete mode 100644 terraform/paas/ur.env.tfvars diff --git a/terraform/paas/dev.env.tfvars b/terraform/paas/dev.env.tfvars index 0f80d0561..268740eac 100644 --- a/terraform/paas/dev.env.tfvars +++ b/terraform/paas/dev.env.tfvars @@ -4,7 +4,5 @@ paas_database_2_name="get-into-teaching-api-dev-pg2-svc" paas_redis_1_name= "get-into-teaching-dev-redis-svc" paas_api_application_name="get-into-teaching-api" paas_api_route_name="get-into-teaching-api-dev" -application_instances=3 - -CRM_SERVICE_URL="https://gitis-dev.api.crm4.dynamics.com" +application_instances=1 ASPNETCORE_ENVIRONMENT="Staging" diff --git a/terraform/paas/test.env.tfvars b/terraform/paas/test.env.tfvars index fde28bdfd..c1250730a 100644 --- a/terraform/paas/test.env.tfvars +++ b/terraform/paas/test.env.tfvars @@ -5,6 +5,4 @@ paas_redis_1_name ="get-into-teaching-test-redis-svc" paas_api_application_name="get-into-teaching-api-test" paas_api_route_name="get-into-teaching-api-test" paas_logging_endpoint_port="syslog-tls://89d7be0f-ddcd-437e-ad3c-c8125d0bad00-ls.logit.io:18190" - -CRM_SERVICE_URL="https://gitis-dev.api.crm4.dynamics.com" ASPNETCORE_ENVIRONMENT="Staging" diff --git a/terraform/paas/ur.bk.vars b/terraform/paas/ur.bk.vars deleted file mode 100644 index efbc88f26..000000000 --- a/terraform/paas/ur.bk.vars +++ /dev/null @@ -1,2 +0,0 @@ -storage_account_name = "s146t01sgtfstate" -key="api.ur.terraform.tfstate" diff --git a/terraform/paas/ur.env.tfvars b/terraform/paas/ur.env.tfvars deleted file mode 100644 index 80eab8ab5..000000000 --- a/terraform/paas/ur.env.tfvars +++ /dev/null @@ -1,10 +0,0 @@ -paas_space="get-into-teaching-test" -paas_database_1_name="get-into-teaching-api-ur-pg1-svc" -paas_database_2_name="get-into-teaching-api-ur-pg2-svc" -paas_redis_1_name ="get-into-teaching-api-ur-redis-svc" -paas_api_application_name="get-into-teaching-api-ur" -paas_api_route_name="get-into-teaching-api-ur" -logging = 0 - -CRM_SERVICE_URL="https://gitis-dev.api.crm4.dynamics.com" -ASPNETCORE_ENVIRONMENT="Staging" From df1969283e751d79095dfd20ff02e3aacaaec044 Mon Sep 17 00:00:00 2001 From: Steven Fawcett Date: Mon, 28 Sep 2020 09:13:05 +0100 Subject: [PATCH 3/3] No need for UR workflow --- .github/workflows/ur.yml | 105 --------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 .github/workflows/ur.yml diff --git a/.github/workflows/ur.yml b/.github/workflows/ur.yml deleted file mode 100644 index e894822ca..000000000 --- a/.github/workflows/ur.yml +++ /dev/null @@ -1,105 +0,0 @@ ---- -name: Release to UR -on: - workflow_dispatch: - -env: - DOCKERHUB_REPOSITORY: dfedigital/get-into-teaching-api - CF_PROVIDER_DIR: $HOME/.terraform.d/plugins/linux_amd64/terraform-provider-cloudfoundry - CF_PROVIDER_URL: https://github.com/cloudfoundry-community/terraform-provider-cloudfoundry/releases/download/v0.12.3/terraform-provider-cloudfoundry_v0.12.3_linux_amd64 - -jobs: - deploy_qa: - name: 'Deploy to User Research (UR)' - runs-on: ubuntu-latest - - defaults: - run: - shell: bash - - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Get Short SHA - id: sha - run: echo ::set-output name=short::$(git rev-parse --short $GITHUB_SHA) - - - name: Install Terraform CloudFoundry Provider - run: | - mkdir -p $HOME/.terraform.d/plugins/linux_amd64 - wget -O ${{ env.CF_PROVIDER_DIR }} ${{ env.CF_PROVIDER_URL }} - chmod +x ${{ env.CF_PROVIDER_DIR }} - - - name: Wait for any previous runs to complete - uses: softprops/turnstyle@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - continue-after-seconds: 180 - - - uses: hashicorp/setup-terraform@v1 - with: - terraform_version: 0.12.29 - - - name: Terraform Init - run: | - cd terraform/paas && pwd - terraform init -backend-config=ur.bk.vars - env: - ARM_ACCESS_KEY: "${{ secrets.TEST_ARM_ACCESS_KEY }}" - TF_VAR_user: "${{ secrets.GOVUKPAAS_USERNAME }}" - TF_VAR_password: "${{ secrets.GOVUKPAAS_PASSWORD }}" - - - name: Terraform Plan - run: | - cd terraform/paas && pwd - terraform plan -var-file=ur.env.tfvars -out plan - env: - ARM_ACCESS_KEY: "${{ secrets.TEST_ARM_ACCESS_KEY }}" - TF_VAR_user: "${{ secrets.GOVUKPAAS_USERNAME }}" - TF_VAR_password: "${{ secrets.GOVUKPAAS_PASSWORD }}" - TF_VAR_paas_api_docker_image: ${{env.DOCKERHUB_REPOSITORY}}:sha-${{ steps.sha.outputs.short}} - TF_VAR_CRM_SERVICE_URL: "${{ secrets.CRM_SERVICE_URL }}" - TF_VAR_CRM_CLIENT_ID: "${{ secrets.CRM_CLIENT_ID }}" - TF_VAR_CRM_CLIENT_SECRET: "${{ secrets.CRM_CLIENT_SECRET }}" - TF_VAR_CRM_TENANT_ID: "${{ secrets.CRM_TENANT_ID }}" - TF_VAR_SHARED_SECRET: "${{ secrets.SHARED_SECRET }}" - TF_VAR_NOTIFY_API_KEY: "${{ secrets.NOTIFY_API_KEY }}" - TF_VAR_TOTP_SECRET_KEY: "${{ secrets.TOTP_SECRET_KEY }}" - - - name: Terraform Apply - run: | - cd terraform/paas && pwd - terraform apply -auto-approve plan - env: - ARM_ACCESS_KEY: "${{ secrets.TEST_ARM_ACCESS_KEY }}" - TF_VAR_user: "${{ secrets.GOVUKPAAS_USERNAME }}" - TF_VAR_password: "${{ secrets.GOVUKPAAS_PASSWORD }}" - - - name: Smoke Test - run: | - tests/confidence/healthcheck.sh "get-into-teaching-api-ur" "${{ steps.sha.outputs.short}}" - - - name: Create Sentry release - if: success() - uses: getsentry/action-release@v1.0.0 - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG }} - SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} - with: - environment: ur - - - name: Slack Notification - if: failure() - uses: rtCamp/action-slack-notify@master - env: - SLACK_CHANNEL: getintoteaching_tech - SLACK_COLOR: '#3278BD' - SLACK_ICON: https://github.com/rtCamp.png?size=48 - SLACK_MESSAGE: ':disappointed_relieved: Pipeline Failure carrying out job ${{github.job}} :disappointed_relieved:' - SLACK_TITLE: 'Failure: ${{ github.workflow }}' - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} -