Skip to content

Commit

Permalink
Merge branch 'main-application-no-pdf' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Zain Kassam committed Nov 10, 2023
2 parents b2ca6e7 + db7b115 commit 6341085
Show file tree
Hide file tree
Showing 449 changed files with 7,428 additions and 8,572 deletions.
11 changes: 9 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@
"noConfigSearch": true,
"allowCompoundWords": true,
"words": [
"Abhi",
"2payzd",
"Abhi",
"acbs",
"actionsheet",
"APIM",
"azurecr",
"BBALIBOR",
"behaviour",
"Bloggs",
"BLPU",
"centralised",
"CICD",
"CILC",
Expand All @@ -57,6 +58,7 @@
"enddate",
"ESRA",
"Estore",
"EPSG",
"ESTR",
"EWCS",
"exip",
Expand Down Expand Up @@ -89,6 +91,7 @@
"numbergenerator",
"NVARCHAR",
"organisation",
"osgb",
"outro",
"OUTRO",
"pino",
Expand All @@ -103,18 +106,22 @@
"ssword",
"startdate",
"szenius",
"TOID",
"typeorm",
"Typeorm",
"typescript",
"UDPRN",
"ukef",
"UKEF",
"uksouth",
"Unauthorised",
"UPRN",
"Useds",
"venv",
"VNET",
"XLSX",
"octocat",
"Ordance",
"ministryofjustice",
"outro",
"GUIDLINES",
Expand All @@ -130,7 +137,7 @@
"UNSUPPORTRED",
"alphanum",
"hrefs",
"sqldb"
"occured"
],
"dictionaries": [
"en-gb",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Each stage in the workflow is associated with one or more jobs that contain spec

- **Security 🔑**: Security measures are implemented in this job.

- **Web App 🔧**: This job configures web applications environment variables, application settings, database connection and other CI/CD configurations.
- **Web App 🔧**: This job configures web applications and related services.

- **Logs and Diagnostic Settings 📒**: Configure logging and diagnostic settings for monitoring and troubleshooting.

Expand All @@ -115,7 +115,7 @@ To run this infrastructure automation workflow, follow these steps:

### Conclusion 🎉

The EXIP Infrastructure Automation workflow streamlines the process of setting up infrastructure components, enhancing security, configuring web applications and database With the automation in place, you can maintain consistent environments for development, staging, and production, and deploy with confidence.
The EXIP Infrastructure Automation workflow streamlines the process of setting up infrastructure components, enhancing security, and configuring web applications. With the automation in place, you can maintain consistent environments for development, staging, and production, and deploy with confidence.

If you have any questions or need further assistance, please don't hesitate to reach out to the development team. Happy automating! 🤖✨

Expand Down
51 changes: 9 additions & 42 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-naming
#
#
# Following Azure services are consumed:
# 1. Azure resource group - https://learn.microsoft.com/en-us/cli/azure/group?view=azure-cli-latest#az-group-create
# 2. Azure container registry - https://learn.microsoft.com/en-us/cli/azure/acr?view=azure-cli-latest#az-acr-create
# 3. Azure WebApp - https://learn.microsoft.com/en-us/azure/app-service/overview
#
#
# Execution
# *********
# GHA is only invoked when following conditions are satisfied:
Expand Down Expand Up @@ -48,48 +54,6 @@ jobs:
- name: Timezone 🌐
run: echo "Timezone set to ${{ env.TIMEZONE }}"

db:
name: Database 💾
needs: setup
environment: ${{ needs.setup.outputs.environment }}
if: ${{ '1' == vars.DATABASE }}
env:
ENVIRONMENT: ${{ needs.setup.outputs.environment }}
runs-on: [self-hosted, EXIP, deployment]
steps:
- name: Repository 🗃️
uses: actions/checkout@v4

- name: Azure 🔐
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Defaults ✨
uses: Azure/[email protected]
with:
inlineScript: |
# Basic
az configure --defaults location=${{ vars.REGION }}
az configure --defaults group=rg-${{ env.PRODUCT }}-${{ github.ref_name }}-${{ vars.VERSION }}
- name: Extension ➕
uses: Azure/[email protected]
with:
inlineScript: |
az config set extension.use_dynamic_install=yes_without_prompt
- name: Import ⬇
uses: Azure/[email protected]
with:
inlineScript: |
az mysql flexible-server execute \
--name sqldb-${{ env.PRODUCT }}-${{ github.ref_name }}-${{ vars.VERSION }} \
--admin-user ${{ secrets.MYSQL_USER }} \
--admin-password ${{ secrets.MYSQL_PASSWORD }} \
--database-name ${{ env.PRODUCT }} \
--file-path "database/exip.sql"
api:
name: API 📦️
needs: setup
Expand Down Expand Up @@ -157,6 +121,9 @@ jobs:
WEBSITES_PORT='${{ vars.API_PORT }}' \
TLS_CERTIFICATE='${{ secrets.TLS_CERTIFICATE }}' \
TLS_KEY='${{ secrets.TLS_KEY }}' \
DATABASE_URL='${{ secrets.DATABASE_URL }}' \
MYSQL_DATABASE='${{ secrets.MYSQL_DATABASE }}' \
MYSQL_ROOT_PASSWORD='${{ secrets.MYSQL_ROOT_PASSWORD }}' \
API_KEY='${{ secrets.API_KEY }}' \
APIM_MDM_URL='${{ secrets.APIM_MDM_URL }}' \
APIM_MDM_KEY='${{ secrets.APIM_MDM_KEY }}' \
Expand Down
99 changes: 15 additions & 84 deletions .github/workflows/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ jobs:
uses: Azure/[email protected]
with:
inlineScript: |
# Database
az network vnet subnet create \
--name snet-database-${{ env.PRODUCT }}-${{ vars.VERSION }} \
--address-prefixes ${{ vars.VNET_SUBNET_DATABASE_PREFIX }} \
--vnet-name vnet-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }}
# WebApp
az network vnet subnet create \
--name snet-webapp-${{ env.PRODUCT }}-${{ vars.VERSION }} \
Expand Down Expand Up @@ -212,53 +206,6 @@ jobs:
--name vnet-peer-apim-${{ env.TARGET }}-${{ env.PRODUCT }}-${{ vars.VERSION }} \
--query peeringState)"
- name: VNET Peer - UKS 🔀
uses: Azure/[email protected]
with:
inlineScript: |
# UKS VNET peering
# Local VNET peer
az network vnet peering create \
--name vnet-peer-uks-${{ env.TARGET }}-${{ env.PRODUCT }}-${{ vars.VERSION }} \
--vnet-name vnet-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }} \
--remote-vnet $(az network vnet show --subscription ${{ secrets.REMOTE_VNET_SUBSCRIPTION_UKS }} --resource-group ${{ secrets.REMOTE_VNET_RESOURCE_GROUP_UKS }} --name ${{ secrets.REMOTE_VNET_NAME_UKS }} --query 'id' -o tsv) \
--allow-vnet-access 1
# Remote VNET peer
az network vnet peering create \
--name vnet-peer-uks-${{ env.TARGET }}-${{ env.PRODUCT }}-${{ vars.VERSION }} \
--vnet-name ${{ secrets.REMOTE_VNET_NAME_UKS }} \
--remote-vnet $(az network vnet show --name vnet-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }} --query 'id' -o tsv) \
--allow-vnet-access 1 \
--subscription ${{ secrets.REMOTE_VNET_SUBSCRIPTION_UKS }} \
--resource-group ${{ secrets.REMOTE_VNET_RESOURCE_GROUP_UKS }}
# Fetch peering state
echo "Peering state: $(az network vnet peering show \
--vnet-name vnet-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }} \
--name vnet-peer-uks-${{ env.TARGET }}-${{ env.PRODUCT }}-${{ vars.VERSION }} \
--query peeringState)"
- name: Database 💾
uses: Azure/[email protected]
with:
inlineScript: |
az mysql flexible-server create \
--name sqldb-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }} \
--admin-user ${{ secrets.MYSQL_USER }} \
--admin-password ${{ secrets.MYSQL_PASSWORD }} \
--database-name ${{ env.PRODUCT }} \
--sku-name Standard_B1ms \
--tier Burstable \
--vnet vnet-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }} \
--subnet snet-database-${{ env.PRODUCT }}-${{ vars.VERSION }} \
--address-prefixes ${{ vars.VNET_ADDRESS_PREFIX }} \
--subnet-prefix ${{ vars.VNET_SUBNET_DATABASE_PREFIX }} \
--backup-retention 30 \
--yes \
--tags ${{ env.TAGS }}
- name: Web app - UI 🌐
uses: Azure/[email protected]
with:
Expand Down Expand Up @@ -589,7 +536,6 @@ jobs:
- name: Variables ✨
run: |
echo "API_URL=$(az webapp show --name app-${{ env.PRODUCT }}-api-${{ env.TARGET }}-${{ vars.VERSION }} --query defaultHostName -o tsv)" >> $GITHUB_ENV
echo "MYSQL_URL=$(az mysql flexible-server list --query [].fullyQualifiedDomainName -o tsv)" >> $GITHUB_ENV
- name: Setting 🧱
uses: Azure/[email protected]
Expand Down Expand Up @@ -623,7 +569,9 @@ jobs:
WEBSITES_PORT='${{ vars.API_PORT }}' \
TLS_CERTIFICATE='${{ secrets.TLS_CERTIFICATE }}' \
TLS_KEY='${{ secrets.TLS_KEY }}' \
DATABASE_URL='mysql://${{ secrets.MYSQL_USER }}:${{ secrets.MYSQL_PASSWORD }}@${{ env.MYSQL_URL }}:${{ vars.DATABASE_PORT }}/${{ env.PRODUCT }}' \
DATABASE_URL='${{ secrets.DATABASE_URL }}' \
MYSQL_DATABASE='${{ secrets.MYSQL_DATABASE }}' \
MYSQL_ROOT_PASSWORD='${{ secrets.MYSQL_ROOT_PASSWORD }}' \
API_KEY='${{ secrets.API_KEY }}' \
APIM_MDM_URL='${{ secrets.APIM_MDM_URL }}' \
APIM_MDM_KEY='${{ secrets.APIM_MDM_KEY }}' \
Expand All @@ -636,26 +584,6 @@ jobs:
UNDERWRITING_TEAM_EMAIL='${{ secrets.UNDERWRITING_TEAM_EMAIL }}' \
FEEDBACK_EMAIL_RECIPIENT='${{ secrets.FEEDBACK_EMAIL_RECIPIENT }}'
- name: Extension ➕
uses: Azure/[email protected]
with:
inlineScript: |
az config set extension.use_dynamic_install=yes_without_prompt
- name: Repository 🗃️
uses: actions/checkout@v4

- name: Database 💾
uses: Azure/[email protected]
with:
inlineScript: |
az webapp connection create mysql-flexible \
--source-id $(az webapp show --name app-${{ env.PRODUCT }}-api-${{ env.TARGET }}-${{ vars.VERSION }} --query id -o tsv) \
--target-id $(az mysql flexible-server list --query [].id -o tsv)/databases/${{ env.PRODUCT }} \
--connection webapp_api_mysqlflexible_${{ env.PRODUCT }}_${{ env.TARGET }}_${{ vars.VERSION }} \
--secret name=${{ secrets.MYSQL_USER }} secret=${{ secrets.MYSQL_PASSWORD }} \
--client-type nodejs
# 5. Logs and dignostic settings
log:
name: Log 📒
Expand Down Expand Up @@ -695,18 +623,21 @@ jobs:
--logs "[{categoryGroup:allLogs,enabled:true}]" \
--metrics "[{category:allMetrics,enabled:true}]"
- name: Database 💾
- name: WebApp 🌐
uses: Azure/[email protected]
with:
inlineScript: |
az monitor diagnostic-settings create \
--name sqldb-${{ env.PRODUCT }}-${{ env.TARGET }}-${{ vars.VERSION }} \
--resource $(az mysql flexible-server list --query [].id -o tsv) \
--workspace $(az monitor log-analytics workspace list --query [].id -o tsv) \
--logs "[{categoryGroup:allLogs,enabled:true}]" \
--metrics "[{category:allMetrics,enabled:true}]"
# UI
az webapp log config \
--name app-${{ env.PRODUCT }}-ui-${{ env.TARGET }}-${{ vars.VERSION }} \
--detailed-error-messages true \
--failed-request-tracing true \
--level ${{ vars.WEBAPP_LOG_LEVEL }} \
--application-logging ${{ vars.WEBAPP_LOG_DESTINATION }} \
--docker-container-logging ${{ vars.WEBAPP_LOG_DESTINATION }} \
--web-server-logging ${{ vars.WEBAPP_LOG_DESTINATION }}
- name: WebApp 🌐
- name: Log 📄
uses: Azure/[email protected]
with:
inlineScript: |
Expand Down Expand Up @@ -759,7 +690,7 @@ jobs:
--workspace $(az monitor log-analytics workspace list --query [].id -o tsv) \
--metrics "[{category:allMetrics,enabled:true}]"
# 6. Health check alerts
# 5. Health check alerts
alert:
name: Alert 📢
needs: [base, security, webapp]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ run-name: Executing lint QA on ${{ github.repository }} 🚀

on:
pull_request:
branches: [main]
branches: [main-application, main-application-no-pdf]
paths:
- '.github/workflows/lint.yml'
- 'src/**'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ run-name: Executing test QA on ${{ github.repository }} 🚀

on:
pull_request:
branches: [main]
branches: [main-application, main-application-no-pdf]
paths:
- ".github/workflows/test.yml"
- "src/**"
Expand Down Expand Up @@ -213,7 +213,6 @@ jobs:
"your-business/broker/**/*.spec.js",
"your-business/change-your-answers/**/*.spec.js",
"your-business/check-your-answers/**/*.spec.js",
"your-business/companies-house-number/**/*.spec.js",
"your-business/company-details/**/*.spec.js",
"your-business/nature-of-business/**/*.spec.js",
"your-business/turnover/**/*.spec.js",
Expand Down Expand Up @@ -317,7 +316,7 @@ jobs:
matrix:
spec:
[
"via-buyer-country-routes/**/*.spec.js",
"via-exporter-location-routes/**/*.spec.js",
"via-start-now-routes/**/*.spec.js",
]

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ services:
APIM_MDM_URL:
APIM_MDM_KEY:
APIM_MDM_VALUE:
ORDNANCE_SURVEY_API_KEY:
ORDNANCE_SURVEY_API_URL:

ui:
build:
Expand Down
Loading

0 comments on commit 6341085

Please sign in to comment.