Skip to content

Commit b91f56e

Browse files
authored
Merge branch 'dev' into master
2 parents 4b11a4d + 08eb653 commit b91f56e

File tree

354 files changed

+85717
-8378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

354 files changed

+85717
-8378
lines changed

.eslintrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@
118118
}
119119
],
120120
"no-shadow": "off",
121+
"no-underscore-dangle": [
122+
"error",
123+
{
124+
"allow": ["_def"]
125+
}
126+
],
121127
"no-unreachable": "error",
122128
"no-use-before-define": "off",
123129
"no-useless-constructor": "off"

infrastructure/parameters/dev.parameters.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"devopsSPN": {
5151
"value": "e541f669-7fac-4d33-b480-29b523b9d968",
5252
"metadata": {
53-
"comments": "ObjectId for s101d-datahub-spn-ees-dfe-gov-uk"
53+
"comments": "ObjectId for s101d-datahub-spn-ees-dfe-gov-uk"
5454
}
5555
},
5656
"domain": {
@@ -62,6 +62,9 @@
6262
"dataApiUrl": {
6363
"value": "data.dev.explore-education-statistics.service.gov.uk"
6464
},
65+
"publicApiUrl": {
66+
"value": "dev.statistics.api.education.gov.uk"
67+
},
6568
"detailedErrors": {
6669
"value": true
6770
},
@@ -72,7 +75,7 @@
7275
"value": "G-GRPHH2FN0L"
7376
},
7477
"enableSwagger": {
75-
"value": true
78+
"value": true
7679
},
7780
"enableThemeDeletion": {
7881
"value": true
@@ -81,7 +84,7 @@
8184
"value": 10
8285
},
8386
"branch": {
84-
"value": "dev"
87+
"value": "dev"
8588
},
8689
"skuContentDb": {
8790
"value": "Standard"

infrastructure/parameters/pre-prod.parameters.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"devopsSPN": {
4242
"value": "2d5a7bf2-a6b1-4474-b202-ab17dd87c375",
4343
"metadata": {
44-
"comments": "ObjectId for s101prep-datahub-spn-ees-dfe-gov-uk"
44+
"comments": "ObjectId for s101prep-datahub-spn-ees-dfe-gov-uk"
4545
}
4646
},
4747
"domain": {
@@ -53,6 +53,9 @@
5353
"dataApiUrl": {
5454
"value": "data.pre-production.explore-education-statistics.service.gov.uk"
5555
},
56+
"publicApiUrl": {
57+
"value": "pre-production.statistics.api.education.gov.uk"
58+
},
5659
"publicAppGATrackingId": {
5760
"value": "G-8FSLWXTV2W"
5861
},

infrastructure/parameters/prod.parameters.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"devopsSPN": {
4545
"value": "911681c3-8cc7-4afc-8355-4cf60359d743",
4646
"metadata": {
47-
"comments": "ObjectId for s101p-datahub-spn-ees-dfe-gov-uk"
47+
"comments": "ObjectId for s101p-datahub-spn-ees-dfe-gov-uk"
4848
}
4949
},
5050
"domain": {
@@ -56,6 +56,9 @@
5656
"dataApiUrl": {
5757
"value": "data.explore-education-statistics.service.gov.uk"
5858
},
59+
"publicApiUrl": {
60+
"value": "statistics.api.education.gov.uk"
61+
},
5962
"publicAppGATrackingId": {
6063
"value": "G-9YG8ESXR5Y"
6164
},

infrastructure/parameters/test.parameters.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"devopsSPN": {
4242
"value": "22888fee-3aa4-411d-8016-bb8a8c3b825a",
4343
"metadata": {
44-
"comments": "ObjectId for s101t-datahub-spn-ees-dfe-gov-uk"
44+
"comments": "ObjectId for s101t-datahub-spn-ees-dfe-gov-uk"
4545
}
4646
},
4747
"domain": {
@@ -53,6 +53,9 @@
5353
"dataApiUrl": {
5454
"value": "data.test.explore-education-statistics.service.gov.uk"
5555
},
56+
"publicApiUrl": {
57+
"value": "test.statistics.api.education.gov.uk"
58+
},
5659
"detailedErrors": {
5760
"value": true
5861
},

infrastructure/templates/public-api/components/containerApp.bicep

+11-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,19 @@ param containerAppImageName string
1212

1313
@minLength(2)
1414
@maxLength(32)
15-
@description('Specifies the name of the container app.')
15+
@description('Specifies the name of the Container App.')
1616
param containerAppName string
1717

1818
@description('Specifies the container port.')
1919
param containerAppTargetPort int = 8080
2020

21+
@description('The CORS policy to use for the Container App.')
22+
param corsPolicy {
23+
allowedHeaders: string[]?
24+
allowedMethods: string[]?
25+
allowedOrigins: string[]?
26+
}
27+
2128
@description('Number of CPU cores the container can use. Can be with a maximum of two decimals.')
2229
@allowed([
2330
'1'
@@ -88,7 +95,7 @@ param volumeMounts {
8895
var containerImageName = '${acrLoginServer}/${containerAppImageName}'
8996
var containerApplicationName = toLower('${resourcePrefix}-ca-${containerAppName}')
9097

91-
resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
98+
resource containerApp 'Microsoft.App/containerApps@2023-11-02-preview' = {
9299
name: containerApplicationName
93100
location: location
94101
identity: {
@@ -106,6 +113,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
106113
external: true
107114
targetPort: containerAppTargetPort
108115
allowInsecure: false
116+
corsPolicy: corsPolicy
109117
traffic: [
110118
{
111119
latestRevision: true
@@ -123,7 +131,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
123131
template: {
124132
containers: [
125133
{
126-
name: containerAppName
134+
name: containerAppName
127135
image: containerImageName
128136
env: appSettings
129137
resources: {

infrastructure/templates/public-api/deploy-stage-template.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ stages:
2020
- stage: ${{parameters.stageName}}
2121
displayName: 'Deploy ${{parameters.environment}} Infrastructure and Applications'
2222
# Prevent this stage from running in parallel with the same deploy stage in other ongoing runs of this pipeline.
23-
# Instead, multiple executions of this stage will be queued and run sequentially in the order that their pipelines
24-
# were triggered.
23+
# Instead, multiple executions of this stage will be queued and run sequentially in the order that their pipelines
24+
# were triggered.
2525
lockBehavior: sequential
2626
condition: ${{parameters.condition}}
2727
variables:
@@ -68,7 +68,6 @@ stages:
6868
--parameters \
6969
subscription='$(subscription)' \
7070
resourceTags='$(resourceTags)' \
71-
publicUrls='$(publicUrls)' \
7271
postgreSqlAdminName='$(postgreSqlAdminName)' \
7372
postgreSqlAdminPassword='$(postgreSqlAdminPassword)' \
7473
postgreSqlFirewallRules='$(maintenanceFirewallRules)' \
@@ -122,7 +121,7 @@ stages:
122121
--settings \
123122
"PublicDataDb=@Microsoft.KeyVault(VaultName=$(keyVaultName); SecretName=$(dataProcessorPsqlConnectionStringSecretKey))"
124123
125-
# TODO EES-5128 - add Private Endpoint to Data Processor Function App into the VMSS VNet to allow DevOps to
124+
# TODO EES-5128 - add Private Endpoint to Data Processor Function App into the VMSS VNet to allow DevOps to
126125
# deploy the Data Processor Function App without having to temporarily make it publicly accessible.
127126
- task: AzureCLI@2
128127
displayName: 'Deploy Data Processor Function App - temporarily enable public network access before deploy'
@@ -142,11 +141,11 @@ stages:
142141
publicNetworkAccess=Enabled \
143142
siteConfig.publicNetworkAccess=Enabled
144143
145-
# TODO EES-5128 - we will try several attempts to deploy the Function App in order to allow the staging
144+
# TODO EES-5128 - we will try several attempts to deploy the Function App in order to allow the staging
146145
# slot the time to fully restart after appsettings and network visibility settings have been updated prior to
147-
# attempting the deploy. Deploying prematurely results in a 500 from the deployment endpoint until the
146+
# attempting the deploy. Deploying prematurely results in a 500 from the deployment endpoint until the
148147
# endpoint is ready to accept the deployment request. In the future it would be preferable to have a health
149-
# check Function that we could call to establish that the site is ready, but this will require adding the
148+
# check Function that we could call to establish that the site is ready, but this will require adding the
150149
# Service Principal to allowed Client IDs / Identities that can access the Function App. The Service Principal
151150
# that is performing the deploy can be accessed by using the "addSpnToEnvironment" config option in the task
152151
# definition and using the $(servicePrincipalId) variable.
@@ -165,7 +164,7 @@ stages:
165164
--resource-group $(resourceGroupName) \
166165
--slot staging
167166
168-
# TODO EES-5128 - add Private Endpoint to Data Processor Function App into the VMSS VNet to allow DevOps to
167+
# TODO EES-5128 - add Private Endpoint to Data Processor Function App into the VMSS VNet to allow DevOps to
169168
# deploy the Data Processor Function App without having to temporarily make it publicly accessible.
170169
- task: AzureCLI@2
171170
displayName: 'Deploy Data Processor Function App - disable public network access after deploy'

infrastructure/templates/public-api/main.bicep

+12-4
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,16 @@ param dockerImagesTag string = ''
6464
@description('Can we deploy the Container App yet? This is dependent on the user-assigned Managed Identity for the API Container App being created with the AcrPull role, and the database users added to PSQL.')
6565
param deployContainerApp bool = true
6666

67-
// TODO EES-5128 - Note that this has been added temporarily to avoid 10+ minute deploys where it appears that PSQL
67+
// TODO EES-5128 - Note that this has been added temporarily to avoid 10+ minute deploys where it appears that PSQL
6868
// will redeploy even if no changes exist in this deploy from the previous one.
6969
@description('Does the PostgreSQL Flexible Server require any updates? False by default to avoid unnecessarily lengthy deploys.')
7070
param updatePsqlFlexibleServer bool = false
7171

7272
@description('Public URLs of other components in the service.')
7373
param publicUrls {
7474
contentApi: string
75-
}?
75+
publicApp: string
76+
}
7677

7778
@description('Specifies whether or not the Data Processor Function App already exists.')
7879
param dataProcessorFunctionAppExists bool = false
@@ -256,11 +257,18 @@ module apiContainerAppModule 'components/containerApp.bicep' = if (deployContain
256257
params: {
257258
resourcePrefix: resourcePrefix
258259
location: location
259-
containerAppName: apiContainerAppName
260+
containerAppName: apiContainerAppName
260261
acrLoginServer: containerRegistry.properties.loginServer
261262
containerAppImageName: 'ees-public-api/api:${dockerImagesTag}'
262263
userAssignedManagedIdentityId: apiContainerAppManagedIdentity.id
263264
managedEnvironmentId: containerAppEnvironmentModule.outputs.containerAppEnvironmentId
265+
corsPolicy: {
266+
allowedOrigins: [
267+
publicUrls.publicApp
268+
'http://localhost:3000'
269+
'http://127.0.0.1'
270+
]
271+
}
264272
volumeMounts: [
265273
{
266274
volumeName: dataFilesFileShareMountName
@@ -291,7 +299,7 @@ module apiContainerAppModule 'components/containerApp.bicep' = if (deployContain
291299
}
292300
{
293301
name: 'ContentApi__Url'
294-
value: publicUrls!.contentApi
302+
value: publicUrls.contentApi
295303
}
296304
{
297305
name: 'MiniProfiler__Enabled'

infrastructure/templates/public-api/parameters/main-dev.bicepparam

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ using '../main.bicep'
33
// Environment Params
44
param environmentName = 'Development'
55

6+
param publicUrls = {
7+
contentApi: 'https://content.dev.explore-education-statistics.service.gov.uk'
8+
publicApp: 'https://dev.explore-education-statistics.service.gov.uk'
9+
}
10+
611
// PostgreSQL Database Params
712
param postgreSqlSkuName = 'Standard_B1ms'
813
param postgreSqlStorageSizeGB = 32

infrastructure/templates/public-api/parameters/main-preprod.bicepparam

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ using '../main.bicep'
33
// Environment Params
44
param environmentName = 'Pre-Production'
55

6+
param publicUrls = {
7+
contentApi: 'https://s101p02-as-ees-content.azurewebsites.net'
8+
publicApp: 'https://pre-production.explore-education-statistics.service.gov.uk'
9+
}
10+
611
// PostgreSQL Database Params
712
param postgreSqlSkuName = 'Standard_B1ms'
813
param postgreSqlStorageSizeGB = 32

infrastructure/templates/public-api/parameters/main-prod.bicepparam

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ using '../main.bicep'
33
// Environment Params
44
param environmentName = 'Production'
55

6+
param publicUrls = {
7+
contentApi: 'https://content.explore-education-statistics.service.gov.uk'
8+
publicApp: 'https://explore-education-statistics.service.gov.uk'
9+
}
10+
611
// PostgreSQL Database Params
712
param postgreSqlSkuName = 'Standard_B1ms'
813
param postgreSqlStorageSizeGB = 32

infrastructure/templates/public-api/parameters/main-test.bicepparam

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ using '../main.bicep'
33
// Environment Params
44
param environmentName = 'Test'
55

6+
param publicUrls = {
7+
contentApi: 'https://content.test.explore-education-statistics.service.gov.uk'
8+
publicApp: 'https://test.explore-education-statistics.service.gov.uk'
9+
}
10+
611
// PostgreSQL Database Params
712
param postgreSqlSkuName = 'Standard_B1ms'
813
param postgreSqlStorageSizeGB = 32

infrastructure/templates/public-api/validate-stage-template.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ stages:
1717
- stage: ${{parameters.stageName}}
1818
displayName: 'Validate ${{parameters.environment}} Infrastructure'
1919
# Prevent this stage from running in parallel with the same deploy stage in other ongoing runs of this pipeline.
20-
# Instead, multiple executions of this stage will be queued and run sequentially in the order that their pipelines
21-
# were triggered.
20+
# Instead, multiple executions of this stage will be queued and run sequentially in the order that their pipelines
21+
# were triggered.
2222
lockBehavior: sequential
2323
condition: ${{parameters.condition}}
2424
variables:
@@ -52,7 +52,6 @@ stages:
5252
--parameters \
5353
subscription='$(subscription)' \
5454
resourceTags='$(resourceTags)' \
55-
publicUrls='$(publicUrls)' \
5655
postgreSqlAdminName='$(postgreSqlAdminName)' \
5756
postgreSqlAdminPassword='$(postgreSqlAdminPassword)' \
5857
postgreSqlFirewallRules='$(maintenanceFirewallRules)' \

infrastructure/templates/template.json

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"dataApiUrl": {
1212
"type": "string"
1313
},
14+
"publicApiUrl": {
15+
"type": "string"
16+
},
1417
"subscription": {
1518
"type": "string",
1619
"defaultValue": "",
@@ -2061,6 +2064,7 @@
20612064
"NEXT_CONFIG_MODE": "server",
20622065
"NODE_ENV": "production",
20632066
"PUBLIC_URL": "[concat(variables('publicAppUrl'), '/')]",
2067+
"PUBLIC_API_BASE_URL": "[concat('https://', parameters('publicApiUrl'),'/api/v1.0')]",
20642068
"WEBSITE_NODE_DEFAULT_VERSION": "20.14.0",
20652069
"WEBSITES_PORT": 3000
20662070
}

renovate.json

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
"matchPackageNames": ["node"],
6767
"groupName": "Node version",
6868
"enabled": false
69+
},
70+
{
71+
"matchDatasources": ["azure-bicep-resource"],
72+
"groupName": "Azure Bicep resources",
73+
"description": "Prevent unofficial resource versions being suggested",
74+
"enabled": false
6975
}
7076
]
7177
}

0 commit comments

Comments
 (0)