Skip to content

Commit f67d411

Browse files
authored
Merge pull request #1948 from UK-Export-Finance/EMS-2898-database-tier
feat(EMS-2898): Database tier
2 parents 3d726d0 + e2eb580 commit f67d411

File tree

1 file changed

+40
-22
lines changed

1 file changed

+40
-22
lines changed

.github/workflows/infrastructure.yml

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1-
# Introduction
2-
# ***************
3-
# This code snippet is a GitHub Actions workflow file that automates the setup and configuration of the EXIP project's infrastructure using Azure CLI commands.
4-
# It creates various Azure resources such as resource groups, app service plans, log analytics workspaces, container registries, virtual networks, subnets, VNET peerings,
5-
# web apps, front doors, private endpoints, DNS configurations, and diagnostic settings. It also sets environment variables and configures the web apps with app settings and logging options.
1+
# This code snippet is a YAML configuration file for a GitHub Actions workflow. It defines a series of jobs and steps to set up infrastructure, create base
2+
# infrastructure resources, configure security settings, configure a web app, enable logging and diagnostic settings, and set up health check alerts.
3+
# The workflow is triggered on pushes to the 'infrastructure' and 'EMS-2898-database-tier' branches. It uses environment variables to define the product, environment,
4+
# timezone, and target. The jobs are organized into sections for setup, base infrastructure creation, security configuration, web app configuration, logging and diagnostic settings, and health check alerts.
5+
# Each step in the workflow performs a specific task using the Azure CLI, such as creating resource groups, app service plans, log analytics workspaces, container registries,
6+
# virtual networks, subnets, VNET peering, databases, web apps, front doors, WAF policies, private endpoints, DNS configurations, and more.
7+
# The workflow also includes conditional steps based on the target environment, such as different configurations for pre-production and production environments.
8+
# Overall, this code snippet provides a comprehensive configuration for setting up infrastructure and configuring various resources in an Azure environment using GitHub Actions.
69
#
7-
# Naming conventions
8-
# ******************
9-
# Standard Azure naming convention has been followed:
10-
# https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-naming
11-
# A minor modification to standard naming convention has been made to not include the region.
10+
# Inputs
11+
# ------
12+
# The inputs for this code snippet include the environment, target, and various variables such as region, database SKU, database tier, app service plan SKU, log quota, log retention day, log plan,
13+
# VNET address prefix, VNET subnet database prefix, VNET subnet web app prefix, VNET subnet private prefix, health probe path, health probe protocol, health probe HTTP method, health probe latency,
14+
# load balancing sample size, load balancing samples, load balancing interval, TLS version, web app log level, web app log destination, action group email, and various secrets.
1215
#
13-
# Execution
14-
# *********
15-
# GHA is only invoked when following conditions are satisfied:
16-
# 1. Push to the `infrastructure` branch only.
16+
# Flow
17+
# ----
18+
# The code starts by setting up infrastructure variables and outputs the environment and timezone.
19+
# It then creates the base infrastructure, including the resource group, app service plan, log analytics workspace, container registry, virtual network,
20+
# subnets, VNET peering, database, web app, and front door.
21+
# Next, it sets up security measures such as private endpoints, private DNS, and WAF policies.
22+
# It then configures the web app, including enabling continuous deployment, setting configuration variables, and creating a database connection.
23+
# The code sets up diagnostic settings for logging and monitoring of various resources.
24+
# Finally, it creates an alert for health checks on the front door.
1725
#
18-
# Note
19-
# ****
20-
# Azure CLI will merely ignore the new resource creation if already exist with the same name.
26+
# Outputs
27+
# -------
28+
# The outputs of this code snippet include the environment and various resources created, such as the resource group, app service plan, log analytics workspace, container
29+
# registry, virtual network, subnets, database, web app, front door, and security policies.
2130
#
2231

2332
name: Infrastructure 🔨
@@ -61,11 +70,17 @@ jobs:
6170
steps:
6271
- name: Pre-production 💫
6372
if: contains('["dev", "feature", "staging"]', env.TARGET)
64-
run: echo "TYPE=Preproduction" >> $GITHUB_ENV
73+
run: |
74+
echo "TYPE=Preproduction" >> $GITHUB_ENV
75+
echo "DB_SKU=${{ VARS.DB_NON_PROD_SKU }}" >> $GITHUB_ENV
76+
echo "DB_TIER=${{ VARS.DB_NON_PROD_TIER }}" >> $GITHUB_ENV
6577
6678
- name: Production 💫
6779
if: ${{ 'production' == env.TARGET }}
68-
run: echo "TYPE=Production" >> $GITHUB_ENV
80+
run: |
81+
echo "TYPE=Production" >> $GITHUB_ENV
82+
echo "DB_SKU=${{ VARS.DB_PROD_SKU }}" >> $GITHUB_ENV
83+
echo "DB_TIER=${{ VARS.DB_PROD_TIER }}" >> $GITHUB_ENV
6984
7085
- name: Tags 🏷️
7186
run: echo TAGS='Environment=${{ env.TYPE }}' \
@@ -249,13 +264,16 @@ jobs:
249264
--admin-user ${{ secrets.MYSQL_USER }} \
250265
--admin-password ${{ secrets.MYSQL_PASSWORD }} \
251266
--database-name ${{ env.PRODUCT }} \
252-
--sku-name Standard_B1ms \
253-
--tier Burstable \
267+
--storage-size ${{ vars.DB_STORAGE_SIZE_GB }} \
268+
--sku-name ${{ env.DB_SKU }} \
269+
--tier ${{ env.DB_TIER }} \
254270
--vnet vnet-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }} \
255271
--subnet snet-database-${{ env.PRODUCT }}-${{ vars.VERSION }} \
256272
--address-prefixes ${{ vars.VNET_ADDRESS_PREFIX }} \
257273
--subnet-prefix ${{ vars.VNET_SUBNET_DATABASE_PREFIX }} \
258-
--backup-retention 30 \
274+
--backup-retention ${{ vars.DB_DR_DAYS }} \
275+
--auto-scale-iops Enabled \
276+
--storage-auto-grow Enabled \
259277
--yes \
260278
--tags ${{ env.TAGS }}
261279

0 commit comments

Comments
 (0)